:root {
  color-scheme: light;
  --bg: #f5f7fb;
  --panel: #ffffff;
  --panel-soft: #f9fbff;
  --text: #172033;
  --muted: #65758b;
  --line: #dfe6f0;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --accent: #2563eb;
  --danger: #dc2626;
  --warning: #b45309;
  --success: #15803d;
  --shadow: 0 18px 45px rgba(31, 41, 55, 0.09);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100%;
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled, input:disabled { cursor: not-allowed; opacity: 0.62; }

.app-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px;
  background: #101827;
  color: #e5edf7;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
}
.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #14b8a6;
  color: #082f2a;
}
.brand strong, .brand small { display: block; }
.brand small { margin-top: 2px; color: #93a4ba; }
.sidebar-nav { display: grid; gap: 16px; }
.nav-group { display: grid; gap: 8px; }
.nav-group-title {
  padding: 0 12px;
  color: #72839a;
  font-size: 12px;
  font-weight: 900;
}
.sidebar-nav a {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  color: #aebdd0;
}
.sidebar-nav a small {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: #7f8fa5;
}
.sidebar-nav a.is-active, .sidebar-nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}
.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #9fb0c6;
}
.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 5px rgba(34, 197, 94, 0.16);
}
.workspace { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  min-height: 76px;
  padding: 16px 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 247, 251, 0.92);
  backdrop-filter: blur(16px);
}
.topbar-title span, .eyebrow {
  display: block;
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}
.topbar-title strong { display: block; margin-top: 3px; font-size: 18px; }
.topbar-actions, .page-actions, .form-row, .progress-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}
.user-chip strong, .user-chip small { display: block; }
.user-chip small { color: var(--muted); font-size: 12px; }
.page-frame {
  max-width: 1220px;
  margin: 0 auto;
  padding: 34px;
}
.page-stack { display: grid; gap: 24px; }
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
}
.page-header h1 {
  margin: 8px 0 10px;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: 0;
}
.page-header p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}
.primary-button, .ghost-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
}
.primary-button {
  background: var(--brand);
  color: #ffffff;
}
.primary-button:hover { background: var(--brand-dark); }
.ghost-button {
  background: #ffffff;
  border-color: var(--line);
  color: #26364d;
}
.ghost-button:hover { border-color: #b9c6d8; }
.metric-grid, .card-grid, .settings-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.result-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
}
.roi-input-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.wide-field {
  min-width: min(520px, 100%);
}
.risk-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.8;
}
.metric-card, .feature-card, .template-card, .settings-card, .work-card, .info-panel, .agent-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.metric-card { padding: 18px; }
.metric-card small, .metric-card p { color: var(--muted); }
.metric-card strong { display: block; margin: 10px 0 6px; font-size: 24px; }
.metric-card p { margin: 0; line-height: 1.55; }
.feature-card, .template-card, .settings-card {
  position: relative;
  min-height: 230px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.feature-card h2, .template-card h2, .settings-card h2, .agent-card h2, .notice-card h2, .prompt-panel h2, .info-panel h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
}
.feature-card p, .template-card p, .settings-card p, .agent-card p, .notice-card p, .prompt-panel p, .info-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}
.feature-card strong { margin-top: auto; color: var(--brand); }
.feature-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #e8f7f5;
  color: var(--brand);
}
.pill {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eef6ff;
  color: #1d4ed8;
  font-size: 12px;
  font-weight: 800;
}
.info-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px;
}
.form-stack { display: grid; gap: 20px; padding: 24px; }
.mode-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 0;
  margin: 0;
  border: 0;
}
.mode-grid legend {
  grid-column: 1 / -1;
  margin-bottom: 4px;
  font-weight: 900;
}
.mode-grid label, .file-card, .field, .check-field {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}
.mode-grid label {
  grid-template-columns: 20px 1fr;
  align-items: center;
  font-weight: 800;
}
.is-locked { background: #f3f4f6; color: #738096; }
.template-strip, .notice-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}
.template-strip nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.template-strip a {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  font-weight: 800;
}
.notice-card { align-items: flex-start; display: grid; }
.notice-card.is-warning { border-color: #f59e0b; background: #fffbeb; }
.upload-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.file-card span {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}
.file-card em {
  font-style: normal;
  font-size: 12px;
  color: var(--brand);
  font-weight: 900;
}
.file-card small { color: var(--muted); line-height: 1.55; }
.file-card input[type="file"], .field input, .field select, .chat-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px 10px;
}
.field span { font-weight: 900; }
.check-field {
  grid-template-columns: 18px 1fr;
  align-items: center;
}
.status-box {
  padding: 13px 14px;
  border: 1px solid #c7d7fe;
  border-radius: 8px;
  background: #eff6ff;
  color: #1e3a8a;
  line-height: 1.55;
}
.progress-panel {
  display: grid;
  gap: 10px;
  padding: 18px;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  background: #eff6ff;
}
.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #dbeafe;
}
.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 200ms ease;
}
.chat-layout {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  padding: 22px;
}
.prompt-panel {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
  border-radius: 8px;
  background: var(--panel-soft);
}
.prompt-list, .suggestion-list {
  display: grid;
  gap: 8px;
}
.prompt-list button, .suggestion-list button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  text-align: left;
  padding: 8px 10px;
}
.chat-panel { display: grid; gap: 14px; min-width: 0; }
.chat-messages {
  height: 480px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}
.chat-message {
  max-width: 78%;
  padding: 13px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
}
.chat-user {
  justify-self: end;
  background: #ecfdf5;
  border-color: #bbf7d0;
}
.chat-message p { margin: 6px 0 0; color: var(--muted); line-height: 1.65; }
.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
.agent-list { display: grid; gap: 14px; }
.agent-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  padding: 20px;
}
.settings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.settings-card { min-height: 220px; }
.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1000;
  display: grid;
  gap: 10px;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #ffffff;
  box-shadow: var(--shadow);
}
.toast-success { border-color: #bbf7d0; color: var(--success); }
.toast-error { border-color: #fecaca; color: var(--danger); }
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top left, #dff7f4, transparent 34%), var(--bg);
}
.login-card {
  width: min(460px, 100%);
  display: grid;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}
.login-brand {
  display: flex;
  gap: 14px;
  align-items: center;
}
.login-brand h1 { margin: 0 0 6px; font-size: 26px; }
.login-brand p { margin: 0; color: var(--muted); }
.split-grid {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.table-card {
  overflow: auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}
.data-table th,
.data-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.data-table th {
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
}
.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.danger-button { color: var(--danger); }
.empty-state {
  padding: 24px;
  color: var(--muted);
}
.role-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.permission-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.permission-check {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcff;
}
.permission-check strong,
.permission-check small {
  display: block;
}
.permission-check small {
  margin-top: 3px;
  color: var(--muted);
}

@media (max-width: 1080px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .sidebar-nav { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .metric-grid, .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mode-grid, .upload-grid, .roi-input-grid, .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .page-frame, .topbar, .sidebar { padding: 18px; }
  .topbar, .page-header, .info-panel, .template-strip { align-items: stretch; flex-direction: column; }
  .sidebar-nav, .metric-grid, .card-grid, .settings-grid, .mode-grid, .upload-grid, .chat-layout, .split-grid, .permission-grid, .roi-input-grid, .result-grid {
    grid-template-columns: 1fr;
  }
  .page-header h1 { font-size: 28px; }
  .chat-form, .agent-card { grid-template-columns: 1fr; }
  .chat-message { max-width: 100%; }
}

/* Liquid Glass UI Refresh */
:root {
  color-scheme: dark;
  --bg: hsl(0 0% 4%);
  --panel: hsl(0 0% 100% / 0.055);
  --panel-soft: hsl(0 0% 100% / 0.035);
  --text: hsl(0 0% 96%);
  --muted: hsl(0 0% 72%);
  --line: hsl(0 0% 100% / 0.12);
  --brand: hsl(0 0% 100%);
  --brand-dark: hsl(0 0% 82%);
  --accent: hsl(0 0% 92%);
  --danger: hsl(0 68% 72%);
  --warning: hsl(36 80% 72%);
  --success: hsl(145 45% 72%);
  --shadow: 0 24px 90px hsl(0 0% 0% / 0.42);
  --radius: 22px;
  --radius-sm: 16px;
  --glass-bg: hsl(0 0% 100% / 0.045);
  --glass-bg-strong: hsl(0 0% 100% / 0.075);
  --glass-highlight: hsl(0 0% 100% / 0.42);
}

html,
body {
  background:
    linear-gradient(145deg, hsl(0 0% 2%) 0%, hsl(0 0% 9%) 42%, hsl(0 0% 4%) 100%),
    repeating-linear-gradient(90deg, hsl(0 0% 100% / 0.018) 0 1px, transparent 1px 120px);
  color: var(--text);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    linear-gradient(180deg, hsl(0 0% 100% / 0.08), transparent 28%),
    linear-gradient(115deg, transparent 0 18%, hsl(0 0% 100% / 0.045) 42%, transparent 68%),
    linear-gradient(0deg, hsl(0 0% 0% / 0.65), hsl(0 0% 0% / 0.18));
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(hsl(0 0% 100% / 0.028) 1px, transparent 1px),
    linear-gradient(90deg, hsl(0 0% 100% / 0.02) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, hsl(0 0% 0% / 0.65), transparent 82%);
}

.liquid-glass,
.sidebar-nav a,
.ghost-button,
.user-chip,
.mode-grid label,
.file-card,
.field,
.check-field,
.template-strip a,
.prompt-list button,
.suggestion-list button,
.permission-check,
.toast {
  position: relative;
  overflow: hidden;
  border: 0;
  background: var(--glass-bg);
  background-blend-mode: luminosity;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow:
    inset 0 1px 1px hsl(0 0% 100% / 0.13),
    0 18px 50px hsl(0 0% 0% / 0.18);
}

.liquid-glass-strong,
.sidebar,
.topbar,
.page-header,
.metric-card,
.feature-card,
.template-card,
.settings-card,
.work-card,
.info-panel,
.agent-card,
.notice-card,
.progress-panel,
.table-card,
.login-card,
.prompt-panel,
.chat-messages,
.status-box,
.result-grid {
  position: relative;
  overflow: hidden;
  border: 0;
  background: var(--glass-bg-strong);
  background-blend-mode: luminosity;
  backdrop-filter: blur(34px);
  -webkit-backdrop-filter: blur(34px);
  box-shadow:
    0 26px 90px hsl(0 0% 0% / 0.34),
    inset 0 1px 1px hsl(0 0% 100% / 0.18);
}

.liquid-glass::before,
.liquid-glass-strong::before,
.sidebar::before,
.topbar::before,
.page-header::before,
.metric-card::before,
.feature-card::before,
.template-card::before,
.settings-card::before,
.work-card::before,
.info-panel::before,
.agent-card::before,
.notice-card::before,
.progress-panel::before,
.table-card::before,
.login-card::before,
.prompt-panel::before,
.chat-messages::before,
.status-box::before,
.result-grid::before,
.sidebar-nav a::before,
.ghost-button::before,
.primary-button::before,
.user-chip::before,
.mode-grid label::before,
.file-card::before,
.field::before,
.check-field::before,
.permission-check::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(
    180deg,
    hsl(0 0% 100% / 0.48),
    hsl(0 0% 100% / 0.13) 24%,
    transparent 45%,
    transparent 62%,
    hsl(0 0% 100% / 0.12) 82%,
    hsl(0 0% 100% / 0.28)
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.app-shell {
  grid-template-columns: 306px minmax(0, 1fr);
  gap: 18px;
  min-height: 100vh;
  padding: 18px;
}

.sidebar {
  top: 18px;
  height: calc(100vh - 36px);
  border-radius: 28px;
  background-color: hsl(0 0% 100% / 0.055);
}

.workspace {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 18px;
}

.topbar {
  top: 18px;
  min-height: 76px;
  border-radius: 26px;
  background-color: hsl(0 0% 100% / 0.05);
}

.page-frame {
  width: 100%;
  max-width: 1320px;
  padding: 18px 8px 44px;
}

.page-stack {
  gap: 22px;
}

.page-header {
  padding: 26px;
  border-radius: 28px;
}

.page-header h1,
.login-brand h1,
.feature-card h2,
.template-card h2,
.settings-card h2,
.agent-card h2,
.notice-card h2,
.prompt-panel h2,
.info-panel h2,
.work-card h2 {
  color: hsl(0 0% 100%);
  font-weight: 500;
  letter-spacing: 0;
}

.page-header h1 {
  font-size: clamp(30px, 4vw, 56px);
}

.page-header p,
.feature-card p,
.template-card p,
.settings-card p,
.agent-card p,
.notice-card p,
.prompt-panel p,
.info-panel p,
.metric-card p,
.chat-message p,
.file-card small,
.permission-check small {
  color: hsl(0 0% 100% / 0.62);
}

.eyebrow,
.topbar-title span {
  color: hsl(0 0% 100% / 0.55);
  letter-spacing: 0.08em;
}

.brand {
  color: hsl(0 0% 100%);
}

.brand small,
.sidebar-nav a small,
.user-chip small {
  color: hsl(0 0% 100% / 0.48);
}

.brand-mark,
.feature-icon,
.metric-card > .material-symbols-outlined {
  border-radius: 999px;
  background: hsl(0 0% 100% / 0.1);
  color: hsl(0 0% 100%);
  box-shadow: inset 0 1px 1px hsl(0 0% 100% / 0.22);
}

.material-symbols-outlined {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
}

.sidebar-nav a {
  border-radius: 18px;
  color: hsl(0 0% 100% / 0.68);
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.sidebar-nav a.is-active,
.sidebar-nav a:hover {
  background: hsl(0 0% 100% / 0.11);
  color: hsl(0 0% 100%);
  transform: translateY(-1px);
}

.nav-group-title {
  color: hsl(0 0% 100% / 0.38);
}

.sidebar-foot {
  border: 0;
  border-radius: 18px;
  background: hsl(0 0% 100% / 0.055);
  color: hsl(0 0% 100% / 0.58);
}

.status-dot {
  background: hsl(0 0% 100% / 0.8);
  box-shadow: 0 0 0 5px hsl(0 0% 100% / 0.08);
}

.metric-grid,
.card-grid,
.settings-grid,
.result-grid {
  gap: 18px;
}

.metric-card,
.feature-card,
.template-card,
.settings-card,
.work-card,
.info-panel,
.agent-card,
.notice-card,
.table-card,
.prompt-panel,
.chat-messages,
.progress-panel,
.status-box {
  border-radius: var(--radius);
}

.feature-card,
.template-card,
.settings-card {
  min-height: 238px;
}

.feature-card,
.template-card,
.agent-card,
.primary-button,
.ghost-button,
.prompt-list button,
.suggestion-list button {
  transition: transform 180ms ease, background 180ms ease, color 180ms ease, filter 180ms ease;
}

.feature-card:hover,
.template-card:hover,
.agent-card:hover {
  transform: scale(1.018);
  background-color: hsl(0 0% 100% / 0.085);
}

.feature-card:active,
.template-card:active,
.agent-card:active,
.primary-button:active,
.ghost-button:active {
  transform: scale(0.985);
}

.primary-button,
.ghost-button {
  min-height: 44px;
  border-radius: 999px;
  color: hsl(0 0% 100%);
  border: 0;
}

.primary-button {
  position: relative;
  overflow: hidden;
  background: hsl(0 0% 100% / 0.14);
  box-shadow:
    inset 0 1px 1px hsl(0 0% 100% / 0.22),
    0 16px 42px hsl(0 0% 0% / 0.28);
}

.primary-button:hover,
.ghost-button:hover {
  background: hsl(0 0% 100% / 0.18);
  color: hsl(0 0% 100%);
  transform: scale(1.035);
}

.ghost-button,
.danger-button {
  background: hsl(0 0% 100% / 0.07);
  color: hsl(0 0% 100% / 0.76);
}

.danger-button {
  color: hsl(0 0% 100%);
}

.pill {
  border-radius: 999px;
  background: hsl(0 0% 100% / 0.1);
  color: hsl(0 0% 100% / 0.8);
}

.mode-grid label,
.file-card,
.field,
.check-field,
.permission-check {
  border-radius: var(--radius-sm);
  background-color: hsl(0 0% 100% / 0.045);
  color: hsl(0 0% 100% / 0.86);
}

.file-card input[type="file"],
.field input,
.field select,
.chat-form input,
.prompt-list button,
.suggestion-list button {
  border: 0;
  background: hsl(0 0% 100% / 0.075);
  color: hsl(0 0% 100%);
  border-radius: 16px;
  box-shadow: inset 0 1px 1px hsl(0 0% 100% / 0.12);
}

input::placeholder {
  color: hsl(0 0% 100% / 0.4);
}

.field input:focus,
.field select:focus,
.chat-form input:focus,
.file-card input[type="file"]:focus {
  outline: 2px solid hsl(0 0% 100% / 0.22);
  outline-offset: 2px;
}

.field select,
.glass-select {
  appearance: none;
  color-scheme: dark;
  background:
    linear-gradient(145deg, hsl(0 0% 100% / 0.16), hsl(0 0% 100% / 0.06)),
    hsl(180 12% 10% / 0.92);
  color: hsl(0 0% 100% / 0.92);
}

.field select option,
.glass-select option {
  background-color: hsl(180 12% 10%);
  color: hsl(0 0% 100% / 0.88);
}

.field select option:checked,
.glass-select option:checked {
  background-color: hsl(0 0% 100% / 0.18);
  color: hsl(0 0% 100%);
}

.danger-role-warning {
  color: hsl(0 0% 100% / 0.94);
  border: 1px solid hsl(0 0% 100% / 0.18);
  background:
    linear-gradient(145deg, hsl(0 0% 100% / 0.16), hsl(0 0% 100% / 0.055)),
    hsl(0 60% 18% / 0.30);
}

.role-card .role-head p {
  margin: 4px 0 0;
  color: hsl(0 0% 100% / 0.68);
}

.template-strip,
.notice-card {
  border: 0;
  border-radius: var(--radius);
  background: hsl(0 0% 100% / 0.055);
}

.template-strip a {
  color: hsl(0 0% 100% / 0.78);
}

.status-box {
  border: 0;
  background: hsl(0 0% 100% / 0.075);
  color: hsl(0 0% 100% / 0.78);
}

.progress-track {
  background: hsl(0 0% 100% / 0.08);
}

.progress-track i {
  background: hsl(0 0% 100% / 0.78);
}

.login-page {
  background:
    linear-gradient(145deg, hsl(0 0% 1%) 0%, hsl(0 0% 10%) 50%, hsl(0 0% 3%) 100%);
}

.login-card {
  width: min(500px, 100%);
  border-radius: 32px;
  padding: 34px;
}

.login-brand p {
  color: hsl(0 0% 100% / 0.62);
}

.chat-messages,
.table-card {
  background-color: hsl(0 0% 0% / 0.28);
}

.chat-message {
  border: 0;
  background: hsl(0 0% 100% / 0.07);
  color: hsl(0 0% 100%);
}

.chat-user {
  background: hsl(0 0% 100% / 0.13);
}

.data-table {
  color: hsl(0 0% 100% / 0.82);
}

.data-table th,
.data-table td {
  border-bottom: 1px solid hsl(0 0% 100% / 0.08);
}

.data-table th {
  background: hsl(0 0% 100% / 0.075);
  color: hsl(0 0% 100% / 0.65);
  font-weight: 600;
}

.data-table tr:hover td {
  background: hsl(0 0% 100% / 0.045);
}

.empty-state {
  color: hsl(0 0% 100% / 0.58);
}

.permission-grid {
  gap: 12px;
}

.role-head {
  color: hsl(0 0% 100%);
}

.toast {
  border-radius: 18px;
  color: hsl(0 0% 100%);
}

.toast-success,
.toast-error {
  border: 0;
}

.toast-success {
  color: hsl(0 0% 100%);
}

.toast-error {
  color: hsl(0 0% 100%);
}

.risk-list {
  color: hsl(0 0% 100% / 0.66);
}

@media (max-width: 1080px) {
  .app-shell {
    display: block;
    padding: 12px;
  }

  .sidebar {
    position: relative;
    top: auto;
    height: auto;
    margin-bottom: 14px;
  }

  .workspace {
    gap: 14px;
  }

  .topbar {
    position: relative;
    top: auto;
  }
}

.share-button {
  gap: 8px;
}

.security-page .table-card {
  overflow: hidden;
}

.security-risk-grid {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.risk-card {
  border-color: rgba(255,255,255,0.16);
}

.risk-high {
  border-color: rgba(255,95,95,0.45);
}

.risk-medium {
  border-color: rgba(255,200,100,0.38);
}

.security-page .data-table {
  min-width: 980px;
}

@media (max-width: 820px) {
  .roi-trend-panel .trend-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

/* Interaction layer contract */
.modal-backdrop {
  z-index: 2000 !important;
}

.modal-backdrop > * {
  position: relative;
  z-index: 2100;
}

.custom-select {
  position: relative;
  width: 100%;
  min-width: 0;
}

.custom-select-menu.custom-select-portal {
  position: absolute !important;
  z-index: 2600 !important;
  overflow: auto;
  padding: 7px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 16px;
  color: rgba(255,255,255,0.88);
  background:
    linear-gradient(145deg, rgba(255,255,255,0.14), rgba(255,255,255,0.045)),
    rgba(18,22,24,0.88);
  box-shadow:
    0 24px 90px rgba(0,0,0,0.48),
    inset 0 1px 1px rgba(255,255,255,0.18);
  backdrop-filter: blur(30px) saturate(135%);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.25) transparent;
}

.custom-select-menu.custom-select-portal[hidden] {
  display: none !important;
}

.custom-select-menu.custom-select-portal button {
  min-height: 42px;
  border-radius: 12px;
  color: rgba(255,255,255,0.84);
  background: transparent;
}

.custom-select-menu.custom-select-portal button:hover,
.custom-select-menu.custom-select-portal button:focus-visible {
  background: rgba(255,255,255,0.12);
  color: #fff;
  outline: none;
}

.custom-select-menu.custom-select-portal button.is-selected {
  background: rgba(255,255,255,0.18);
  color: #fff;
}

.custom-select-menu.custom-select-portal small {
  color: rgba(255,255,255,0.66);
}

.toast-host {
  z-index: 3000;
}

.modal-card,
.confirm-dialog,
.prompt-dialog {
  width: min(560px, calc(100vw - 28px));
  max-height: min(86vh, 760px);
  overflow: auto;
  padding: 22px;
  border: 1px solid rgba(255,255,255,0.16);
  border-radius: 22px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.14), rgba(255,255,255,0.045)),
    rgba(14,18,20,0.92);
  box-shadow: 0 34px 120px rgba(0,0,0,0.54), inset 0 1px 1px rgba(255,255,255,0.18);
  backdrop-filter: blur(30px) saturate(130%);
}

.dialog-actions,
.modal-actions {
  position: sticky;
  bottom: -22px;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin: 16px -22px -22px;
  padding: 14px 22px 18px;
  background: linear-gradient(180deg, transparent, rgba(10,14,16,0.94) 22%);
}

@media (max-width: 760px) {
  .modal-card,
  .confirm-dialog,
  .prompt-dialog {
    width: calc(100vw - 18px);
    max-height: 90vh;
    padding: 18px;
    border-radius: 18px;
  }
}

@media (max-width: 820px) {
  .roi-trend-panel .trend-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }
}

@media (max-width: 760px) {
  .login-card,
  .page-header,
  .work-card,
  .metric-card,
  .feature-card,
  .template-card,
  .settings-card,
  .info-panel,
  .agent-card,
  .table-card {
    border-radius: 20px;
  }

  .topbar-actions,
  .page-actions,
  .form-row {
    align-items: stretch;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }
}

/* Product-grade liquid glass system */
body {
  font-family: "Poppins", "Manrope", "Noto Sans SC", "Microsoft YaHei", system-ui, sans-serif;
}

.liquid-background {
  position: fixed;
  inset: 0;
  z-index: -5;
  pointer-events: none;
  overflow: hidden;
  background:
    radial-gradient(circle at 18% 8%, hsl(0 0% 100% / 0.11), transparent 32%),
    radial-gradient(circle at 78% 12%, hsl(0 0% 100% / 0.055), transparent 38%),
    linear-gradient(145deg, hsl(0 0% 1%) 0%, hsl(0 0% 9%) 48%, hsl(0 0% 3%) 100%);
}

.liquid-background canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  filter: blur(0.2px);
  opacity: 0.95;
}

#app {
  position: relative;
  z-index: 1;
}

.login-page {
  background: transparent;
}

.login-card,
.sidebar,
.topbar,
.page-header,
.metric-card,
.feature-card,
.template-card,
.settings-card,
.work-card,
.info-panel,
.agent-card,
.notice-card,
.table-card,
.status-box,
.prompt-panel,
.chat-messages,
.progress-panel {
  isolation: isolate;
}

.sidebar::after,
.topbar::after,
.page-header::after,
.work-card::after,
.login-card::after,
.table-card::after,
.metric-card::after,
.feature-card::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background:
    linear-gradient(135deg, hsl(0 0% 100% / 0.10), transparent 34%),
    linear-gradient(315deg, hsl(0 0% 100% / 0.055), transparent 42%);
  pointer-events: none;
  z-index: -1;
}

.section-heading h2,
.trend-source h3 {
  margin: 0 0 6px;
  color: hsl(0 0% 100%);
  font-weight: 500;
}

.section-heading p,
.trend-source p {
  margin: 0;
  color: hsl(0 0% 100% / 0.58);
}

.data-table tr.is-selected td {
  background: hsl(0 0% 100% / 0.09);
}

.liquid-details {
  display: grid;
  gap: 14px;
  border-radius: 20px;
  padding: 16px;
  background: hsl(0 0% 100% / 0.045);
  box-shadow: inset 0 1px 1px hsl(0 0% 100% / 0.12);
}

.liquid-details summary {
  cursor: pointer;
  color: hsl(0 0% 100% / 0.86);
  font-weight: 700;
}

.roi-page .page-header {
  background:
    linear-gradient(135deg, hsl(0 0% 100% / 0.12), hsl(0 0% 100% / 0.035)),
    hsl(0 0% 0% / 0.22);
}

.roi-workbench {
  display: grid;
  grid-template-columns: minmax(360px, 0.82fr) minmax(0, 1.18fr);
  gap: 20px;
  align-items: start;
}

.roi-control-panel,
.roi-side-panel {
  min-width: 0;
}

.roi-control-panel h2 {
  margin: 0;
}

.trend-source {
  display: grid;
  gap: 14px;
  padding: 16px;
  border-radius: 20px;
  background: hsl(0 0% 100% / 0.04);
}

.roi-overview {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.roi-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.roi-result-card {
  padding: 20px;
}

.roi-result-card h2 {
  margin: 0 0 14px;
}

.roi-result-card dl,
.trend-detail dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px 14px;
  margin: 0;
}

.roi-result-card dt,
.trend-detail dt {
  color: hsl(0 0% 100% / 0.52);
}

.roi-result-card dd,
.trend-detail dd {
  margin: 0;
  color: hsl(0 0% 100% / 0.9);
  font-weight: 700;
  text-align: right;
}

.roi-trend-panel {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.roi-trend-panel h2,
.roi-trend-panel p {
  margin: 0;
}

.roi-trend-panel p {
  color: hsl(0 0% 100% / 0.58);
}

.trend-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  align-items: stretch;
}

.chart-shell {
  position: relative;
  min-height: 360px;
  border-radius: 24px;
  overflow: hidden;
  background:
    linear-gradient(135deg, hsl(0 0% 100% / 0.065), hsl(0 0% 100% / 0.018)),
    hsl(0 0% 0% / 0.24);
  box-shadow: inset 0 1px 1px hsl(0 0% 100% / 0.14);
}

.roi-chart-canvas {
  display: block;
  width: 100%;
  min-height: 360px;
}

.roi-chart-tooltip {
  position: absolute;
  z-index: 4;
  display: grid;
  gap: 4px;
  width: 250px;
  padding: 12px;
  border-radius: 18px;
  color: hsl(0 0% 100% / 0.86);
  background: hsl(0 0% 4% / 0.72);
  backdrop-filter: blur(22px);
  -webkit-backdrop-filter: blur(22px);
  box-shadow:
    inset 0 1px 1px hsl(0 0% 100% / 0.18),
    0 20px 48px hsl(0 0% 0% / 0.42);
}

.roi-chart-tooltip strong {
  color: hsl(0 0% 100%);
}

.roi-chart-tooltip small {
  color: hsl(0 0% 100% / 0.58);
  line-height: 1.45;
}

.trend-detail {
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 18px;
  border-radius: 24px;
  background: hsl(0 0% 100% / 0.05);
  box-shadow: inset 0 1px 1px hsl(0 0% 100% / 0.14);
}

.trend-detail h2,
.trend-detail p {
  margin: 0;
}

.trend-detail p {
  color: hsl(0 0% 100% / 0.62);
  line-height: 1.6;
}

.trend-table {
  max-height: 420px;
}

.trend-table .data-table {
  min-width: 980px;
}

.table-scroll {
  width: 100%;
  overflow-x: auto;
}

.trend-table tbody tr {
  cursor: pointer;
}

.history-stack {
  display: grid;
  gap: 14px;
}

.table-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
}

.table-toolbar strong {
  color: rgba(255,255,255,0.88);
}

.records-modal {
  display: grid;
  gap: 18px;
}

.records-modal .data-table {
  min-width: 1040px;
}

.clipboard-fallback {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}

@media (max-width: 1180px) {
  .roi-workbench,
  .trend-grid {
    grid-template-columns: 1fr;
  }

  .roi-overview {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .liquid-background canvas {
    opacity: 0.68;
  }

  .roi-overview,
  .roi-result-grid {
    grid-template-columns: 1fr;
  }

  .chart-shell {
    min-height: 300px;
  }

  .roi-chart-canvas {
    min-height: 300px;
  }
}

/* Bloom-style video glass shell */
html,
body {
  overflow-x: hidden;
  background: #030303;
}

.liquid-background {
  z-index: 0;
  background:
    radial-gradient(circle at 18% 12%, rgba(255,255,255,0.12), transparent 34%),
    radial-gradient(circle at 80% 20%, rgba(255,255,255,0.08), transparent 36%),
    #030303;
}

.liquid-video,
.liquid-fallback-canvas,
.liquid-video-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.liquid-video {
  z-index: 0;
  object-fit: cover;
  filter: grayscale(1) saturate(0.42) contrast(1.08) brightness(0.58);
  opacity: 0;
  transform: scale(1.02);
  transition: opacity 900ms ease;
}

.liquid-background.has-video .liquid-video {
  opacity: 1;
}

.liquid-fallback-canvas {
  z-index: 1;
  opacity: 1;
  mix-blend-mode: screen;
}

.liquid-background.has-video:not(.video-failed) .liquid-fallback-canvas {
  opacity: 0.42;
}

.liquid-video-overlay {
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(0,0,0,0.28), rgba(0,0,0,0.58)),
    radial-gradient(circle at 48% 6%, rgba(255,255,255,0.18), transparent 42%),
    linear-gradient(90deg, rgba(0,0,0,0.56), rgba(0,0,0,0.16) 46%, rgba(0,0,0,0.48));
  backdrop-filter: grayscale(1) saturate(0.4);
}

#app {
  z-index: 10;
  min-height: 100vh;
}

.liquid-glass {
  background: rgba(255,255,255,0.01);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.liquid-glass-strong {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(50px);
  -webkit-backdrop-filter: blur(50px);
}

.app-shell {
  --sidebar-width: 280px;
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 18px;
  width: 100%;
  min-height: 100vh;
  padding: 18px;
  transition: grid-template-columns 260ms ease;
}

.app-shell.is-sidebar-collapsed {
  --sidebar-width: 76px;
}

.sidebar {
  width: 100%;
  min-width: 0;
  padding: 16px;
  gap: 16px;
  transition: width 260ms ease, padding 260ms ease, transform 260ms ease;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.09), rgba(255,255,255,0.025)),
    rgba(10,10,10,0.42);
  backdrop-filter: blur(54px);
  -webkit-backdrop-filter: blur(54px);
}

.sidebar-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
}

.sidebar-toggle {
  position: relative;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: rgba(255,255,255,0.86);
  background: rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.18);
  backdrop-filter: blur(16px);
}

.sidebar-toggle:hover,
.mobile-menu-button:hover {
  transform: scale(1.05);
}

.sidebar-toggle-text {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.sidebar-label {
  min-width: 0;
  opacity: 1;
  transform: translateX(0);
  transition: opacity 180ms ease, transform 220ms ease, width 220ms ease;
}

.app-shell.is-sidebar-collapsed .sidebar {
  padding: 14px 10px;
}

.app-shell.is-sidebar-collapsed .sidebar-head {
  grid-template-columns: 1fr;
}

.app-shell.is-sidebar-collapsed .brand {
  justify-content: center;
}

.app-shell.is-sidebar-collapsed .sidebar-label,
.app-shell.is-sidebar-collapsed .nav-group-title,
.app-shell.is-sidebar-collapsed .sidebar-foot .sidebar-label {
  width: 0;
  opacity: 0;
  pointer-events: none;
  transform: translateX(-8px);
  white-space: nowrap;
}

.app-shell.is-sidebar-collapsed .sidebar-nav a {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 13px 0;
}

.app-shell.is-sidebar-collapsed .sidebar-nav a .material-symbols-outlined {
  margin: 0;
}

.app-shell.is-sidebar-collapsed .nav-group {
  gap: 8px;
}

.app-shell.is-sidebar-collapsed .sidebar-foot {
  justify-content: center;
  padding: 12px 0;
}

.workspace {
  min-width: 0;
}

.page-frame {
  width: 100%;
  max-width: none;
  padding: 18px 0 44px;
}

.topbar,
.page-header,
.metric-card,
.feature-card,
.template-card,
.settings-card,
.work-card,
.info-panel,
.agent-card,
.notice-card,
.table-card,
.status-box,
.login-card,
.prompt-panel,
.chat-messages,
.progress-panel,
.trend-detail,
.chart-shell,
.liquid-details,
.trend-source {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.105), rgba(255,255,255,0.026)),
    rgba(8,8,8,0.42);
  backdrop-filter: blur(50px);
  -webkit-backdrop-filter: blur(50px);
}

.topbar,
.page-header {
  box-shadow:
    0 28px 90px rgba(0,0,0,0.30),
    inset 0 1px 1px rgba(255,255,255,0.20);
}

.mobile-menu-button {
  display: none;
}

.sidebar-mask {
  display: none;
}

@media (max-width: 1080px) {
  .app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
    padding: 12px;
  }

  .sidebar {
    position: sticky;
    top: 12px;
    height: calc(100vh - 24px);
    margin-bottom: 0;
  }
}

@media (max-width: 760px) {
  .app-shell,
  .app-shell.is-sidebar-collapsed {
    --sidebar-width: 0px;
    display: block;
    padding: 12px;
  }

  .sidebar {
    position: fixed;
    z-index: 40;
    top: 12px;
    left: 12px;
    width: min(310px, calc(100vw - 24px));
    height: calc(100vh - 24px);
    transform: translateX(calc(-100% - 18px));
  }

  .app-shell.is-mobile-sidebar-open .sidebar {
    transform: translateX(0);
  }

  .app-shell.is-sidebar-collapsed .sidebar-label,
  .app-shell.is-sidebar-collapsed .nav-group-title,
  .app-shell.is-sidebar-collapsed .sidebar-foot .sidebar-label {
    width: auto;
    opacity: 1;
    pointer-events: auto;
    transform: none;
  }

  .app-shell.is-sidebar-collapsed .sidebar-nav a {
    grid-template-columns: 28px 1fr;
    justify-items: start;
    padding: 12px;
  }

  .sidebar-mask {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 35;
    border: 0;
    background: rgba(0,0,0,0.48);
    opacity: 0;
    pointer-events: none;
    transition: opacity 220ms ease;
  }

  .app-shell.is-mobile-sidebar-open .sidebar-mask {
    opacity: 1;
    pointer-events: auto;
  }

  .mobile-menu-button {
    display: inline-flex;
  }

  .topbar {
    position: sticky;
    top: 12px;
  }

  .page-frame {
    padding-top: 14px;
  }
}

.scenario-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.scenario-buttons button {
  min-height: 48px;
  border: 0;
  border-radius: 18px;
  color: rgba(255,255,255,0.66);
  background: rgba(255,255,255,0.055);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.12);
  transition: transform 180ms ease, background 180ms ease, color 180ms ease;
}

.scenario-buttons button:hover {
  transform: scale(1.025);
  color: rgba(255,255,255,0.92);
  background: rgba(255,255,255,0.10);
}

.scenario-buttons button.is-active {
  color: #fff;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.18), rgba(255,255,255,0.055)),
    rgba(255,255,255,0.08);
}

.cost-formula-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.cost-breakdown-card,
.formula-card {
  padding: 20px;
}

.cost-breakdown-card h2,
.formula-card h2 {
  margin: 0 0 14px;
}

.cost-breakdown-card dl {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px 14px;
  margin: 0;
}

.cost-breakdown-card dt {
  color: rgba(255,255,255,0.52);
}

.cost-breakdown-card dd {
  margin: 0;
  color: rgba(255,255,255,0.9);
  font-weight: 700;
}

.formula-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
  color: rgba(255,255,255,0.64);
  line-height: 1.55;
}

@media (max-width: 1320px) {
  .cost-formula-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .scenario-buttons {
    grid-template-columns: 1fr;
  }
}

.login-warning {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 18px;
  color: rgba(255,255,255,0.82);
  background:
    linear-gradient(145deg, rgba(255,255,255,0.10), rgba(255,255,255,0.025)),
    rgba(0,0,0,0.22);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.18);
}

.login-warning strong {
  color: #fff;
  font-size: 15px;
}

.login-warning span {
  color: rgba(255,255,255,0.58);
  font-size: 13px;
  line-height: 1.5;
}

.login-status:empty {
  display: none;
}

.catalog-filter-grid {
  display: grid;
  grid-template-columns: minmax(240px, 1.6fr) repeat(4, minmax(130px, 1fr));
  gap: 14px;
  align-items: end;
}

.product-table-card {
  overflow: hidden;
}

.product-table-wrap {
  display: grid;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.product-table {
  min-width: 1040px;
}

.product-table tbody tr {
  cursor: pointer;
}

.product-table tbody tr:hover {
  background: rgba(255,255,255,0.055);
}

.product-image {
  width: 42px;
  height: 42px;
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.13);
  color: rgba(255,255,255,0.52);
  background:
    linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.035)),
    rgba(0,0,0,0.28);
  object-fit: cover;
}

.product-image.large {
  width: 82px;
  height: 82px;
  border-radius: 22px;
  font-size: 28px;
}

.product-image.placeholder {
  font-size: 18px;
  line-height: 1;
}

.pagination-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  min-width: 1040px;
}

.pagination-bar span {
  margin-right: auto;
  color: rgba(255,255,255,0.58);
}

.modal-backdrop {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0,0,0,0.62);
  backdrop-filter: blur(18px);
}

.product-modal {
  position: relative;
  width: min(960px, calc(100vw - 34px));
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 24px;
  border: 1px solid rgba(255,255,255,0.14);
  border-radius: 28px;
  box-shadow:
    0 34px 120px rgba(0,0,0,0.54),
    inset 0 1px 1px rgba(255,255,255,0.20);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  color: rgba(255,255,255,0.86);
  background: rgba(255,255,255,0.08);
  cursor: pointer;
}

.product-detail-head {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  padding-right: 48px;
}

.product-detail-head h2 {
  margin: 8px 0 6px;
  color: #fff;
  font-size: 24px;
}

.product-detail-head p {
  margin: 0;
  color: rgba(255,255,255,0.56);
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0;
}

.detail-grid div {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.11);
  border-radius: 18px;
  background: rgba(255,255,255,0.045);
}

.detail-grid small {
  display: block;
  margin-bottom: 7px;
  color: rgba(255,255,255,0.48);
}

.detail-grid strong {
  color: rgba(255,255,255,0.88);
  word-break: break-word;
}

.raw-panel {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,0.11);
  border-radius: 20px;
  background: rgba(0,0,0,0.22);
}

.raw-panel h3 {
  margin: 0;
}

.raw-panel pre {
  max-height: 220px;
  overflow: auto;
  margin: 0;
  white-space: pre-wrap;
  color: rgba(255,255,255,0.70);
}

@media (max-width: 1180px) {
  .catalog-filter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .catalog-filter-grid,
  .detail-grid,
  .product-detail-head {
    grid-template-columns: 1fr;
  }

  .product-detail-head {
    padding-right: 42px;
  }
}

/* Sidebar usability fix: independent scrolling and real collapsed layout */
.app-shell {
  --sidebar-width: 280px;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  align-items: start;
  overflow-x: clip;
}

.app-shell.is-sidebar-collapsed {
  --sidebar-width: 76px;
}

.sidebar {
  position: sticky;
  top: 18px;
  height: calc(100vh - 36px);
  max-height: calc(100vh - 36px);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: visible;
}

.sidebar::before {
  pointer-events: none;
}

.sidebar-head,
.sidebar-foot {
  flex: 0 0 auto;
}

.sidebar-nav {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr;
  align-content: start;
  gap: 16px;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  padding: 2px 4px 22px 0;
  margin-right: -4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.25) transparent;
}

.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255,255,255,0.24);
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255,255,255,0.36);
}

.nav-group {
  min-width: 0;
  align-content: start;
}

.sidebar-nav a {
  position: relative;
  min-height: 56px;
  width: 100%;
  overflow: visible;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border-radius: 16px;
  pointer-events: auto;
}

.sidebar-nav a .material-symbols-outlined {
  width: 28px;
  min-width: 28px;
  display: grid;
  place-items: center;
}

.sidebar-label {
  min-width: 0;
}

.sidebar-label strong,
.sidebar-label small {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-label strong {
  white-space: nowrap;
}

.sidebar-label small {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.35;
}

.sidebar-foot {
  margin-top: 0;
  min-height: 48px;
}

.workspace {
  width: 100%;
  min-width: 0;
}

.page-frame {
  max-width: none;
  overflow-x: clip;
}

.table-card,
.product-table-wrap,
.table-scroll {
  max-width: 100%;
}

.app-shell.is-sidebar-collapsed .sidebar {
  padding: 14px 10px;
}

.app-shell.is-sidebar-collapsed .sidebar-nav {
  padding-right: 0;
  margin-right: 0;
}

.app-shell.is-sidebar-collapsed .sidebar-nav a {
  min-height: 56px;
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 13px 0;
}

.app-shell.is-sidebar-collapsed .sidebar-nav a::after {
  content: attr(aria-label);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  z-index: 90;
  transform: translateY(-50%);
  width: max-content;
  max-width: 220px;
  padding: 8px 10px;
  border-radius: 10px;
  color: rgba(255,255,255,0.92);
  background: rgba(10,10,10,0.84);
  box-shadow: 0 18px 44px rgba(0,0,0,0.36), inset 0 1px 1px rgba(255,255,255,0.18);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 140ms ease, transform 140ms ease;
}

.app-shell.is-sidebar-collapsed .sidebar-nav a:hover::after,
.app-shell.is-sidebar-collapsed .sidebar-nav a:focus-visible::after {
  opacity: 1;
  transform: translateY(-50%) translateX(2px);
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  }

  .sidebar {
    position: sticky;
    top: 12px;
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
  }

  .sidebar-nav {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell,
  .app-shell.is-sidebar-collapsed {
    --sidebar-width: 0px;
    display: block;
    overflow-x: hidden;
  }

  .sidebar {
    position: fixed;
    top: 12px;
    left: 12px;
    width: min(310px, calc(100vw - 24px));
    height: calc(100vh - 24px);
    max-height: calc(100vh - 24px);
    overflow: visible;
  }

  .app-shell.is-sidebar-collapsed .sidebar-nav a::after {
    display: none;
  }

  .sidebar-nav {
    grid-template-columns: 1fr;
    overflow-y: auto;
    padding-bottom: 28px;
  }

  .sidebar-foot {
    min-height: 48px;
  }
}

/* Product login split screen */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: stretch;
  padding: clamp(18px, 3vw, 42px);
  background: transparent;
  overflow-x: hidden;
}

.login-split {
  width: min(1440px, 100%);
  min-height: calc(100vh - clamp(36px, 6vw, 84px));
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(380px, 0.92fr);
  gap: clamp(18px, 3vw, 34px);
  align-items: stretch;
}

.login-hero,
.login-form-panel {
  min-width: 0;
}

.login-hero {
  display: grid;
  align-content: space-between;
  gap: 26px;
  padding: clamp(26px, 4.8vw, 58px);
  border-radius: 38px;
  overflow: hidden;
}

.login-hero-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.login-hero-brand strong,
.login-hero-brand small {
  display: block;
}

.login-hero-brand strong {
  color: rgba(255,255,255,0.94);
  font-weight: 500;
}

.login-hero-brand small {
  margin-top: 4px;
  color: rgba(255,255,255,0.56);
}

.login-hero-copy {
  max-width: 780px;
}

.login-hero-copy h1 {
  max-width: 760px;
  margin: 14px 0 18px;
  color: #fff;
  font-family: "Source Serif 4", "Poppins", "Noto Serif SC", serif;
  font-size: clamp(42px, 6.4vw, 88px);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: 0;
}

.login-hero-copy p {
  max-width: 620px;
  margin: 0;
  color: rgba(255,255,255,0.68);
  font-size: 17px;
  line-height: 1.8;
}

.login-feature-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.login-feature-pills span {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0 16px;
  border-radius: 999px;
  color: rgba(255,255,255,0.82);
  background: rgba(255,255,255,0.08);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.18);
  backdrop-filter: blur(18px);
}

.login-security-note {
  margin: 0;
  color: rgba(255,255,255,0.56);
}

.login-form-panel {
  display: grid;
  place-items: center;
}

.login-card {
  width: min(480px, 100%);
  display: grid;
  gap: 18px;
  padding: clamp(24px, 4vw, 38px);
  border-radius: 34px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.034)),
    rgba(8,8,8,0.38);
  backdrop-filter: blur(46px);
  -webkit-backdrop-filter: blur(46px);
  box-shadow:
    0 34px 120px rgba(0,0,0,0.42),
    inset 0 1px 1px rgba(255,255,255,0.20);
}

.login-brand h1 {
  margin: 0 0 6px;
  color: #fff;
  font-size: 28px;
  font-weight: 500;
}

.login-brand p {
  color: rgba(255,255,255,0.58);
}

.login-warning {
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
}

.login-warning .material-symbols-outlined {
  grid-row: span 2;
  color: rgba(255,255,255,0.86);
}

@media (max-width: 980px) {
  .login-split {
    grid-template-columns: 1fr;
  }

  .login-hero {
    min-height: 420px;
  }
}

@media (max-width: 640px) {
  .login-page {
    padding: 12px;
  }

  .login-split {
    min-height: auto;
  }

  .login-hero,
  .login-card {
    border-radius: 24px;
  }

  .login-hero {
    min-height: 360px;
    padding: 24px;
  }

  .login-hero-copy h1 {
    font-size: 42px;
  }

  .login-form-panel {
    display: block;
  }
}

/* Product catalog and ROI workbench completion */
.roi-top-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.8fr);
  gap: 18px;
  align-items: stretch;
}

.roi-top-grid .roi-trend-panel {
  min-height: 520px;
}

.roi-kpi-rail .metric-grid {
  grid-template-columns: 1fr;
}

.roi-product-context {
  font-weight: 700;
}

.catalog-toolbar,
.catalog-list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.segmented-control {
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,0.07);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.14);
}

.segmented-control button {
  min-height: 38px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  color: rgba(255,255,255,0.68);
  background: transparent;
}

.segmented-control button.is-active,
.segmented-control button:hover {
  color: rgba(255,255,255,0.96);
  background: rgba(255,255,255,0.16);
}

.product-catalog-results {
  display: grid;
  gap: 16px;
}

.product-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.product-card {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  min-height: 420px;
  padding: 14px;
  overflow: hidden;
}

.product-select {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  color: rgba(255,255,255,0.85);
  background: rgba(0,0,0,0.42);
  backdrop-filter: blur(14px);
}

.product-image-button {
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
}

.product-image {
  display: grid;
  place-items: center;
  width: 100%;
  overflow: hidden;
  border-radius: 18px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.14), rgba(255,255,255,0.035)),
    rgba(255,255,255,0.06);
  color: rgba(255,255,255,0.62);
  object-fit: cover;
}

img.product-image {
  object-fit: cover;
}

.product-image.small {
  width: 58px;
  height: 58px;
  border-radius: 12px;
}

.product-image.card {
  aspect-ratio: 4 / 3;
  min-height: 178px;
}

.product-image.large {
  width: min(280px, 42vw);
  aspect-ratio: 4 / 3;
  min-height: 210px;
}

.product-image.placeholder .material-symbols-outlined {
  font-size: 38px;
  opacity: 0.78;
}

.product-card-body {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.product-card-body h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.35;
}

.product-card-body p {
  margin: 0;
  color: rgba(255,255,255,0.62);
}

.product-price-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.product-price-list dt {
  color: rgba(255,255,255,0.52);
  font-size: 12px;
}

.product-price-list dd {
  margin: 3px 0 0;
  color: rgba(255,255,255,0.92);
  font-weight: 700;
}

.product-card-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.product-table-wrap {
  overflow-x: auto;
  border-radius: 18px;
}

.product-table th,
.product-table td {
  min-width: 112px;
  vertical-align: middle;
}

.product-table th:first-child,
.product-table td:first-child {
  min-width: 46px;
}

.product-table .table-actions {
  min-width: 220px;
}

.product-edit-modal,
.product-modal {
  width: min(1120px, calc(100vw - 32px));
  max-height: calc(100vh - 42px);
  overflow-y: auto;
}

.confirm-modal {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 42px);
  overflow-y: auto;
  padding: 24px;
}

.product-form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.product-form-grid .field textarea,
.product-form-grid .field input {
  width: 100%;
}

.product-form-grid .field:has(textarea) {
  grid-column: span 2;
}

.catalog-filter-grid {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

@media (max-width: 1180px) {
  .roi-top-grid {
    grid-template-columns: 1fr;
  }

  .roi-kpi-rail .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .catalog-filter-grid,
  .product-form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .roi-kpi-rail .metric-grid,
  .catalog-filter-grid,
  .product-form-grid,
  .product-price-list,
  .product-card-actions {
    grid-template-columns: 1fr;
  }

  .product-card-grid {
    grid-template-columns: 1fr;
  }

  .product-form-grid .field:has(textarea) {
    grid-column: span 1;
  }

  .product-image.large {
    width: 100%;
  }
}

/* Final usability pass: brighter Bloom-like glass, image reliability, ROI proportions */
:root {
  --panel: hsl(0 0% 100% / 0.082);
  --panel-soft: hsl(0 0% 100% / 0.058);
  --glass-bg: hsl(0 0% 100% / 0.075);
  --glass-bg-strong: hsl(0 0% 100% / 0.118);
  --line: hsl(0 0% 100% / 0.18);
  --muted: hsl(0 0% 82%);
}

.liquid-video-overlay {
  background:
    linear-gradient(180deg, rgba(0,0,0,0.10), rgba(0,0,0,0.34)),
    radial-gradient(circle at 18% 14%, rgba(168,255,231,0.18), transparent 32%),
    radial-gradient(circle at 82% 18%, rgba(210,235,255,0.14), transparent 30%),
    linear-gradient(90deg, rgba(0,0,0,0.26), rgba(0,0,0,0.08) 48%, rgba(0,0,0,0.26));
}

.sidebar,
.topbar,
.page-header,
.work-card,
.table-card,
.metric-card,
.feature-card,
.settings-card,
.product-card,
.login-card,
.status-box,
.trend-detail {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.14), rgba(255,255,255,0.045)),
    rgba(12,18,20,0.34);
  border-color: rgba(255,255,255,0.18);
  box-shadow:
    inset 0 1px 1px rgba(255,255,255,0.24),
    0 22px 80px rgba(0,0,0,0.24);
}

.primary-button,
.ghost-button {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.20), rgba(255,255,255,0.065)),
    rgba(255,255,255,0.055);
  border-color: rgba(255,255,255,0.20);
  color: rgba(255,255,255,0.92);
}

.primary-button:hover,
.ghost-button:hover {
  background:
    linear-gradient(145deg, rgba(255,255,255,0.28), rgba(255,255,255,0.10)),
    rgba(255,255,255,0.09);
}

.product-image {
  background:
    radial-gradient(circle at 50% 28%, rgba(180,255,233,0.18), transparent 42%),
    linear-gradient(145deg, rgba(255,255,255,0.16), rgba(255,255,255,0.045)),
    rgba(255,255,255,0.075);
}

img.product-image {
  object-fit: contain;
  background-color: rgba(255,255,255,0.075);
}

.product-image.card {
  height: 190px;
  min-height: 190px;
  max-height: 190px;
}

.product-image.large {
  height: 280px;
  min-height: 280px;
  max-height: 280px;
}

.product-image.placeholder {
  gap: 8px;
  color: rgba(255,255,255,0.72);
  text-align: center;
}

.product-image.placeholder small {
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.roi-page .page-header {
  min-height: auto;
  padding-block: 18px;
}

.roi-page .page-header h1 {
  font-size: clamp(30px, 3vw, 46px);
}

.roi-trend-panel {
  min-height: 0;
  padding: 18px;
}

.roi-trend-panel .role-head {
  margin-bottom: 0;
}

.trend-grid {
  grid-template-columns: minmax(0, 7fr) minmax(260px, 3fr);
  gap: 16px;
}

.chart-shell {
  min-height: 340px;
}

.roi-chart-canvas {
  min-height: 340px;
}

.trend-detail {
  max-height: 340px;
  overflow-y: auto;
}

.roi-overview {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.roi-overview .metric-card {
  min-height: 126px;
  padding: 16px;
}

.roi-overview .metric-card strong {
  font-size: clamp(22px, 2vw, 32px);
}

.roi-workbench {
  grid-template-columns: minmax(260px, 0.28fr) minmax(0, 0.44fr) minmax(260px, 0.28fr);
  gap: 16px;
  align-items: start;
}

.roi-control-panel,
.roi-record-panel {
  position: sticky;
  top: 92px;
}

.roi-control-panel,
.roi-side-panel,
.roi-record-panel {
  min-width: 0;
}

.cost-formula-grid {
  grid-template-columns: 1fr;
}

.formula-card,
.cost-breakdown-card,
.roi-record-panel .table-card,
.roi-record-panel .permission-card {
  max-height: 420px;
  overflow-y: auto;
}

.formula-card .formula-list {
  font-size: 13px;
  line-height: 1.55;
}

.roi-result-grid {
  grid-template-columns: 1fr;
}

.trend-table {
  max-height: 460px;
  overflow: auto;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(24,34,36,0.86);
  backdrop-filter: blur(18px);
}

@media (max-width: 1280px) {
  .roi-workbench {
    grid-template-columns: minmax(260px, 0.36fr) minmax(0, 0.64fr);
  }

  .roi-record-panel {
    grid-column: 1 / -1;
    position: static;
  }
}

@media (max-width: 980px) {
  .trend-grid,
  .roi-workbench,
  .roi-overview {
    grid-template-columns: 1fr;
  }

  .roi-control-panel {
    position: static;
  }

  .trend-detail {
    max-height: none;
  }
}

/* Product-grade layout pass: unified controls, ROI workbench proportions, compact cards */
* {
  box-sizing: border-box;
}

html,
body,
button,
input,
textarea {
  font-family: Inter, "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
}

body {
  overflow-x: hidden;
  font-size: 14px;
  line-height: 1.5;
}

.page-frame {
  max-width: 100%;
  overflow-x: hidden;
}

.page-stack {
  gap: 16px;
}

.page-header {
  min-height: auto;
  padding: 20px;
}

.page-header h1 {
  font-size: clamp(28px, 2.4vw, 36px);
  line-height: 1.1;
  letter-spacing: 0;
}

.page-header p,
.work-card p,
.metric-card p,
.status-box,
.field span {
  overflow-wrap: anywhere;
}

.work-card,
.table-card,
.metric-card,
.product-card,
.status-box {
  border-radius: 16px;
  min-width: 0;
}

.work-card {
  padding: 18px;
}

.work-card h2,
.table-card h2,
.section-heading h2 {
  font-size: clamp(18px, 1.3vw, 22px);
  line-height: 1.2;
}

.primary-button,
.ghost-button,
.segmented-control button {
  min-height: 40px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
  line-height: 1;
}

.table-actions .ghost-button,
.table-actions .primary-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.field {
  min-width: 0;
  gap: 8px;
  padding: 10px;
}

.field > span {
  font-size: 12px;
  line-height: 1.25;
  min-height: 16px;
}

.field input,
.field textarea,
.chat-form input,
.file-card input[type="file"] {
  width: 100%;
  min-height: 42px;
  font-size: 15px;
  border-radius: 14px;
}

.field textarea {
  min-height: 84px;
  resize: vertical;
}

.custom-select {
  position: relative;
  width: 100%;
  min-width: 0;
  z-index: 2;
}

.custom-select[data-open="true"] {
  z-index: 1000;
}

.custom-select-button {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 14px;
  padding: 0 12px;
  color: rgba(255,255,255,0.92);
  background:
    linear-gradient(145deg, rgba(255,255,255,0.16), rgba(255,255,255,0.055)),
    rgba(255,255,255,0.06);
  box-shadow: inset 0 1px 1px rgba(255,255,255,0.16);
  backdrop-filter: blur(30px);
  cursor: pointer;
}

.custom-select-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.custom-select-value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.custom-select-icon {
  color: rgba(255,255,255,0.72);
  flex: 0 0 auto;
}

.custom-select-menu {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 10000;
  overflow: auto;
  padding: 6px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.12), rgba(255,255,255,0.04)),
    rgba(12,18,20,0.94);
  box-shadow: 0 22px 70px rgba(0,0,0,0.36), inset 0 1px 1px rgba(255,255,255,0.16);
  backdrop-filter: blur(30px);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.25) transparent;
}

.custom-select.opens-up .custom-select-menu {
  top: auto;
  bottom: calc(100% + 8px);
}

.custom-select-menu button {
  width: 100%;
  min-height: 38px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  border: 0;
  border-radius: 12px;
  padding: 8px 10px;
  color: rgba(255,255,255,0.84);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.custom-select-menu button:hover {
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.98);
}

.custom-select-menu button.is-selected {
  background: rgba(255,255,255,0.15);
  color: #fff;
}

.custom-select-menu small {
  color: rgba(255,255,255,0.58);
  font-size: 12px;
}

.roi-page {
  --roi-gap: 16px;
}

.roi-page .page-header {
  padding-block: 16px;
}

.roi-page .page-header h1 {
  font-size: clamp(28px, 2.6vw, 36px);
}

.roi-trend-panel {
  min-height: 410px;
  padding: 18px;
}

.roi-trend-panel .role-head {
  margin-bottom: 12px;
}

.trend-grid {
  display: grid;
  grid-template-columns: minmax(0, 69fr) minmax(320px, 31fr);
  gap: var(--roi-gap);
  align-items: stretch;
}

.chart-shell,
.trend-detail {
  min-height: 348px;
}

.roi-chart-canvas {
  width: 100%;
  min-height: 348px;
}

.trend-detail {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: none;
  overflow: visible;
  padding: 14px;
}

.trend-detail-hero {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.trend-detail-hero > div,
.trend-detail-grid dt,
.trend-detail-grid dd,
.cost-metric-grid dt,
.cost-metric-grid dd {
  border-radius: 12px;
  background: rgba(255,255,255,0.065);
}

.trend-detail-hero > div {
  padding: 10px;
}

.trend-detail-hero small,
.trend-detail-grid dt,
.cost-metric-grid dt {
  color: rgba(255,255,255,0.62);
  font-size: 12px;
}

.trend-detail-hero strong {
  display: block;
  margin-top: 4px;
  color: #fff;
  font-size: 18px;
}

.trend-detail-grid,
.cost-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.trend-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.trend-detail-grid dt,
.trend-detail-grid dd,
.cost-metric-grid dt,
.cost-metric-grid dd {
  margin: 0;
  padding: 8px 10px;
}

.trend-detail-grid dd,
.cost-metric-grid dd {
  color: #fff;
  font-weight: 700;
  text-align: right;
}

.trend-suggestion {
  margin: 0;
  color: rgba(255,255,255,0.72);
  font-size: 13px;
}

.trend-detail-actions {
  margin-top: auto;
  justify-content: flex-end;
}

.roi-overview {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.roi-overview .metric-card {
  min-height: 112px;
  padding: 14px;
}

.roi-workbench {
  display: grid;
  grid-template-columns: minmax(190px, 25fr) minmax(330px, 39fr) minmax(280px, 36fr);
  gap: var(--roi-gap);
  align-items: stretch;
}

.roi-scenario-panel,
.roi-base-panel,
.roi-advanced-panel {
  min-width: 0;
  position: static;
}

.scenario-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.scenario-buttons button {
  min-height: 42px;
  padding: 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.roi-base-panel .roi-input-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.roi-advanced-panel .roi-input-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.trend-source {
  padding: 12px;
}

.trend-source .roi-input-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.roi-advanced-panel .form-row {
  align-items: stretch;
}

.roi-advanced-panel .form-row > * {
  flex: 1 1 150px;
}

.roi-results-layout {
  display: grid;
  grid-template-columns: minmax(0, 65fr) minmax(280px, 35fr);
  gap: var(--roi-gap);
  align-items: start;
}

.roi-result-grid {
  grid-template-columns: 1fr;
}

.roi-result-card {
  min-height: 260px;
}

.roi-result-card dl {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.roi-result-card dt,
.roi-result-card dd {
  min-width: 0;
}

.roi-support-panel {
  min-width: 0;
}

.cost-formula-grid {
  grid-template-columns: 1fr;
  gap: 12px;
}

.formula-card,
.cost-breakdown-card,
.roi-support-panel .table-card,
.roi-support-panel .permission-card {
  max-height: none;
  overflow: visible;
}

.formula-details .formula-list {
  max-height: 160px;
  overflow: auto;
  margin-top: 10px;
}

.history-stack .empty-state {
  min-height: 72px;
  padding: 16px;
}

.permission-card {
  padding: 14px;
}

.permission-card p {
  margin: 4px 0;
}

.trend-table,
.table-scroll,
.product-table-wrap {
  max-width: 100%;
  overflow: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.25) transparent;
}

.trend-table {
  max-height: 460px;
}

.data-table {
  min-width: 760px;
  table-layout: auto;
}

.data-table th,
.data-table td {
  height: 44px;
  vertical-align: middle;
  overflow-wrap: anywhere;
}

.data-table td:nth-child(n+4) {
  text-align: right;
}

.product-card-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.product-card {
  min-height: 420px;
  display: flex;
  flex-direction: column;
}

.product-image.card {
  height: 184px;
  min-height: 184px;
  max-height: 184px;
}

.product-card-body {
  flex: 1;
  min-height: 0;
}

.product-card-body h2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 44px;
}

.product-card-body p {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.product-price-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.product-card-actions {
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  margin-top: auto;
}

.product-card-actions .primary-button,
.product-card-actions .ghost-button {
  width: 100%;
}

.product-modal,
.product-edit-modal,
.records-modal {
  max-height: min(86vh, 820px);
  overflow: auto;
  display: flex;
  flex-direction: column;
}

.product-edit-modal .form-row,
.product-modal > .form-row {
  position: sticky;
  bottom: -1px;
  z-index: 2;
  padding-top: 12px;
  background: linear-gradient(180deg, transparent, rgba(12,18,20,0.92) 22%);
}

.split-grid {
  grid-template-columns: minmax(300px, 0.36fr) minmax(0, 0.64fr);
  gap: 16px;
}

@media (max-width: 900px) {
  .roi-workbench {
    grid-template-columns: minmax(260px, 0.42fr) minmax(0, 0.58fr);
  }

  .roi-advanced-panel {
    grid-column: 1 / -1;
  }

  .roi-base-panel .roi-input-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .roi-results-layout {
    grid-template-columns: 1fr;
  }
}

.roi-trend-panel .trend-grid {
  grid-template-columns: minmax(0, 70fr) minmax(250px, 30fr);
}

@media (max-width: 820px) {
  .roi-trend-panel .trend-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .trend-grid,
  .roi-workbench,
  .roi-results-layout,
  .roi-overview,
  .split-grid,
  .catalog-filter-grid {
    grid-template-columns: 1fr;
  }

  .trend-detail-hero,
  .roi-result-card dl,
  .cost-metric-grid,
  .trend-detail-grid,
  .roi-base-panel .roi-input-grid,
  .roi-advanced-panel .roi-input-grid,
  .trend-source .roi-input-grid {
    grid-template-columns: 1fr;
  }

  .roi-trend-panel {
    min-height: auto;
  }

  .chart-shell,
  .trend-detail,
  .roi-chart-canvas {
    min-height: 300px;
  }
}

@media (max-width: 760px) {
  .primary-button,
  .ghost-button,
  .custom-select-button,
  .field input,
  .field textarea {
    min-height: 40px;
  }

  .product-modal,
  .product-edit-modal,
  .records-modal {
    width: min(100vw - 20px, 760px);
    max-height: 88vh;
  }
}

/* ROI workbench structure: conclusion first, trend second, 26/46/28 workspace. */
.roi-page {
  gap: 14px;
}

.roi-page .page-header {
  min-height: auto;
  padding: 16px 18px;
}

.roi-page .page-header p {
  max-width: 760px;
}

.roi-account-pill {
  align-self: center;
  white-space: nowrap;
}

.roi-hero-panel {
  display: grid;
  grid-template-columns: minmax(300px, 0.38fr) minmax(0, 0.62fr);
  gap: 14px;
  align-items: stretch;
  padding: 18px;
}

.roi-hero-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 10px;
}

.roi-hero-copy h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(28px, 3.2vw, 44px);
  line-height: 1.08;
}

.roi-hero-copy p {
  margin: 0;
  color: rgba(255,255,255,0.72);
  line-height: 1.65;
}

.roi-hero-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.roi-hero-metrics .metric-card {
  min-height: 118px;
  padding: 14px;
}

.roi-hero-metrics .metric-card strong {
  font-size: clamp(20px, 2vw, 30px);
}

.roi-trend-panel {
  min-height: 430px;
  padding: 18px;
}

.roi-trend-panel .trend-grid {
  grid-template-columns: minmax(0, 70fr) minmax(280px, 30fr);
  align-items: stretch;
}

.roi-chart-canvas,
.chart-shell {
  min-height: 360px;
}

.trend-detail {
  min-height: 360px;
  overflow: visible;
}

.trend-detail-hero {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.trend-detail-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.roi-workbench {
  display: grid;
  grid-template-columns: minmax(260px, 26fr) minmax(420px, 46fr) minmax(290px, 28fr);
  gap: 16px;
  align-items: start;
}

.roi-control-panel,
.roi-results-main,
.roi-support-panel {
  min-width: 0;
}

.roi-control-panel {
  padding: 16px;
}

.section-heading.compact {
  margin-bottom: 10px;
}

.section-heading.compact h2 {
  font-size: 18px;
}

.section-heading.compact p {
  margin: 4px 0 0;
  font-size: 13px;
}

.scenario-buttons {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.scenario-buttons button {
  min-height: 52px;
  white-space: normal;
  line-height: 1.25;
}

.roi-base-panel .roi-input-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.roi-control-panel .roi-base-panel .roi-input-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.roi-control-panel .field > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.roi-advanced-panel .roi-input-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.roi-advanced-panel .field:first-child {
  grid-column: span 2;
}

.trend-source {
  margin-top: 12px;
}

.trend-source .roi-input-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.roi-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.roi-action-row > * {
  width: 100%;
}

.roi-result-grid {
  display: grid;
  grid-template-columns: 1fr;
}

.roi-result-card {
  min-height: 260px;
}

.roi-result-card dl {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.roi-price-table-section .trend-table {
  max-height: 460px;
}

.roi-price-table-section .data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(18,22,24,0.94);
  backdrop-filter: blur(18px);
}

.roi-support-panel .cost-breakdown-card,
.roi-support-panel .formula-card,
.roi-support-panel .table-card,
.roi-support-panel .permission-card,
.roi-status-card {
  max-height: none;
  overflow: visible;
}

.roi-support-panel .history-stack .empty-state {
  min-height: 58px;
  padding: 12px;
}

.roi-support-panel .history-stack .table-scroll {
  max-height: 280px;
}

.formula-details .formula-list {
  max-height: 150px;
}

.cost-metric-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 980px) {
  .roi-hero-panel,
  .roi-workbench,
  .roi-trend-panel .trend-grid {
    grid-template-columns: 1fr;
  }

  .roi-hero-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .roi-control-panel .roi-base-panel .roi-input-grid,
  .roi-advanced-panel .roi-input-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .roi-hero-metrics,
  .scenario-buttons,
  .trend-detail-hero,
  .trend-detail-grid,
  .roi-result-card dl,
  .cost-metric-grid,
  .roi-control-panel .roi-base-panel .roi-input-grid,
  .roi-advanced-panel .roi-input-grid,
  .trend-source .roi-input-grid,
  .roi-action-row {
    grid-template-columns: 1fr;
  }

  .roi-hero-panel,
  .roi-trend-panel,
  .roi-control-panel {
    padding: 14px;
  }
}

/* Users page: fixed action column and portal action menu. */
html,
body,
.app-shell,
.workspace,
.page-frame {
  max-width: 100%;
  overflow-x: hidden;
}

.users-table-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: visible;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.25) transparent;
}

.split-grid > *,
.split-grid > .page-stack,
.users-table-wrap > * {
  min-width: 0;
}

.users-table {
  min-width: 860px;
  table-layout: fixed;
}

.users-table tr {
  height: 70px;
}

.users-table th,
.users-table td {
  height: 70px;
  padding: 8px 12px;
  vertical-align: middle;
  overflow: hidden;
}

.users-table th:nth-child(1),
.users-table td:nth-child(1) {
  width: 22%;
}

.users-table th:nth-child(2),
.users-table td:nth-child(2) {
  width: 22%;
}

.users-table th:nth-child(3),
.users-table td:nth-child(3) {
  width: 20%;
}

.users-table th:nth-child(4),
.users-table td:nth-child(4) {
  width: 96px;
}

.users-table th:nth-child(5),
.users-table td:nth-child(5) {
  width: 150px;
}

.users-table th:nth-child(6),
.users-table td:nth-child(6) {
  width: 112px;
  text-align: right;
}

.two-line-cell {
  display: -webkit-box;
  max-height: 40px;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.35;
}

.mono-cell {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: rgba(255,255,255,0.78);
  word-break: break-all;
}

.role-cell {
  display: grid;
  gap: 3px;
  min-width: 0;
  max-height: 42px;
  overflow: hidden;
}

.role-cell strong {
  color: rgba(255,255,255,0.94);
  font-size: 14px;
}

.role-cell small,
.short-date {
  color: rgba(255,255,255,0.58);
  font-size: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(255,255,255,0.09);
  color: rgba(255,255,255,0.78);
}

.status-pill.is-enabled {
  background: rgba(190,255,226,0.13);
  color: rgba(218,255,239,0.96);
}

.status-pill.is-disabled {
  background: rgba(255,130,130,0.13);
  color: rgba(255,220,220,0.96);
}

.user-action-cell {
  white-space: nowrap;
}

.user-action-trigger {
  min-height: 36px;
  width: 92px;
  padding: 0 12px;
  border-radius: 999px;
  justify-content: center;
}

.action-caret {
  transform: translateY(-1px);
  color: rgba(255,255,255,0.58);
}

.user-action-menu {
  position: absolute;
  z-index: 2600;
  display: grid;
  gap: 4px;
  padding: 7px;
  overflow-y: auto;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(255,255,255,0.13), rgba(255,255,255,0.045)),
    rgba(12,18,20,0.94);
  box-shadow: 0 24px 80px rgba(0,0,0,0.42), inset 0 1px 1px rgba(255,255,255,0.18);
  backdrop-filter: blur(30px);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.25) transparent;
}

.user-action-menu button {
  width: 100%;
  min-height: 36px;
  padding: 0 11px;
  border: 0;
  border-radius: 11px;
  color: rgba(255,255,255,0.86);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.user-action-menu button:hover:not(:disabled) {
  color: #fff;
  background: rgba(255,255,255,0.12);
}

.user-action-menu button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.user-action-menu button.is-danger {
  color: rgba(255,225,225,0.96);
}

.user-action-menu button.is-danger:hover:not(:disabled) {
  background: rgba(255,100,100,0.16);
}

.users-card-list {
  display: none;
}

.user-mobile-card {
  gap: 14px;
}

.user-mobile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.user-mobile-head h2 {
  margin: 0;
  font-size: 18px;
}

.user-mobile-head p {
  margin: 4px 0 0;
  color: rgba(255,255,255,0.62);
  word-break: break-all;
}

.user-mobile-meta {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 12px;
  margin: 0;
  color: rgba(255,255,255,0.68);
}

.user-mobile-meta dt,
.user-mobile-meta dd {
  margin: 0;
}

.user-mobile-meta dd {
  color: rgba(255,255,255,0.9);
  text-align: right;
}

@media (max-width: 760px) {
  .users-table {
    display: none;
  }

  .users-table-wrap {
    overflow: visible;
  }

  .users-card-list {
    display: grid;
    gap: 12px;
  }

  .user-action-trigger {
    width: 100%;
  }
}
