:root {
  color-scheme: light;
  --canvas: #f2f4f7;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --sidebar: #141a21;
  --sidebar-2: #1b232d;
  --ink: #17212b;
  --muted: #687482;
  --faint: #8d97a3;
  --line: #dfe4ea;
  --line-strong: #cbd2da;
  --blue: #2f6fed;
  --blue-soft: #eaf0ff;
  --green: #16875e;
  --green-soft: #e7f5ef;
  --amber: #a8670b;
  --amber-soft: #fff4df;
  --red: #ba3d37;
  --shadow: 0 8px 24px rgba(23, 33, 43, .07);
  --radius: 16px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--canvas); }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--canvas);
  color: var(--ink);
  font: 15px/1.5 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 268px minmax(0, 1fr); transition: grid-template-columns .2s ease; }
.sidebar {
  position: sticky;
  top: 0;
  z-index: 12;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 18px;
  color: #fff;
  background: var(--sidebar);
  transition: width .2s ease, transform .2s ease, padding .2s ease;
}
.sidebar-head { position: relative; }
.brand { min-width: 0; display: flex; align-items: center; gap: 11px; padding: 0 8px; text-decoration: none; color: #fff; }
.brand-mark {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.brand-copy { min-width: 0; display: grid; line-height: 1.2; white-space: nowrap; }
.brand-copy strong { font-size: 14px; letter-spacing: .02em; }
.brand-copy span { color: #8f9baa; font-size: 11px; }
.nav-label { margin: 34px 10px 9px; color: #6f7b89; font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.nav { display: grid; gap: 4px; }
.nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 0 12px;
  border-radius: 10px;
  color: #9da8b5;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
.nav a:hover { color: #fff; background: var(--sidebar-2); }
.nav a.active { color: #fff; background: #242e3a; }
.nav svg, .sidebar-settings svg { width: 18px; height: 18px; flex: 0 0 18px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.nav-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-status { width: 7px; height: 7px; flex: 0 0 7px; margin-left: auto; border-radius: 50%; background: #5e6976; box-shadow: 0 0 0 3px rgba(94,105,118,.12); }
.nav-status.online { background: #38ba83; box-shadow: 0 0 0 3px rgba(56,186,131,.12); }
.nav-status.offline { background: #d65e57; box-shadow: 0 0 0 3px rgba(214,94,87,.12); }

.sidebar-activity { min-height: 0; flex: 1 1 auto; display: flex; flex-direction: column; margin-top: 32px; overflow: hidden; }
.activity-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 0 8px 10px; }
.activity-kicker { display: block; margin-bottom: 2px; color: #667281; font-size: 9px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.activity-header h2 { margin: 0; color: #f4f7fa; font-size: 15px; letter-spacing: -.01em; }
.activity-refresh { width: 29px; height: 29px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: transparent; color: #778493; cursor: pointer; }
.activity-refresh:hover { background: #202a35; color: #fff; }
.activity-refresh:disabled { opacity: .6; cursor: wait; }
.activity-refresh svg, .activity-collapsed-button svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.activity-refresh.is-loading svg { animation: activity-spin .8s linear infinite; }
@keyframes activity-spin { to { transform: rotate(360deg); } }
.activity-summary { min-height: 30px; display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 4px 8px; padding: 0 8px; border-top: 1px solid #26303b; border-bottom: 1px solid #26303b; color: #7f8b99; font-size: 10px; }
.activity-badge { min-width: 18px; height: 18px; display: inline-grid; place-items: center; padding: 0 5px; border-radius: 999px; background: #d95850; color: #fff; font-size: 9px; font-weight: 800; }
.activity-list { min-height: 0; display: grid; align-content: start; gap: 2px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #34404d transparent; }
.activity-item { position: relative; display: grid; grid-template-columns: 8px minmax(0, 1fr); gap: 9px; padding: 10px 8px; border-radius: 9px; color: inherit; text-decoration: none; }
a.activity-item:hover { background: #1b242e; }
.activity-marker { width: 7px; height: 7px; margin-top: 5px; border-radius: 50%; background: #6f7b89; box-shadow: 0 0 0 3px rgba(111,123,137,.12); }
.severity-info .activity-marker { background: #4f83ea; box-shadow: 0 0 0 3px rgba(79,131,234,.13); }
.severity-warning .activity-marker { background: #d39739; box-shadow: 0 0 0 3px rgba(211,151,57,.13); }
.severity-critical .activity-marker { background: #dc615a; box-shadow: 0 0 0 3px rgba(220,97,90,.13); }
.activity-copy { min-width: 0; display: grid; gap: 2px; }
.activity-copy strong { overflow: hidden; color: #e6ebf0; font-size: 11px; font-weight: 700; line-height: 1.35; text-overflow: ellipsis; }
.activity-copy > span { display: -webkit-box; overflow: hidden; color: #8995a3; font-size: 10px; line-height: 1.42; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.activity-copy small { color: #606c79; font-size: 9px; }
.activity-item.is-unread .activity-copy strong { color: #fff; }
.activity-item.resolved { opacity: .55; }
.activity-item.resolved .activity-marker { background: #65717f; box-shadow: none; }
.activity-empty { padding: 18px 8px; color: #707c89; font-size: 10px; text-align: center; }
.activity-read-all { min-height: 31px; margin: 8px 4px 0; border: 1px solid #2c3743; border-radius: 8px; background: transparent; color: #8d99a6; cursor: pointer; font-size: 10px; font-weight: 650; }
.activity-read-all:hover { border-color: #3a4755; background: #1b242e; color: #fff; }
.activity-collapsed-button { position: relative; display: none; width: 42px; height: 42px; place-items: center; margin: 0 auto; padding: 0; border: 0; border-radius: 10px; background: transparent; color: #9da8b5; cursor: pointer; }
.activity-collapsed-button:hover { background: #202a35; color: #fff; }
.activity-collapsed-button .activity-badge { position: absolute; top: 3px; right: 1px; min-width: 15px; height: 15px; padding: 0 4px; font-size: 8px; }
.sidebar-balances { flex: 0 0 auto; display: grid; gap: 3px; margin: 10px 4px 12px; padding-top: 12px; border-top: 1px solid #29323d; }
.sidebar-balances-title { padding: 0 8px 5px; color: #667281; font-size: 9px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.sidebar-balance-row { min-width: 0; min-height: 43px; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 5px 8px; border-radius: 9px; color: #a4afbb; text-decoration: none; }
.sidebar-balance-row:hover { background: #1b242e; color: #fff; }
.sidebar-balance-mark { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; background: #252e39; color: #eef2f6; font-size: 8px; font-weight: 850; }
.sidebar-balance-mark.deepseek { background: #315b5c; }
.sidebar-balance-copy { min-width: 0; display: grid; line-height: 1.2; }
.sidebar-balance-copy strong { overflow: hidden; color: #dbe1e7; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-balance-copy small { color: #687583; font-size: 8px; }
.sidebar-balance-amount { color: #f4f7fa; font-size: 11px; font-weight: 750; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sidebar-balance-row.online .sidebar-balance-copy small { color: #4fac86; }
.sidebar-balance-row.warning .sidebar-balance-copy small, .sidebar-balance-row.warning .sidebar-balance-amount { color: #e0a545; }
.sidebar-balance-row.offline .sidebar-balance-copy small, .sidebar-balance-row.offline .sidebar-balance-amount { color: #d36b65; }
.sidebar-footer { margin-top: auto; padding-top: 13px; border-top: 1px solid #29323d; }
.sidebar-settings { min-height: 42px; display: flex; align-items: center; gap: 11px; padding: 0 12px; border-radius: 10px; color: #9da8b5; text-decoration: none; font-size: 14px; font-weight: 600; }
.sidebar-settings:hover, .sidebar-settings.active { color: #fff; background: #242e3a; }
.sidebar-toggle { position: absolute; top: 3px; right: -31px; z-index: 2; width: 27px; height: 27px; display: grid; place-items: center; padding: 0; border: 1px solid #303a46; border-radius: 8px; background: var(--sidebar); color: #9da8b5; cursor: pointer; box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.sidebar-toggle:hover { color: #fff; background: #202a35; }
.sidebar-toggle svg, .mobile-menu-button svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.9; }
.sidebar-toggle svg { transition: transform .2s ease; }
.sidebar-overlay { display: none; }
.app-shell.sidebar-collapsed { grid-template-columns: 72px minmax(0, 1fr); }
.app-shell.sidebar-collapsed .sidebar { padding-left: 10px; padding-right: 10px; }
.app-shell.sidebar-collapsed .brand { padding: 0 9px; }
.app-shell.sidebar-collapsed .brand-copy, .app-shell.sidebar-collapsed .nav-label, .app-shell.sidebar-collapsed .nav-text { display: none; }
.app-shell.sidebar-collapsed .nav a, .app-shell.sidebar-collapsed .sidebar-settings { justify-content: center; padding: 0; }
.app-shell.sidebar-collapsed .nav-status { position: absolute; right: 7px; top: 8px; width: 6px; height: 6px; }
.app-shell.sidebar-collapsed .sidebar-toggle svg { transform: rotate(180deg); }
.app-shell.sidebar-collapsed .sidebar-activity { margin-top: 28px; overflow: visible; }
.app-shell.sidebar-collapsed .activity-collapsed-button { display: grid; }
.app-shell.sidebar-collapsed .activity-header, .app-shell.sidebar-collapsed .activity-summary, .app-shell.sidebar-collapsed .activity-list, .app-shell.sidebar-collapsed .activity-read-all { display: none; }
.app-shell.sidebar-collapsed .sidebar-balances { margin: 8px 0 10px; gap: 4px; }
.app-shell.sidebar-collapsed .sidebar-balances-title, .app-shell.sidebar-collapsed .sidebar-balance-copy { display: none; }
.app-shell.sidebar-collapsed .sidebar-balance-row { min-height: 47px; grid-template-columns: 1fr; justify-items: center; gap: 1px; padding: 3px 0; }
.app-shell.sidebar-collapsed .sidebar-balance-mark { width: 24px; height: 24px; font-size: 7px; }
.app-shell.sidebar-collapsed .sidebar-balance-amount { max-width: 48px; overflow: hidden; font-size: 8px; text-overflow: ellipsis; }

.main { min-width: 0; }
.topbar {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 clamp(22px, 4vw, 52px);
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.78);
}
.topbar-start { display: flex; align-items: center; gap: 12px; }
.mobile-menu-button { display: none; width: 36px; height: 36px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink); cursor: pointer; }
.breadcrumb { display: flex; align-items: center; gap: 9px; color: var(--faint); font-size: 13px; }
.breadcrumb strong { color: var(--ink); font-weight: 650; }
.top-actions { display: flex; align-items: center; gap: 15px; }
.today { color: var(--muted); font-size: 13px; white-space: nowrap; }
.icon-button, .text-button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .16s, background .16s, transform .16s;
}
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px; }
.icon-button:hover, .text-button:hover { border-color: var(--line-strong); background: var(--surface-2); }
.icon-button:active, .text-button:active { transform: translateY(1px); }
.icon-button svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.text-button { min-height: 36px; padding: 0 13px; border-radius: 10px; font-size: 13px; font-weight: 650; }

.content { width: min(1180px, 100%); margin: 0 auto; padding: 32px clamp(22px, 3.2vw, 42px) 52px; }
.intro { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.intro h1 { margin: 0; font-size: clamp(27px, 3vw, 34px); line-height: 1.1; letter-spacing: -.035em; }
.intro p { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.system-health {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #edf0f3;
  color: #697583;
  font-size: 13px;
  font-weight: 700;
}
.system-health .pulse { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.system-health.online { border-color: #cde8dc; background: var(--green-soft); color: var(--green); }
.system-health.offline { border-color: #eed1cf; background: #fbebea; color: var(--red); }
.system-health.checking .pulse { animation: status-pulse 1.2s ease-in-out infinite; }
@keyframes status-pulse { 50% { opacity: .35; } }

.section { margin-top: 28px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 14px; }
.section-heading h2 { margin: 0; font-size: 18px; letter-spacing: -.02em; }
.section-heading p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.section-count { color: var(--faint); font-size: 12px; }

.service-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.service-card {
  position: relative;
  min-height: 148px;
  display: flex;
  flex-direction: column;
  padding: 19px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
  box-shadow: 0 1px 0 rgba(23,33,43,.02);
  transition: border-color .18s, box-shadow .18s, transform .18s;
}
.service-card.featured { min-height: 148px; }
.service-card[href]:hover { border-color: #b8c5d8; box-shadow: var(--shadow); transform: translateY(-2px); }
.service-card.is-muted { background: #f6f7f9; }
.service-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.service-icon { width: 39px; height: 39px; display: grid; place-items: center; border-radius: 11px; color: var(--blue); background: var(--blue-soft); }
.service-icon.green { color: var(--green); background: var(--green-soft); }
.service-icon.amber { color: var(--amber); background: var(--amber-soft); }
.service-icon.gray { color: #6c7784; background: #e9edf1; }
.service-icon svg { width: 21px; height: 21px; stroke: currentColor; fill: none; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; }
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 25px;
  padding: 0 9px;
  border-radius: 999px;
  background: #edf0f3;
  color: #697583;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.online { color: var(--green); background: var(--green-soft); }
.status.building { color: var(--amber); background: var(--amber-soft); }
.status.offline { color: var(--red); background: #fbebea; }
.service-body { margin-top: auto; padding-top: 20px; }
.service-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.service-title h3 { margin: 0; font-size: 21px; letter-spacing: -.025em; }
.service-title svg { width: 18px; height: 18px; stroke: var(--faint); fill: none; stroke-width: 1.7; }
.service-card p { margin: 5px 0 0; color: var(--muted); font-size: 13px; }

.operations-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr); gap: 12px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 0 rgba(23,33,43,.02); }
.panel-header { min-height: 63px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.panel-brand { display: flex; align-items: center; gap: 11px; }
.panel-logo { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 9px; background: #10151b; color: #fff; font-size: 14px; font-weight: 800; }
.panel-header h3 { margin: 0; font-size: 15px; }
.panel-header p { margin: 1px 0 0; color: var(--muted); font-size: 11px; }
.panel-body { padding: 21px; }
.balance-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.balance-label { color: var(--muted); font-size: 12px; }
.balance-value { min-height: 45px; margin-top: 3px; font-size: clamp(31px, 4vw, 43px); line-height: 1; font-weight: 750; letter-spacing: -.045em; font-variant-numeric: tabular-nums; }
.balance-note { max-width: 270px; color: var(--muted); font-size: 12px; text-align: right; }
.progress { height: 7px; margin: 21px 0 17px; overflow: hidden; border-radius: 99px; background: #e9edf2; }
.progress > span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--blue); transition: width .45s ease; }
.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.metric { padding: 11px 12px; border-radius: 11px; background: var(--surface-2); }
.metric span { display: block; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.metric strong { display: block; margin-top: 3px; font-size: 15px; font-variant-numeric: tabular-nums; }
.empty-balance { display: none; padding: 4px 0 1px; }
.empty-balance.visible { display: block; }
.empty-balance strong { display: block; font-size: 18px; }
.empty-balance p { max-width: 570px; margin: 6px 0 16px; color: var(--muted); font-size: 13px; }
.link-button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 0 13px; border-radius: 10px; background: var(--ink); color: #fff; text-decoration: none; font-size: 12px; font-weight: 700; }

.integration-list { display: grid; }
.integration-row { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 20px; border-bottom: 1px solid var(--line); }
.integration-row:last-child { border-bottom: 0; }
.integration-name { display: flex; align-items: center; gap: 10px; }
.integration-glyph { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: 11px; font-weight: 800; }
.integration-name strong { display: block; font-size: 13px; }
.integration-name span { display: block; color: var(--muted); font-size: 11px; }
.integration-state { color: var(--faint); font-size: 11px; font-weight: 700; }
.integration-state.online { color: var(--green); }

/* Settings */
.settings-content { width: min(1040px, 100%); }
.settings-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.settings-hero h1 { margin: 0; font-size: clamp(27px, 3vw, 34px); line-height: 1.1; letter-spacing: -.035em; }
.settings-hero p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }
.provider-chip-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: #141a21; color: #fff; font-size: 10px; font-weight: 850; }
.provider-chip-mark.deepseek, .tab-mark.deepseek { background: #3f7778; }
.settings-console { min-height: 570px; display: grid; grid-template-columns: 190px minmax(0, 1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); box-shadow: 0 1px 0 rgba(23,33,43,.02); }
.settings-tabs { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-right: 1px solid var(--line); background: #f7f8fa; }
.settings-tabs button { position: relative; min-height: 48px; display: grid; grid-template-columns: 29px minmax(0,1fr) 7px; align-items: center; gap: 10px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: #5e6976; cursor: pointer; font-size: 12px; font-weight: 700; text-align: left; }
.settings-tabs button:hover { background: #edf0f4; color: var(--ink); }
.settings-tabs button.active { background: #fff; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line), 0 2px 8px rgba(23,33,43,.04); }
.tab-mark { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 8px; background: var(--blue); color: #fff; font-size: 9px; font-weight: 850; }
.tab-mark.dark { background: #141a21; }
.tab-mark.blue { background: #3479d6; }
.tab-mark.cyan { background: #229bd6; }
.tab-mark.green { background: var(--green); }
.tab-mark.status-mark { background: #5a6674; }
.settings-tabs i { width: 7px; height: 7px; border-radius: 50%; background: #a8b0ba; }
.settings-tabs i.online { background: #38ba83; }
.settings-tabs i.partial { background: #d39a3f; }
.settings-pane { min-width: 0; display: flex; flex-direction: column; }
.settings-pane[hidden] { display: none; }
.pane-header { min-height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 22px; border-bottom: 1px solid var(--line); }
.pane-header h2 { margin: 0; font-size: 18px; letter-spacing: -.025em; }
.pane-header p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.config-state { display: inline-flex; align-items: center; gap: 7px; min-height: 27px; padding: 0 10px; border-radius: 999px; background: #edf0f3; color: #697583; font-size: 10px; font-weight: 800; letter-spacing: .055em; text-transform: uppercase; white-space: nowrap; }
.config-state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.config-state.online { color: var(--green); background: var(--green-soft); }
.config-state.partial { color: var(--amber); background: var(--amber-soft); }
.pane-body { flex: 1; padding: 6px 22px 22px; }
.status-pane-body { padding-top: 20px; }
.settings-status-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(270px, .65fr); gap: 12px; }
.settings-status-grid .panel { min-width: 0; box-shadow: none; }
.settings-group { padding: 20px 0; }
.settings-group + .settings-group { border-top: 1px solid var(--line); }
.group-heading { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 15px; }
.group-heading > span { width: 27px; height: 27px; flex: 0 0 27px; display: grid; place-items: center; border-radius: 8px; background: #eef2f7; color: #637081; font-size: 9px; font-weight: 800; }
.group-heading h3 { margin: 1px 0 0; font-size: 14px; }
.group-heading p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.fields-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.span-2 { grid-column: 1 / -1; }
.setting-field { min-width: 0; display: grid; align-content: start; gap: 7px; }
.setting-field > span { color: #46515d; font-size: 11px; font-weight: 750; }
.setting-field em { color: var(--faint); font-style: normal; font-weight: 500; }
.setting-field input, .copy-field input { width: 100%; height: 42px; padding: 0 12px; outline: none; border: 1px solid var(--line-strong); border-radius: 8px; background: #fff; color: var(--ink); font-size: 12px; }
.setting-field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,111,237,.1); }
.setting-field small { min-height: 15px; color: var(--faint); font-size: 10px; }
.copy-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
.copy-field input { min-width: 0; border-radius: 8px 0 0 8px; background: var(--surface-2); color: #4d5966; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 10px; }
.copy-field button { min-width: 102px; padding: 0 13px; border: 1px solid var(--line-strong); border-left: 0; border-radius: 0 8px 8px 0; background: #fff; color: var(--ink); cursor: pointer; font-size: 11px; font-weight: 700; }
.copy-field button:hover { background: var(--surface-2); }
.setup-note { margin-top: 13px; padding: 10px 12px; border-left: 3px solid #d5a450; background: #fff9ee; color: #71511f; font-size: 10px; line-height: 1.55; }
.provider-setting-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 20px; }
.provider-setting-title { display: flex; align-items: center; gap: 12px; }
.provider-setting-title h3 { margin: 0; font-size: 16px; }
.provider-setting-title p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
.provider-inline-balance { min-width: 120px; padding: 9px 11px; border-radius: 10px; background: var(--surface-2); text-align: right; }
.provider-inline-balance span { display: block; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.provider-inline-balance strong { display: block; margin-top: 2px; font-size: 17px; font-variant-numeric: tabular-nums; }
.provider-fields { max-width: 620px; }
.provider-note { max-width: 620px; border-left-color: #3f7778; background: #f0f7f7; color: #365f60; }
.pane-actions { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 22px; border-top: 1px solid var(--line); background: #fbfcfd; }
.pane-actions > div { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.action-result { color: var(--muted); font-size: 11px; }
.save-button, .secondary-button { min-height: 36px; padding: 0 13px; border-radius: 9px; cursor: pointer; font-size: 12px; font-weight: 750; }
.save-button { border: 1px solid var(--ink); background: var(--ink); color: #fff; }
.save-button:hover { background: #293644; }
.secondary-button { border: 1px solid var(--line-strong); background: #fff; color: var(--ink); }
.secondary-button:hover { background: var(--surface-2); }
.save-button:disabled, .secondary-button:disabled { opacity: .55; cursor: wait; }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 20; max-width: min(420px, calc(100vw - 44px)); padding: 11px 14px; border-radius: 10px; background: var(--ink); color: #fff; box-shadow: 0 12px 30px rgba(23,33,43,.24); font-size: 12px; font-weight: 650; opacity: 0; pointer-events: none; transform: translateY(8px); transition: opacity .18s, transform .18s; }
.toast.visible { opacity: 1; transform: translateY(0); }
.toast.error { background: var(--red); }
.toast.warn { background: var(--amber); }

/* Login */
.login-page { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 46%) 1fr; background: var(--surface); }
.login-aside { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; min-height: 100vh; padding: clamp(28px, 5vw, 68px); background: var(--sidebar); color: #fff; }
.login-aside::after { content: ""; position: absolute; right: -150px; bottom: -170px; width: 440px; height: 440px; border: 70px solid rgba(47,111,237,.18); border-radius: 50%; }
.login-aside .brand { padding: 0; position: relative; z-index: 1; }
.login-message { position: relative; z-index: 1; max-width: 520px; }
.login-message h1 { margin: 0; font-size: clamp(38px, 5vw, 68px); line-height: .98; letter-spacing: -.055em; }
.login-message p { max-width: 410px; margin: 20px 0 0; color: #9da8b5; font-size: 16px; }
.login-system { position: relative; z-index: 1; display: flex; gap: 18px; color: #7f8a98; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.login-main { display: grid; place-items: center; padding: 30px; }
.login-card { width: min(390px, 100%); }
.login-card .eyebrow { margin-bottom: 12px; }
.login-card h2 { margin: 0; font-size: 31px; letter-spacing: -.035em; }
.login-card > p { margin: 8px 0 27px; color: var(--muted); }
.field { display: grid; gap: 7px; margin: 15px 0; }
.field span { color: #46515d; font-size: 11px; font-weight: 750; }
.field input { width: 100%; height: 46px; padding: 0 13px; outline: none; border: 1px solid var(--line-strong); border-radius: 10px; background: #fff; color: var(--ink); }
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(47,111,237,.11); }
.primary-button { width: 100%; height: 46px; margin-top: 8px; border: 0; border-radius: 10px; background: var(--blue); color: #fff; cursor: pointer; font-weight: 750; }
.primary-button:hover { background: #265fcf; }
.primary-button:disabled { opacity: .65; cursor: wait; }
.error { min-height: 21px; margin-top: 10px; color: var(--red); font-size: 12px; }
.login-footnote { margin-top: 22px; color: var(--faint); font-size: 11px; text-align: center; }

/* Consistent placeholder pages */
.service-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--canvas); }
.service-shell { width: min(720px, 100%); }
.service-shell .brand { width: fit-content; padding: 0; color: var(--ink); }
.service-shell .brand-copy span { color: var(--muted); }
.service-shell .brand-mark { color: #fff; }
.placeholder-panel { margin-top: 26px; padding: clamp(26px, 5vw, 46px); border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.placeholder-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 14px; background: var(--blue-soft); color: var(--blue); }
.placeholder-icon svg { width: 25px; height: 25px; stroke: currentColor; fill: none; stroke-width: 1.6; }
.placeholder-panel h1 { margin: 25px 0 8px; font-size: clamp(32px, 6vw, 52px); line-height: 1; letter-spacing: -.045em; }
.placeholder-panel p { max-width: 520px; margin: 0 0 26px; color: var(--muted); }
.placeholder-actions { display: flex; flex-wrap: wrap; gap: 9px; }

@media (max-width: 1100px) {
  .service-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .operations-grid { grid-template-columns: 1fr; }
  .settings-status-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-shell.sidebar-collapsed { grid-template-columns: 1fr; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(280px, calc(100vw - 44px)); height: 100vh; padding: 22px 16px 18px; transform: translateX(-102%); box-shadow: 16px 0 44px rgba(8,13,18,.28); }
  .app-shell.sidebar-open .sidebar { transform: translateX(0); }
  .app-shell.sidebar-open .sidebar-overlay { position: fixed; inset: 0; z-index: 11; display: block; border: 0; background: rgba(10,15,21,.48); }
  .sidebar-toggle { right: 0; top: 3px; }
  .app-shell.sidebar-collapsed .sidebar { padding: 22px 16px 18px; }
  .app-shell.sidebar-collapsed .brand-copy, .app-shell.sidebar-collapsed .nav-label, .app-shell.sidebar-collapsed .nav-text { display: grid; }
  .app-shell.sidebar-collapsed .nav a, .app-shell.sidebar-collapsed .sidebar-settings { justify-content: flex-start; padding: 0 12px; }
  .app-shell.sidebar-collapsed .nav-status { position: static; width: 7px; height: 7px; }
  .app-shell.sidebar-collapsed .sidebar-activity { margin-top: 32px; overflow: hidden; }
  .app-shell.sidebar-collapsed .activity-collapsed-button { display: none; }
  .app-shell.sidebar-collapsed .activity-header { display: flex; }
  .app-shell.sidebar-collapsed .activity-summary { display: flex; }
  .app-shell.sidebar-collapsed .activity-list { display: grid; }
  .app-shell.sidebar-collapsed .activity-read-all:not([hidden]) { display: block; }
  .mobile-menu-button { display: grid; }
  .topbar { min-height: 60px; padding: 0 20px; }
  .breadcrumb { display: none; }
  .top-actions { margin-left: auto; }
  .content { padding: 30px 20px 44px; }
  .intro { align-items: flex-start; flex-direction: column; margin-bottom: 26px; }
  .system-health { min-height: 35px; font-size: 12px; }
  .settings-hero { align-items: stretch; flex-direction: column; }
  .settings-console { grid-template-columns: 1fr; }
  .settings-tabs { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .settings-tabs button { min-width: 145px; }
  .login-page { grid-template-columns: 1fr; }
  .login-aside { min-height: auto; padding: 24px; }
  .login-message { margin-top: 70px; }
  .login-message h1 { font-size: 42px; }
  .login-message p { margin-top: 14px; }
  .login-system { display: none; }
  .login-main { min-height: 470px; padding: 34px 24px 50px; }
}

@media (max-width: 580px) {
  .today { font-size: 12px; }
  .intro h1 { font-size: 34px; }
  .intro p { font-size: 14px; }
  .service-grid { grid-template-columns: 1fr; }
  .balance-row { align-items: flex-start; flex-direction: column; gap: 10px; }
  .balance-note { text-align: left; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .metric:last-child { grid-column: 1 / -1; }
  .panel-header, .panel-body { padding-left: 16px; padding-right: 16px; }
  .login-message { margin-top: 48px; }
  .login-message h1 { font-size: 36px; }
  .settings-content { padding-left: 12px; padding-right: 12px; }
  .settings-hero { padding: 0 6px; }
  .settings-console { min-height: 0; }
  .settings-tabs { padding: 9px; }
  .settings-tabs button { min-width: 128px; }
  .pane-header { align-items: flex-start; padding: 16px; }
  .pane-body { padding: 2px 16px 18px; }
  .status-pane-body { padding-top: 14px; }
  .fields-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: 1; }
  .pane-actions { align-items: stretch; flex-direction: column; padding: 12px 16px; }
  .pane-actions > div { justify-content: stretch; }
  .pane-actions button { flex: 1 1 auto; }
  .copy-field { grid-template-columns: minmax(0, 1fr); gap: 7px; }
  .copy-field input, .copy-field button { border: 1px solid var(--line-strong); border-radius: 8px; }
  .provider-setting-heading { align-items: flex-start; flex-direction: column; }
  .provider-inline-balance { width: 100%; text-align: left; }
}
