/* ========== CasablancaHome Middleware suites - 样式表（统一金色暖色主题） ========== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* ====== 主色调：柔和金色（浅调莫兰迪） ====== */
  --primary: #C9A55B;
  --primary-light: #DDBE7A;
  --primary-dark: #A88940;
  --primary-gradient: linear-gradient(135deg, #E0CA8E 0%, #C9A55B 50%, #B8944A 100%);
  --primary-gradient-light: linear-gradient(135deg, #EDDEAB 0%, #E0CA8E 100%);
  --primary-gradient-deep: linear-gradient(135deg, #B8944A 0%, #A07835 100%);
  /* 强调色 */
  --accent: #C4A06A;
  /* 功能色 - 莫兰迪低饱和度 */
  --success: #6B8F71;
  --error: #C07878;
  --warn: #C9A55B;
  /* 背景色 - 暖色浅色渐变 */
  --bg: linear-gradient(180deg, #faf8f2 0%, #f6f1e8 50%, #f1ebe0 100%);
  --bg-solid: #f6f1e8;
  --card: #FFFFFF;
  --border: #e5dbca;
  --border-light: #e0d4c0;
  /* 文字色 - 莫兰迪暖棕系 */
  --text: #4a3f32;
  --text2: #8a7b64;
  --text3: #a69a85;
  /* 圆角 & 阴影 */
  --radius: 8px;
  --shadow: 0 2px 12px rgba(140,110,60,.06);
  --shadow-hover: 0 4px 20px rgba(200,160,90,.12);
}

body {
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---- 顶部导航（柔和金色）---- */
.navbar {
  background: linear-gradient(135deg, #DDBE7A 0%, #C9A55B 50%, #B8944A 100%);
  color: #4a3f32;
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(180,140,70,.25);
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar .logo { font-size: 20px; font-weight: 700; letter-spacing: .5px; }
.navbar .version { font-size: 12px; background: rgba(255,255,255,.22); padding: 2px 8px; border-radius: 10px; }
.navbar .spacer { flex: 1; }
.navbar .status-badge {
  font-size: 12px; padding: 4px 12px; border-radius: 12px;
  background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.3);
  display: flex; align-items: center; gap: 6px;
}
.navbar .status-badge .dot {
  width: 8px; height: 8px; border-radius: 50%; background: #9E9E9E;
  transition: background .3s;
}
.navbar .status-badge.logged-in .dot { background: #69F0AE; }

/* ---- 主体布局 ---- */
.main-layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

/* ---- 左侧菜单（SAP Fiori 侧栏风格：扁平分区、左边线激活、轻分隔） ---- */
.sidebar {
  width: 232px;
  background: #faf8f3;
  border-right: 1px solid #e6dcc8;
  padding: 0;
  flex-shrink: 0;
  overflow-x: hidden;
  overflow-y: auto;
}
.sidebar a,
.sidebar a:link,
.sidebar a:visited,
.sidebar a:hover,
.sidebar a:active {
  text-decoration: none;
}
.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text3);
  letter-spacing: 0.08em;
  padding: 14px 16px 10px;
  margin: 0;
  text-transform: uppercase;
  border-bottom: 1px solid #ebe3d4;
  background: #f7f3ea;
}
.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 8px;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  line-height: 1.35;
  color: var(--text);
  border-left: 3px solid transparent;
  border-radius: 0 2px 2px 0;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
  user-select: none;
  text-decoration: none;
}
.sidebar-item:hover {
  background: rgba(201, 165, 91, 0.1);
  color: var(--primary-dark);
}
.sidebar-item.active {
  background: rgba(201, 165, 91, 0.16);
  color: #6b4f1d;
  border-left-color: var(--primary);
  font-weight: 600;
}
.sidebar-item .icon { font-size: 16px; width: 20px; text-align: center; }
.sidebar-divider { border: none; border-top: 1px solid var(--border-light); margin: 8px 16px; }

/* ====== 侧边栏分组导航 ====== */
.sidebar-group {
  font-size: 12px;
  font-weight: 700;
  color: #7c5e2a;
  padding: 14px 20px 4px;
  letter-spacing: .5px;
}
.sidebar-nav-group {
  margin: 0;
  border-bottom: 1px solid #ebe3d4;
}
.sidebar-nav-group:last-child {
  border-bottom: none;
}
.sidebar-nav-group .sidebar-group-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 10px 12px 8px 16px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  color: #7c5e2a;
  letter-spacing: 0.04em;
  text-align: left;
  transition: background .15s ease, color .15s ease;
}
.sidebar-nav-group .sidebar-group-toggle:hover {
  color: #5c4318;
  background: rgba(201, 165, 91, 0.06);
}
.sidebar-nav-group .sidebar-group-toggle:focus-visible {
  outline: 2px solid rgba(201, 165, 91, 0.45);
  outline-offset: -2px;
}
.sidebar-nav-group .sidebar-group-label {
  flex: 1;
  min-width: 0;
}
.sidebar-nav-group .sidebar-group-chevron {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  box-shadow: none;
  color: inherit;
  opacity: 0.72;
  transition: transform .2s ease, opacity .15s ease, background .15s ease;
}
.sidebar-nav-group .sidebar-group-toggle:hover .sidebar-group-chevron {
  opacity: 1;
  background: rgba(201, 165, 91, 0.12);
  transform: none;
}
.sidebar-nav-group .sidebar-group-chevron-icon {
  width: 0;
  height: 0;
  margin-top: 1px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  filter: none;
}
.sidebar-nav-group.is-collapsed .sidebar-group-chevron { transform: rotate(-90deg); }
.sidebar-nav-group.is-collapsed .sidebar-group-toggle:hover .sidebar-group-chevron {
  transform: rotate(-90deg);
}
.sidebar-nav-group .sidebar-group-items {
  overflow: hidden;
  max-height: 800px;
  padding: 0 0 6px;
  transition: max-height .22s ease, opacity .18s ease;
  opacity: 1;
}
.sidebar-nav-group.is-collapsed .sidebar-group-items {
  max-height: 0;
  opacity: 0;
  padding-bottom: 0;
  pointer-events: none;
}
.sidebar-group-sub {
  padding-left: 36px;
  font-size: 12px;
  color: var(--text3);
  padding-top: 2px;
  padding-bottom: 2px;
}
.sidebar-subgroup {
  font-size: 11px;
  font-weight: 600;
  color: #9a7b4f;
  padding: 10px 20px 2px 28px;
  letter-spacing: .3px;
}
.sidebar-item.sidebar-sub-item {
  padding-left: 28px;
  font-size: 13px;
}

/* ---- 内容区 ---- */
.content {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
  max-width: calc(100vw - 220px);
}

.page { display: none; }
.page.active { display: block; }

/* ---- 卡片 ---- */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  margin-bottom: 20px;
  overflow: hidden;
}
.card-header {
  background: linear-gradient(135deg, #faf6ed 0%, #f3ead5 100%);
  border-bottom: 1px solid var(--border-light);
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-header h3 { font-size: 15px; font-weight: 600; color: var(--primary-dark); }
.card-header .badge {
  font-size: 11px; background: #E0CA8E; color: #5a4832;
  padding: 2px 8px; border-radius: 10px;
}
.card-body { padding: 20px; }

/* ---- 表单控件 ---- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 1fr 1fr 1fr; }

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group.full { grid-column: 1 / -1; }
.form-label {
  font-size: 12px; font-weight: 600; color: var(--text2);
  display: flex; align-items: center; gap: 4px;
}
.form-label .required { color: var(--error); }
.form-label .tip {
  font-weight: 400; color: var(--text3); font-size: 11px; margin-left: 4px;
}
.form-label .optional-tag {
  display: inline-block; font-size: 10px; font-weight: 500;
  background: #F3F4F6; color: #6B7280; border: 1px solid #D1D5DB;
  border-radius: 3px; padding: 0 5px; margin-left: 4px; vertical-align: middle;
}
.form-control {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text);
  background: #fffcf5;
  transition: border-color .2s, box-shadow .2s;
  width: 100%;
  font-family: inherit;
}
.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(184,134,11,.12);
  background: #fff;
}
.form-control::placeholder { color: #c4b69a; }
textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

/* ---- 按钮（金色渐变系列）---- */
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 6px; }
.btn {
  padding: 9px 20px;
  border-radius: 6px;
  border: none;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all .25s ease;
  font-family: inherit;
  white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* 主按钮：柔和金色渐变（浅调） */
.btn-primary {
  background: linear-gradient(135deg, #E8D4A0 0%, #DDBE7A 50%, #D0B560 100%);
  color: #5a4832;
  box-shadow: 0 2px 8px rgba(200,160,90,.18);
}
.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #DDBE7A 0%, #C9A55B 50%, #B8944A 100%);
  box-shadow: 0 4px 16px rgba(200,160,90,.28);
  transform: translateY(-1px);
}

.btn-success { background: #A8C4AD; color: #3a5a40; }
.btn-success:hover:not(:disabled) { background: #95B396; box-shadow: 0 3px 10px rgba(106,143,112,.25); }
.btn-warn { background: #E2D0A0; color: #6b5a30; }
.btn-warn:hover:not(:disabled) { background: #d8c48a; }
.btn-danger { background: #D4A0A0; color: #7a4040; }
.btn-danger:hover:not(:disabled) { background: #c49090; }
.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: 1px solid var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: rgba(200,160,90,.05);
  border-color: var(--primary-light);
}
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ---- 进度指示 ---- */
.loading-spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- 响应结果面板 ---- */
.result-panel {
  background: #1a1612;
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid #3a3028;
}
.result-toolbar {
  background: #241e18;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #3a3028;
}
.result-toolbar .rt-title { color: #bfa888; font-size: 12px; font-weight: 600; flex: 1; }
.result-toolbar .rt-status {
  font-size: 11px; padding: 2px 10px; border-radius: 10px;
  font-weight: 600;
}
.rt-status.success { background: rgba(46,125,50,.3); color: #69F0AE; }
.rt-status.error { background: rgba(198,40,40,.3); color: #FF8A80; }
.rt-status.pending { background: rgba(184,134,11,.3); color: #FFD740; }
.result-body {
  padding: 16px;
  font-family: "Consolas", "Courier New", monospace;
  font-size: 12.5px;
  color: #c9b896;
  max-height: 420px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.7;
}
.result-body .json-key { color: #E8BC3A; }
.result-body .json-str { color: #9BEBA3; }
.result-body .json-num { color: #FFD700; }
.result-body .json-bool { color: #FF9580; }
.result-body .json-null { color: #9E9E9E; }
.result-placeholder { color: #6a5840; font-style: italic; }

/* ---- 标签页 ---- */
.tabs { display: flex; border-bottom: 2px solid var(--border); margin-bottom: 18px; gap: 0; }
.tab {
  padding: 10px 18px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text2);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: all .2s;
  display: flex; align-items: center; gap: 6px;
}
.tab:hover { color: var(--primary-dark); }
.tab.active {
  color: var(--primary-dark);
  border-bottom-color: var(--primary);
  font-weight: 600;
  background: linear-gradient(180deg, rgba(200,160,90,.05) 0%, transparent 100%);
}
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ---- 信息提示 ---- */
.alert {
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.alert-info { background: #fef6e8; border-left: 3px solid var(--primary); color: var(--primary-dark); }
.alert-success { background: #E8F5E9; border-left: 3px solid #2E7D32; color: #1B5E20; }
.alert-warn { background: #FFF8E1; border-left: 3px solid #F57F17; color: #7F4F0F; }
.alert-error { background: #FFEBEE; border-left: 3px solid #C62828; color: #7F0000; }

/* ---- 表格 ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: auto; }
.data-table th {
  background: linear-gradient(135deg, #faf6ed 0%, #f0e4d0 100%);
  color: var(--primary-dark);
  padding: 9px 12px; text-align: left; font-weight: 600;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 8px 12px; border-bottom: 1px solid #f3ece1;
  vertical-align: top; white-space: nowrap;
}
.data-table tr:hover td { background: rgba(200,160,90,.04); }
.data-table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }

/* ---- 历史记录 ---- */
.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item {
  background: #fffcf5;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: all .2s;
}
.history-item:hover { border-color: var(--primary); background: #faf6ed; }
.history-item .h-method {
  font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px;
  background: linear-gradient(135deg, #E0CA8E, #C9A55B); color: #5a4832; flex-shrink: 0;
}
.history-item .h-url { font-size: 12px; color: var(--text2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-item .h-time { font-size: 11px; color: var(--text3); flex-shrink: 0; }
.history-item .h-status { font-size: 11px; font-weight: 600; flex-shrink: 0; }
.h-status.ok { color: var(--success); }
.h-status.fail { color: var(--error); }

/* ---- 字段说明面板 ---- */
.field-hint { margin-top: 4px; font-size: 11px; color: var(--text2); line-height: 1.5; }

/* ---- 响应式 ---- */
@media (max-width: 900px) {
  .sidebar { width: 200px; }
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  /* 小屏默认可由用户通过顶栏按钮展开/收起；收起态见 html.sidebar-collapsed */
  html:not(.sidebar-collapsed) #portal-sidebar {
    display: block;
    position: sticky;
    top: 0;
    max-height: calc(100vh - 56px);
    overflow-y: auto;
    z-index: 20;
  }
  .content { padding: 14px; max-width: 100vw; }
}

/* ---- 滚动条（金色协调） ---- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d4c4a8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #c4b090; }

/* ---- 动画 ---- */
.fade-in { animation: fadeIn .3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---- 签名生成演示 ---- */
.sign-steps { counter-reset: step; }
.sign-step {
  display: flex; gap: 12px; margin-bottom: 10px; align-items: flex-start;
}
.sign-step::before {
  counter-increment: step;
  content: counter(step);
  background: linear-gradient(135deg, #E0CA8E 0%, #C9A55B 100%);
  color: #5a4832;
  min-width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; flex-shrink: 0; margin-top: 2px;
}
.sign-step .step-txt { font-size: 13px; color: var(--text); line-height: 1.6; }
.sign-step code {
  background: #fdf6eb; color: var(--primary-dark);
  padding: 1px 5px; border-radius: 3px; font-size: 12px;
  font-family: Consolas, monospace;
}

/* ---- 接口列表 ---- */
.api-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.api-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px 16px; background: #fffcf5;
  cursor: pointer; transition: all .2s;
  display: flex; flex-direction: column; gap: 6px;
}
.api-card:hover { border-color: var(--primary); background: #faf6ed; box-shadow: 0 2px 8px rgba(200,160,90,.10); }
.api-card .ac-name { font-size: 14px; font-weight: 600; color: var(--text); }
.api-card .ac-url { font-size: 11px; color: var(--text2); font-family: Consolas, monospace; }
.api-card .ac-desc { font-size: 12px; color: var(--text2); }
.api-card .ac-tag {
  display: inline-block; font-size: 10px; font-weight: 600;
  padding: 2px 7px; border-radius: 10px; margin-top: 2px;
}
.ac-tag.post { background: #f5edd8; color: var(--primary-dark); }
