/* ============================================================
   Platform console — shell, pages and components
   Built on styles/base.css tokens.
   ============================================================ */

/* ---------- App shell ---------- */
.app-body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 78% -12%, rgba(239, 106, 43, 0.055), transparent 70%),
    var(--canvas);
  color: var(--text);
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  flex: 0 0 var(--sidebar-width);
  width: var(--sidebar-width);
  height: 100vh;
  padding: 22px 16px 16px;
  overflow-y: auto;
  color: #a9a69d;
  background:
    radial-gradient(420px 260px at 8% -4%, rgba(239, 106, 43, 0.16), transparent 64%),
    linear-gradient(178deg, #121b1f 0%, #10171b 58%, #0d1316 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  scrollbar-width: none;
}
.sidebar::-webkit-scrollbar { display: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  outline-offset: 4px;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  color: #fff;
  background: linear-gradient(150deg, #f58145 0%, #e95f20 100%);
  border-radius: 12px;
  box-shadow: 0 8px 18px -8px rgba(239, 106, 43, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.brand-mark svg { width: 27px; height: 27px; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.brand-copy strong {
  font-size: 20.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #f7f3ea;
}
.brand-copy span {
  margin-top: 5px;
  font-size: 13px;
  letter-spacing: 0.18em;
  color: #85857d;
}

.workspace-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 27px 10px 10px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: #777a74;
}
.workspace-env {
  padding: 2px 6px;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #bea992;
  background: rgba(255, 255, 255, 0.055);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 5px;
}

.side-nav { display: flex; flex-direction: column; gap: 3px; margin-top: 2px; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 43px;
  padding: 0 11px;
  color: #a7a49c;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  border-radius: 10px;
  transition: background 160ms ease, color 160ms ease, transform 160ms ease;
}
.nav-item:hover { color: #f1ece2; background: rgba(255, 255, 255, 0.055); }
.nav-item.is-active {
  color: #161d20;
  background: #f3efe5;
  box-shadow: 0 10px 22px -14px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.nav-item.is-active .nav-icon { color: var(--brand-strong); }
.nav-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  color: #8d9089;
  transition: color 160ms ease;
}
.nav-item:hover .nav-icon { color: #d6d1c7; }
.nav-text { flex: 1; }
.nav-count {
  min-width: 24px;
  padding: 2px 7px;
  font-size: 13.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: #8f918b;
  background: rgba(255, 255, 255, 0.065);
  border-radius: 999px;
}
.nav-item.is-active .nav-count { color: #4a4b45; background: rgba(17, 25, 29, 0.08); }

.sidebar-spacer { flex: 1; min-height: 24px; }

.sidebar-note {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 16px 2px;
  padding: 15px 15px 14px;
  text-decoration: none;
  background:
    radial-gradient(180px 100px at 100% 0, rgba(239, 106, 43, 0.12), transparent 70%),
    rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 14px;
  transition: border-color 180ms ease, background 180ms ease, transform 180ms ease;
}
.sidebar-note:hover {
  border-color: rgba(239, 106, 43, 0.34);
  transform: translateY(-1px);
}
.sidebar-note-eyebrow {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: #c9906c;
}
.pulse-dot {
  width: 5px;
  height: 5px;
  flex: 0 0 5px;
  background: var(--brand);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(239, 106, 43, 0.14);
  animation: softPulse 2.6s ease-in-out infinite;
}
@keyframes softPulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(239, 106, 43, 0.12); }
  50% { box-shadow: 0 0 0 5px rgba(239, 106, 43, 0.04); }
}
.sidebar-note strong {
  font-size: 16px;
  font-weight: 500;
  line-height: 1.45;
  color: #ede8de;
}
.sidebar-note-text {
  font-size: 14.5px;
  line-height: 1.6;
  color: #848680;
}
.sidebar-note-link {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 14px;
  font-weight: 500;
  color: #e79768;
}
.sidebar-note-link span { transition: transform 180ms ease; }
.sidebar-note:hover .sidebar-note-link span { transform: translateX(3px); }

.sidebar-bottom { margin-top: auto; }
.sidebar-health {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 10px 12px;
  font-size: 13.5px;
  color: #71756f;
}
.health-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  flex: 0 0 6px;
  background: #35b37d;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(53, 179, 125, 0.1);
}
.operator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 10px 4px;
  border-top: 1px solid rgba(255, 255, 255, 0.075);
}
.operator-avatar {
  --avatar-size: 33px;
  font-size: 14px;
  background: #2b3538 !important;
  color: #e8e1d4 !important;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.operator-copy { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.2; }
.operator-copy strong { font-size: 15px; font-weight: 500; color: #e8e4db; }
.operator-copy span { margin-top: 4px; font-size: 12.5px; letter-spacing: 0.08em; color: #747770; }
.operator-logout {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: #7d807a;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 160ms ease;
}
.operator-logout:hover {
  color: #f0cbb6;
  background: rgba(239, 106, 43, 0.1);
  border-color: rgba(239, 106, 43, 0.2);
}

.sidebar-scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 35;
  background: rgba(9, 14, 16, 0.5);
  backdrop-filter: blur(2px);
}

/* ---------- Main / topbar ---------- */
.main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--topbar-height);
  padding: 0 clamp(20px, 3.2vw, 44px);
  background: rgba(244, 242, 237, 0.82);
  border-bottom: 1px solid transparent;
  backdrop-filter: blur(16px) saturate(1.1);
  transition: border-color 180ms ease, background 180ms ease;
}
.topbar.is-scrolled {
  background: #f7f5f0;
  border-bottom-color: var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.topbar-right { display: flex; align-items: center; gap: 8px; margin-left: auto; }

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  font-size: 15px;
  white-space: nowrap;
}
.breadcrumb-root { color: var(--text-3); }
.breadcrumb-sep { color: #c7c2b8; }
.breadcrumb strong { font-weight: 500; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; }

.mobile-menu { display: none; }

.global-search {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 296px;
  height: 36px;
  padding: 0 9px 0 12px;
  color: var(--text-3);
  background: rgba(255, 255, 255, 0.63);
  border: 1px solid var(--line);
  border-radius: 9px;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}
.global-search:focus-within {
  background: #fff;
  border-color: #cdc5b8;
  box-shadow: 0 0 0 3px rgba(239, 106, 43, 0.07);
}
.global-search svg { flex: 0 0 auto; }
.global-search input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0;
  color: var(--text);
  font-family: inherit;
  font-size: 14.5px;
  background: transparent;
  border: 0;
  outline: 0;
}
.global-search input::placeholder { color: #aaa59b; }
.global-search input::-webkit-search-cancel-button { display: none; }
.global-search kbd {
  padding: 2px 5px;
  font-family: inherit;
  font-size: 12px;
  line-height: 1.4;
  color: #a39d92;
  background: #f7f4ee;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.icon-btn.topbar-action {
  width: 34px;
  height: 34px;
  color: var(--text-2);
  background: transparent;
  border-color: transparent;
}
.icon-btn.topbar-action:hover { color: var(--text); background: rgba(255, 255, 255, 0.72); border-color: var(--line); }
.icon-btn.is-spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.alert-button { position: relative; }
.alert-dot {
  display: none;
  position: absolute;
  top: 8px;
  right: 8px;
  width: 6px;
  height: 6px;
  background: var(--brand);
  border: 1.5px solid var(--canvas);
  border-radius: 50%;
}
.alert-dot.is-on { display: block; }

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-left: 5px;
  padding-left: 13px;
  border-left: 1px solid var(--line);
  font-size: 13.5px;
  color: var(--text-3);
  white-space: nowrap;
}
.topbar-date { font-variant-numeric: tabular-nums; }
.topbar-status { display: flex; align-items: center; gap: 6px; color: #6f756d; }

/* ---------- View ---------- */
.view {
  flex: 1;
  width: 100%;
  max-width: 1520px;
  margin: 0 auto;
  padding: 28px clamp(20px, 3.2vw, 44px) 40px;
}

.app-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 1520px;
  width: 100%;
  margin: 0 auto;
  padding: 0 clamp(20px, 3.2vw, 44px) 24px;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: #a8a399;
}
.footer-sep { width: 3px; height: 3px; background: #c9c3b8; border-radius: 50%; }
.app-footer .grow { flex: 1; }
#dataUpdatedAt { font-variant-numeric: tabular-nums; }

/* ---------- Page scaffolding ---------- */
.page { animation: pageIn 420ms cubic-bezier(0.22, 0.8, 0.3, 1) both; }
@keyframes pageIn {
  from { opacity: 0; transform: translateY(9px); }
  to { opacity: 1; transform: translateY(0); }
}
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
}
.page-head-copy { min-width: 0; }
.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #9b8d80;
}
.eyebrow::before {
  content: "";
  width: 16px;
  height: 1.5px;
  background: var(--brand);
  border-radius: 2px;
}
.page-title {
  margin: 11px 0 0;
  font-size: clamp(33px, 3vw, 43.5px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.16;
  color: #171c1e;
}
.page-title em { font-style: normal; color: var(--brand-strong); }
.page-sub {
  max-width: 620px;
  margin: 9px 0 0;
  font-size: 15.5px;
  line-height: 1.7;
  color: var(--text-2);
}
.page-actions { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; padding-bottom: 2px; }

.inline-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px 15px;
  background: #fdf4ee;
  border: 1px solid #f3ddce;
  border-radius: 12px;
  font-size: 14.5px;
  color: #8f4c2e;
}
.inline-banner strong { font-weight: 500; color: #7c3a1f; }
.inline-banner .banner-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  color: #c25a28;
  background: #fae4d5;
  border-radius: 8px;
}
.inline-banner .grow { flex: 1; }
.inline-banner button {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: #a44720;
  background: transparent;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}
.inline-banner button:hover { text-decoration: underline; }

/* ---------- KPI ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 18px;
}
.kpi-card {
  position: relative;
  min-height: 146px;
  padding: 17px 18px 15px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow-xs, 0 1px 2px rgba(20, 24, 22, 0.04));
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}
.kpi-card:hover {
  transform: translateY(-2px);
  border-color: #ded7ca;
  box-shadow: 0 16px 32px -24px rgba(32, 31, 26, 0.4);
}
.kpi-card::after {
  content: "";
  position: absolute;
  top: -46px;
  right: -36px;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(239, 106, 43, 0.06), transparent 68%);
  pointer-events: none;
}
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.kpi-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-2);
}
.kpi-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  color: #9a6a4d;
  background: #fbf2ea;
  border-radius: 8px;
}
.kpi-card[data-tone="green"] .kpi-icon { color: #25785b; background: #eef7f1; }
.kpi-card[data-tone="blue"] .kpi-icon { color: #3b618f; background: #eef3f8; }
.kpi-card[data-tone="amber"] .kpi-icon { color: #96681f; background: #fbf5e7; }
.kpi-index {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 11.5px;
  letter-spacing: 0.08em;
  color: #c0bab0;
}
.kpi-value {
  margin-top: 13px;
  font-size: clamp(26.5px, 2.3vw, 31.5px);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: #1c2123;
}
.kpi-value .unit { margin-left: 3px; font-size: 15px; font-weight: 400; letter-spacing: 0; color: #8f8c84; }
.kpi-foot { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: 12px; }
.kpi-foot-copy { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; font-size: 13px; color: var(--text-3); }
.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px 5px;
  font-size: 12.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: #267355;
  background: var(--green-soft, #eef7f1);
  border-radius: 4px;
  white-space: nowrap;
}
.kpi-delta.is-down { color: #a8453b; background: #fbeeee; }
.kpi-delta.is-flat { color: #7d7a72; background: #f3f1ec; }
.kpi-spark { flex: 0 0 auto; opacity: 0.9; margin: 0 -2px -3px 0; }
.kpi-card.is-dark {
  color: #f1ede4;
  background: linear-gradient(145deg, #1b262a, #131c20);
  border-color: #1b262a;
}
.kpi-card.is-dark .kpi-label { color: #c6c2b8; }
.kpi-card.is-dark .kpi-icon { color: #f2a77d; background: rgba(239, 106, 43, 0.13); }
.kpi-card.is-dark .kpi-value { color: #f8f4eb; }
.kpi-card.is-dark .kpi-value .unit { color: #8f938d; }
.kpi-card.is-dark .kpi-foot-copy { color: #858a85; }
.kpi-card.is-dark .kpi-delta { color: #92d3b6; background: rgba(71, 169, 127, 0.13); }
.kpi-card.is-dark::after { background: radial-gradient(circle, rgba(239, 106, 43, 0.15), transparent 68%); }

/* ---------- Cards and dashboard ---------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-xs, 0 1px 2px rgba(20, 24, 22, 0.035));
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 21px 0;
}
.card-title {
  margin: 0;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: #202527;
}
.card-sub {
  margin: 5px 0 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--text-3);
}
.card-head-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.card-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0;
  font: inherit;
  font-size: 13.5px;
  color: var(--text-2);
  background: none;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
}
.card-link:hover { color: var(--brand-strong); }

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 13px;
}
.span-8 { grid-column: span 8; }
.span-7 { grid-column: span 7; }
.span-5 { grid-column: span 5; }
.span-4 { grid-column: span 4; }
.span-12 { grid-column: span 12; }
.span-6 { grid-column: span 6; }

.chart-card { overflow: hidden; }
.chart-card .card-head { align-items: center; padding-bottom: 4px; }
.chart-wrap { padding: 4px 14px 12px 8px; }
.chart-canvas { position: relative; width: 100%; }
.trend-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-grid { stroke: #ece8df; stroke-width: 1; stroke-dasharray: 2 5; }
.chart-axis-label { font-family: inherit; font-size: 12.5px; fill: #a29d93; font-variant-numeric: tabular-nums; }
.chart-cursor { transition: opacity 120ms ease; }
.chart-hit { cursor: crosshair; }
.chart-line { filter: drop-shadow(0 6px 10px rgba(233, 95, 32, 0.13)); }
.chart-tooltip {
  position: absolute;
  z-index: 4;
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 148px;
  padding: 10px 12px;
  color: #e7e4dc;
  background: rgba(22, 29, 32, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  box-shadow: 0 16px 32px -18px rgba(10, 14, 15, 0.6);
  opacity: 0;
  transform: translate(-50%, -100%);
  pointer-events: none;
  transition: opacity 100ms ease;
}
.chart-tooltip.is-visible { opacity: 1; }
.chart-tooltip-date { font-size: 12px; letter-spacing: 0.04em; color: #9fa29c; }
.chart-tooltip-row { display: flex; align-items: center; justify-content: space-between; gap: 18px; font-size: 13px; }
.chart-tooltip-row strong { font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; color: #fff; }
.chart-tooltip-sub { color: #979b95; }
.chart-tooltip-sub span:last-child { color: #cbc7be; }
.chart-empty {
  display: grid;
  place-items: center;
  min-height: 250px;
  font-size: 15px;
  color: var(--text-3);
}
.chart-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 21px 15px;
  font-size: 12.5px;
  color: var(--text-3);
}
.chart-legend { display: flex; align-items: center; gap: 14px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--brand); }

.segmented {
  display: inline-flex;
  padding: 2px;
  background: #f4f1eb;
  border: 1px solid #eae5dc;
  border-radius: 7px;
}
.segmented button {
  padding: 4px 9px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: #8f8b82;
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
  transition: all 140ms ease;
}
.segmented button:hover { color: #4c4b45; }
.segmented button.is-active {
  color: #252a2c;
  background: #fff;
  box-shadow: 0 1px 2px rgba(20, 24, 22, 0.09);
}

/* Status composition */
.status-card { display: flex; flex-direction: column; }
.status-card .card-head { padding-bottom: 6px; }
.status-body { display: flex; align-items: center; gap: 20px; padding: 17px 21px 14px; }
.donut-wrap { position: relative; flex: 0 0 132px; width: 132px; height: 132px; }
.donut {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transform: rotate(0deg);
}
.donut::after { content: ""; }
.donut-hole {
  position: absolute;
  inset: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border-radius: 50%;
}
.donut-hole strong {
  font-size: 29.5px;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1;
  color: #1d2325;
  font-variant-numeric: tabular-nums;
}
.donut-hole span { margin-top: 4px; font-size: 12px; letter-spacing: 0.05em; color: var(--text-3); }
.status-legend { display: flex; flex-direction: column; gap: 9px; flex: 1; min-width: 0; }
.legend-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.legend-swatch { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; }
.legend-label { color: var(--text-2); flex: 1; }
.legend-value { font-weight: 500; font-variant-numeric: tabular-nums; color: #262b2d; }
.legend-pct { width: 32px; text-align: right; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.plan-usage { margin-top: auto; padding: 14px 21px 18px; border-top: 1px solid #f1ede6; }
.plan-usage-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; font-size: 13px; color: var(--text-3); }
.plan-usage-head strong { font-weight: 500; color: var(--text-2); }
.plan-bar { display: flex; width: 100%; height: 6px; gap: 2px; overflow: hidden; border-radius: 99px; background: #f1eee7; }
.plan-bar span { display: block; height: 100%; border-radius: 99px; }
.plan-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 9px; font-size: 12px; color: var(--text-3); }
.plan-legend i { display: inline-block; width: 5px; height: 5px; margin-right: 4px; border-radius: 50%; vertical-align: 1px; }

/* Rank list */
.rank-list { padding: 10px 21px 14px; }
.rank-row {
  display: grid;
  grid-template-columns: 24px 34px minmax(0, 1fr) 84px 72px;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid #f3efe8;
}
.rank-row:last-child { border-bottom: 0; }
.rank-no {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 12.5px;
  color: #bbb5aa;
}
.rank-row:nth-child(1) .rank-no { color: var(--brand); font-weight: 500; }
.rank-main { min-width: 0; }
.rank-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 500;
  color: #24292a;
}
.rank-meta { margin-top: 3px; font-size: 12px; color: var(--text-3); }
.rank-gmv { text-align: right; font-size: 14.5px; font-weight: 500; font-variant-numeric: tabular-nums; color: #2a2f30; }
.rank-orders { text-align: right; font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--text-3); }

/* Attention list */
.attention-list { display: flex; flex-direction: column; padding: 8px 12px 12px; }
.attention-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
  padding: 11px 9px;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #f3efe8;
  border-radius: 8px;
  cursor: pointer;
  transition: background 150ms ease;
}
.attention-item:last-child { border-bottom: 0; }
.attention-item:hover { background: #faf7f1; }
.attention-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  margin-top: 1px;
  color: #a16323;
  background: #fbf3e3;
  border-radius: 8px;
}
.attention-icon.is-high { color: #b04439; background: #faeceb; }
.attention-icon.is-info { color: #52708e; background: #eef3f7; }
.attention-copy { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.attention-title { font-size: 14.5px; font-weight: 500; color: #292e2f; }
.attention-title span { margin-left: 5px; font-size: 12px; font-weight: 400; color: var(--text-3); }
.attention-msg { font-size: 13px; line-height: 1.55; color: var(--text-2); }
.attention-arrow { align-self: center; color: #c5bfb4; flex: 0 0 auto; }

/* Audit mini list */
.audit-mini { padding: 6px 21px 10px; }
.audit-mini-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 0;
  text-align: left;
  background: none;
  border: 0;
  border-bottom: 1px solid #f3efe8;
  cursor: pointer;
}
.audit-mini-row:last-child { border-bottom: 0; }
.audit-mini-row:hover .audit-mini-text { color: var(--text); }
.audit-mini-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  color: #777f7a;
  background: #f5f3ed;
  border-radius: 8px;
}
.audit-mini-text { font-size: 13.5px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-mini-text strong { font-weight: 500; color: #33383a; }
.audit-mini-time { font-size: 12px; color: var(--text-3); white-space: nowrap; }

/* ---------- Toolbar, tabs, tables ---------- */
.toolbar-card { margin-bottom: 13px; padding: 6px 7px 6px 10px; }
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-tabs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; }
.filter-tab {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 10px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: 0;
  border-radius: 7px;
  cursor: pointer;
  transition: all 150ms ease;
}
.filter-tab:hover { color: var(--text); background: #f7f4ee; }
.filter-tab.is-active { color: #222728; background: #f3efe7; }
.filter-tab-count {
  min-width: 17px;
  padding: 1px 4px;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: #99948a;
  background: rgba(255, 255, 255, 0.6);
  border-radius: 99px;
}
.filter-tab.is-active .filter-tab-count { color: #6b6459; background: #fff; }
.toolbar-sep { width: 1px; height: 20px; margin: 0 3px; background: var(--line); }
.toolbar .input-group { width: 240px; height: 34px; }
.toolbar .select { width: auto; min-width: 108px; height: 34px; font-size: 13.5px; }
.toolbar .grow { flex: 1; }
.result-summary { font-size: 13px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.result-summary strong { font-weight: 500; color: var(--text-2); }

.table-card { overflow: hidden; }
.table-scroll { width: 100%; overflow-x: auto; }
.data-table {
  width: 100%;
  min-width: 920px;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
}
.data-table thead th {
  height: 41px;
  padding: 0 14px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9b968c;
  background: #fbf9f5;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table thead th:first-child { padding-left: 21px; }
.data-table thead th:last-child { padding-right: 21px; text-align: right; }
.data-table tbody td {
  height: 63px;
  padding: 9px 14px;
  vertical-align: middle;
  border-bottom: 1px solid #f2eee7;
  color: var(--text-2);
}
.data-table tbody td:first-child { padding-left: 21px; }
.data-table tbody td:last-child { padding-right: 21px; }
.data-table tbody tr { transition: background 140ms ease; }
.data-table tbody tr.is-clickable { cursor: pointer; }
.data-table tbody tr:hover { background: #fbf8f3; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.table-tenant { display: flex; align-items: center; gap: 10px; min-width: 220px; }
.table-tenant-copy { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.table-tenant-name {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14.5px;
  font-weight: 500;
  color: #222728;
  white-space: nowrap;
}
.table-tenant-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.table-tenant-meta .mono { font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); letter-spacing: 0.02em; }
.table-contact { display: flex; flex-direction: column; gap: 3px; white-space: nowrap; }
.table-contact strong { font-weight: 400; color: #404547; }
.table-contact span { font-size: 12px; color: var(--text-3); }
.table-usage { display: flex; flex-direction: column; gap: 5px; min-width: 76px; }
.table-usage-text { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--text-3); }
.table-usage-text strong { font-weight: 500; color: #4a4f50; font-variant-numeric: tabular-nums; }
.table-usage .progress { height: 3px; }
.table-money { display: flex; flex-direction: column; gap: 3px; white-space: nowrap; }
.table-money strong { font-size: 15px; font-weight: 500; color: #24292a; font-variant-numeric: tabular-nums; }
.table-money span { font-size: 12px; color: var(--text-3); }
.table-expiry { display: flex; flex-direction: column; gap: 3px; white-space: nowrap; }
.table-expiry strong { font-size: 13.5px; font-weight: 400; color: #4a4f50; font-variant-numeric: tabular-nums; }
.table-expiry span { font-size: 12px; color: var(--text-3); }
.table-expiry .is-warning { color: #a86b1c; }
.table-expiry .is-danger { color: #b3463b; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 3px; }
.table-action {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: #969188;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  transition: all 140ms ease;
}
.table-action:hover { color: var(--brand-strong); background: #fbf1e9; border-color: #f3dfd1; }
.table-action.is-danger:hover { color: #b3463b; background: #fbeceb; border-color: #f1d5d3; }
.table-action:disabled { opacity: 0.35; cursor: not-allowed; }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 54px;
  padding: 9px 21px;
  border-top: 1px solid #f1ede5;
}
.pagination-info { font-size: 13px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.pagination-info strong { font-weight: 500; color: var(--text-2); }
.pager { display: flex; align-items: center; gap: 4px; }
.pager button {
  display: grid;
  place-items: center;
  min-width: 27px;
  height: 27px;
  padding: 0 7px;
  font: inherit;
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  color: #77736b;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
}
.pager button:hover:not(:disabled) { background: #f7f3ec; color: #2c3132; }
.pager button.is-active { color: #fff; background: #22292b; }
.pager button:disabled { opacity: 0.3; cursor: not-allowed; }
.pager .pager-ellipsis { padding: 0 3px; color: #b4aea4; font-size: 12px; }

/* Empty / skeleton */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 280px;
  padding: 40px 20px;
  text-align: center;
}
.empty-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  color: #a19789;
  background: #f6f1e9;
  border: 1px solid #efe9df;
  border-radius: 15px;
}
.empty-title { font-size: 16px; font-weight: 500; color: #3c4142; }
.empty-desc { max-width: 330px; font-size: 13.5px; line-height: 1.65; color: var(--text-3); }
.empty-actions { display: flex; gap: 8px; margin-top: 4px; }

.page-loading { max-width: 1100px; }
.page-loading-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 13px;
  margin-top: 22px;
}
.page-loading-grid span { border-radius: 15px; }

/* ---------- Drawer content ---------- */
.drawer { background: #fbf9f5; }
.drawer-head { background: #fbf9f5; }
.drawer-body { padding: 18px 22px 32px; }
.tenant-profile {
  position: relative;
  margin: 2px 0 16px;
  padding: 20px;
  overflow: hidden;
  color: #eee9de;
  background:
    radial-gradient(300px 170px at 94% -10%, rgba(239, 106, 43, 0.25), transparent 70%),
    linear-gradient(145deg, #1a2529, #121b1e);
  border-radius: 16px;
}
.tenant-profile::after {
  content: "";
  position: absolute;
  right: -34px;
  bottom: -55px;
  width: 150px;
  height: 150px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 50%;
  pointer-events: none;
}
.tenant-profile-top { display: flex; align-items: center; gap: 13px; }
.tenant-profile-avatar {
  --avatar-size: 48px;
  font-size: 18.5px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.12);
}
.tenant-profile-meta { flex: 1; min-width: 0; }
.tenant-profile-name {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 20.5px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: #f7f3ea;
}
.tenant-profile-name .badge { border: 0; }
.tenant-profile-code {
  margin-top: 5px;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 12px;
  letter-spacing: 0.08em;
  color: #8d938d;
}
.tenant-profile-actions { display: flex; gap: 5px; }
.tenant-profile-actions .icon-btn {
  width: 30px;
  height: 30px;
  color: #aeb2ab;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.07);
}
.tenant-profile-actions .icon-btn:hover { color: #fff; background: rgba(255, 255, 255, 0.12); }
.tenant-profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 19px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.tenant-profile-stat { display: flex; flex-direction: column; gap: 5px; }
.tenant-profile-stat + .tenant-profile-stat { padding-left: 15px; border-left: 1px solid rgba(255, 255, 255, 0.07); }
.tenant-profile-stat span { font-size: 12px; letter-spacing: 0.06em; color: #8b918c; }
.tenant-profile-stat strong { font-size: 18.5px; font-weight: 500; font-variant-numeric: tabular-nums; color: #f2ede3; }
.tenant-profile-stat strong.sm { font-size: 14px; line-height: 1.35; }

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 18px;
}
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px 4px 9px;
  font: inherit;
  font-size: 12px;
  color: #6c6a63;
  background: #fff;
  border: 1px solid #ebe6dc;
  border-radius: 10px;
  cursor: pointer;
  transition: all 150ms ease;
}
.quick-action:hover {
  color: var(--brand-strong);
  border-color: #edcdb8;
  background: #fffaf6;
  transform: translateY(-1px);
}
.quick-action.is-danger:hover { color: #b3463b; border-color: #ebd0cd; background: #fff8f7; }
.quick-action:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.quick-action svg { color: #8d887e; }
.quick-action:hover svg { color: currentColor; }

.drawer-section { margin-top: 20px; }
.drawer-section:first-of-type { margin-top: 0; }
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
}
.section-heading h3 {
  margin: 0;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #3f4445;
}
.section-heading span { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.section-heading button {
  padding: 0;
  font: inherit;
  font-size: 12.5px;
  color: var(--text-3);
  background: 0;
  border: 0;
  cursor: pointer;
}
.section-heading button:hover { color: var(--brand-strong); }

.info-panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  background: #eee9df;
  border: 1px solid #ede8de;
  border-radius: 12px;
}
.info-cell {
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 14px;
  background: #fff;
}
.info-cell span { font-size: 11.5px; letter-spacing: 0.05em; color: #a29c91; }
.info-cell strong { font-size: 13.5px; font-weight: 400; color: #383d3e; word-break: break-all; }
.info-cell strong.mono { font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 12.5px; }
.info-cell.is-wide { grid-column: 1 / -1; }
.table-tenant-addr { display: flex; align-items: center; gap: 4px; min-width: 0; max-width: 265px; margin-top: 3px; font-size: 11.5px; line-height: 1.3; color: var(--text-3); }
.table-tenant-addr > span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.usage-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: #fff;
  border: 1px solid #ede8de;
  border-radius: 12px;
}
.usage-row { display: flex; flex-direction: column; gap: 6px; }
.usage-row-head { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--text-3); }
.usage-row-head strong { font-weight: 500; color: #43484a; font-variant-numeric: tabular-nums; }
.usage-row-head em { font-style: normal; color: #b1aba0; }
.usage-row .progress { height: 4px; }
.usage-row .progress.is-warm > span { background: var(--amber); }
.usage-row .progress.is-hot > span { background: var(--red); }

.store-list { display: flex; flex-direction: column; overflow: hidden; background: #fff; border: 1px solid #ede8de; border-radius: 12px; }
.store-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 13px;
  border-bottom: 1px solid #f3efe7;
}
.store-row:last-child { border-bottom: 0; }
.store-dot { width: 6px; height: 6px; flex: 0 0 6px; border-radius: 50%; background: #b8b3a9; }
.store-dot.is-open { background: #2f9b73; box-shadow: 0 0 0 3px rgba(47, 155, 115, 0.1); }
.store-dot.is-paused { background: #d09532; }
.store-dot.is-closed { background: #c2bdb3; }
.store-main { flex: 1; min-width: 0; }
.store-name { font-size: 13.5px; font-weight: 400; color: #34393a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-meta { margin-top: 2px; font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.store-code { font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 11.5px; color: #b5afa4; }

.staff-strip { display: flex; align-items: center; gap: 8px; padding: 12px 14px; background: #fff; border: 1px solid #ede8de; border-radius: 12px; }
.staff-strip-copy { flex: 1; min-width: 0; }
.staff-strip-copy strong { display: block; font-size: 13.5px; font-weight: 400; color: #34393a; }
.staff-strip-copy span { display: block; margin-top: 2px; font-size: 11.5px; color: var(--text-3); }

.order-mini-list { display: flex; flex-direction: column; overflow: hidden; background: #fff; border: 1px solid #ede8de; border-radius: 12px; }
.order-mini-row { display: flex; align-items: center; gap: 10px; padding: 9px 13px; border-bottom: 1px solid #f3efe7; }
.order-mini-row:last-child { border-bottom: 0; }
.order-mini-no { font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 11.5px; color: #a6a096; width: 104px; flex: 0 0 104px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-mini-store { flex: 1; min-width: 0; font-size: 12.5px; color: #555a5b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-mini-amount { font-size: 13px; font-weight: 500; color: #34393a; font-variant-numeric: tabular-nums; }
.order-mini-time { width: 54px; text-align: right; font-size: 11.5px; color: #ada79c; white-space: nowrap; }

.timeline { position: relative; display: flex; flex-direction: column; gap: 0; padding-left: 2px; }
.timeline-row { position: relative; display: flex; gap: 10px; padding: 0 0 13px; }
.timeline-row:last-child { padding-bottom: 0; }
.timeline-row::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 15px;
  bottom: 1px;
  width: 1px;
  background: #e8e2d8;
}
.timeline-row:last-child::before { display: none; }
.timeline-dot {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  flex: 0 0 17px;
  margin-top: 1px;
  color: #9d978c;
  background: #f4f0e8;
  border: 1px solid #e7e1d6;
  border-radius: 50%;
}
.timeline-copy { flex: 1; min-width: 0; }
.timeline-title { font-size: 13px; line-height: 1.45; color: #4a4f50; }
.timeline-title strong { font-weight: 500; color: #2e3334; }
.timeline-meta { margin-top: 2px; font-size: 11.5px; color: #a9a399; }

/* ---------- Plans ---------- */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.plan-card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 21px 21px 18px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 17px;
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}
.plan-card:hover { transform: translateY(-2px); box-shadow: 0 22px 40px -32px rgba(30, 30, 25, 0.45); }
.plan-card.is-featured {
  color: #f0ece3;
  background:
    radial-gradient(360px 200px at 100% -10%, rgba(239, 106, 43, 0.24), transparent 70%),
    linear-gradient(150deg, #1d292d 0%, #121b1f 100%);
  border-color: #1d292d;
}
.plan-card.is-featured .plan-name { color: #f5f1e8; }
.plan-card.is-featured .plan-desc { color: #929892; }
.plan-card.is-featured .plan-price { color: #f8f4eb; }
.plan-card.is-featured .plan-price .price-unit,
.plan-card.is-featured .plan-price .price-period { color: #8c918b; }
.plan-card.is-featured .plan-limit-label { color: #838a85; }
.plan-card.is-featured .plan-limit-value { color: #dcd7cc; }
.plan-card.is-featured .plan-limits { border-color: rgba(255, 255, 255, 0.08); }
.plan-card.is-featured .plan-feature { color: #b8b8b1; }
.plan-card.is-featured .plan-feature svg { color: #e79a70; }
.plan-card.is-featured .plan-foot { border-color: rgba(255, 255, 255, 0.08); }
.plan-ribbon {
  position: absolute;
  top: 17px;
  right: 17px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.09em;
  color: #392116;
  background: linear-gradient(135deg, #f6b184, #ef8247);
  border-radius: 99px;
}
.plan-name-row { display: flex; align-items: center; gap: 8px; }
.plan-name { font-size: 18.5px; font-weight: 500; letter-spacing: -0.01em; color: #222728; }
.plan-code { margin-top: 4px; font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 11.5px; letter-spacing: 0.08em; color: #a8a297; }
.plan-card.is-featured .plan-code { color: #767d78; }
.plan-desc { min-height: 32px; margin: 12px 0 16px; font-size: 13px; line-height: 1.6; color: var(--text-3); }
.plan-price { display: flex; align-items: baseline; gap: 4px; }
.plan-price .price-currency { font-size: 16px; font-weight: 500; }
.plan-price .price-amount { font-size: 39.5px; font-weight: 500; letter-spacing: -0.045em; line-height: 1; font-variant-numeric: tabular-nums; }
.plan-price .price-unit { margin-left: 1px; font-size: 12px; color: var(--text-3); }
.plan-price .price-period { font-size: 12px; color: var(--text-3); }
.plan-price.is-free .price-amount { letter-spacing: -0.02em; }
.plan-limits {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  margin: 18px 0 4px;
  padding: 13px 0;
  border-top: 1px solid #f1ece4;
  border-bottom: 1px solid #f1ece4;
}
.plan-limit { display: flex; flex-direction: column; gap: 4px; text-align: center; }
.plan-limit + .plan-limit { border-left: 1px solid rgba(120, 110, 95, 0.1); }
.plan-limit-value { font-size: 15px; font-weight: 500; color: #303537; font-variant-numeric: tabular-nums; }
.plan-limit-label { font-size: 12px; color: #a39d92; }
.plan-features { display: flex; flex-direction: column; gap: 7px; min-height: 109px; padding: 13px 0 4px; }
.plan-feature { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: #6d6b64; }
.plan-feature svg { flex: 0 0 auto; color: #34966f; }
.plan-feature.is-muted { color: #b1aca2; }
.plan-feature.is-muted svg { color: #c9c3b9; }
.plan-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 15px; border-top: 1px solid #f1ece4; }
.plan-tenants { font-size: 12px; color: var(--text-3); }
.plan-tenants strong { font-weight: 500; color: var(--text-2); font-variant-numeric: tabular-nums; }
.plan-foot .btn { height: 32px; font-size: 13px; }
.plan-card.is-featured .btn-secondary { color: #e8e3d9; background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.12); }
.plan-card.is-featured .btn-secondary:hover { background: rgba(255, 255, 255, 0.12); }

.matrix-card { overflow: hidden; }
.matrix-scroll { overflow-x: auto; }
.matrix-table { width: 100%; min-width: 720px; border-collapse: collapse; font-size: 13px; }
.matrix-table th {
  padding: 9px 15px;
  font-size: 12px;
  font-weight: 500;
  text-align: center;
  color: #918c82;
  background: #fbf9f5;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.matrix-table th:first-child { text-align: left; padding-left: 21px; width: 34%; }
.matrix-table td { padding: 8px 15px; text-align: center; border-bottom: 1px solid #f4f0e9; color: var(--text-2); }
.matrix-table td:first-child { text-align: left; padding-left: 21px; }
.matrix-table tr:last-child td { border-bottom: 0; }
.matrix-group-row td {
  padding: 7px 21px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9e978b;
  background: #faf7f1;
}
.matrix-check {
  display: inline-grid;
  place-items: center;
  width: 17px;
  height: 17px;
  color: #2f916a;
  background: #edf7f2;
  border-radius: 50%;
}
.matrix-dash { color: #d0cabf; }
.matrix-table .is-current { background: rgba(239, 106, 43, 0.035); }

/* ---------- Audit ---------- */
.audit-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.audit-stat {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 11px;
  font-size: 12.5px;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.audit-stat strong { font-weight: 500; color: #282d2e; font-variant-numeric: tabular-nums; }
.audit-stat .legend-dot { width: 5px; height: 5px; }
.audit-actor { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.audit-actor-copy { display: flex; flex-direction: column; gap: 2px; }
.audit-actor-copy strong { font-size: 13.5px; font-weight: 400; color: #34393a; }
.audit-actor-copy span { font-size: 11.5px; color: var(--text-3); }
.audit-time { font-variant-numeric: tabular-nums; white-space: nowrap; color: #6f6b63; font-size: 13px; }
.audit-summary-cell { max-width: 330px; font-size: 13px; line-height: 1.55; color: #62615c; }
.audit-summary-cell strong { font-weight: 500; color: #333839; }
.audit-detail-row td { padding: 0 21px 16px !important; background: #fcfaf6; border-bottom: 1px solid #f0ece4 !important; }
.audit-diff { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 2px; }
.diff-panel { padding: 11px 13px; background: #fff; border: 1px solid #ece7de; border-radius: 9px; }
.diff-panel-title { margin-bottom: 6px; font-size: 11.5px; font-weight: 500; letter-spacing: 0.08em; color: #a49e93; text-transform: uppercase; }
.diff-row { display: flex; justify-content: space-between; gap: 14px; padding: 4px 0; font-size: 12px; border-bottom: 1px solid #f6f2eb; }
.diff-row:last-child { border-bottom: 0; }
.diff-row span { color: #989288; }
.diff-row strong { font-weight: 400; color: #4b4f50; text-align: right; word-break: break-all; }
.diff-empty { padding: 9px 0; font-size: 12px; color: #b3ada2; }
.audit-detail-meta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 9px; font-size: 11.5px; color: #a9a297; }
.audit-detail-meta strong { font-weight: 400; color: #77736b; }
.action-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  font-size: 11.5px;
  font-weight: 500;
  color: #65625b;
  background: #f4f1ea;
  border-radius: 5px;
  white-space: nowrap;
}
.action-tag.is-create { color: #277254; background: #edf6f1; }
.action-tag.is-status { color: #956418; background: #faf3e4; }
.action-tag.is-danger { color: #a84339; background: #faeceb; }
.action-tag.is-login { color: #42678c; background: #eef3f7; }
.action-tag.is-plan { color: #755a35; background: #f6f1e8; }

/* ---------- Forms in modals ---------- */
.confirm-body { padding: 2px 0 4px; }
.confirm-detail {
  margin-top: 12px;
  padding: 11px 13px;
  font-size: 13px;
  line-height: 1.6;
  color: #77736b;
  background: #faf7f1;
  border: 1px solid #f0ebe2;
  border-radius: 9px;
}
.form-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 19px 0 10px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #9e978c;
}
.form-section-title::after { content: ""; flex: 1; height: 1px; background: #f0ebe3; }
.form-section-title:first-child { margin-top: 2px; }
.form-note {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #8a7b6c;
  background: #fdf7f1;
  border: 1px solid #f4e5d8;
  border-radius: 8px;
}
.form-note svg { flex: 0 0 auto; margin-top: 1px; color: #b67751; }
.plan-feature-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 8px; margin-top: 4px; }
.plan-feature-grid .checkbox { font-size: 13px; }
.permission-group { margin-top: 12px; }
.permission-group-title { margin-bottom: 7px; font-size: 11.5px; font-weight: 500; letter-spacing: 0.08em; color: #9b958a; text-transform: uppercase; }
.permission-group .plan-feature-grid { margin-top: 0; }

.credential-box {
  padding: 15px;
  background: linear-gradient(145deg, #fdf8f2, #faf5ed);
  border: 1px solid #efe4d5;
  border-radius: 11px;
}
.credential-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px dashed #e8ddcf; }
.credential-row:last-child { border-bottom: 0; }
.credential-row span { font-size: 12px; color: #9b8d7e; }
.credential-row strong { font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace); font-size: 14px; font-weight: 500; letter-spacing: 0.02em; color: #3e3b36; }
.credential-row button { font: inherit; font-size: 11.5px; color: #b26335; background: 0; border: 0; cursor: pointer; }

.impersonate-card {
  padding: 14px;
  background: #fff;
  border: 1px solid #ece7dd;
  border-radius: 11px;
}
.impersonate-card-head { display: flex; align-items: center; gap: 10px; }
.impersonate-card-head .avatar { --avatar-size: 34px; }
.impersonate-card-copy { min-width: 0; }
.impersonate-card-copy strong { display: block; font-size: 14px; font-weight: 500; color: #303536; }
.impersonate-card-copy span { display: block; margin-top: 2px; font-size: 12px; color: var(--text-3); }
.impersonate-token {
  margin-top: 11px;
  padding: 9px 10px;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 11.5px;
  line-height: 1.55;
  color: #77736a;
  word-break: break-all;
  background: #f8f5ef;
  border: 1px solid #eee8df;
  border-radius: 7px;
  user-select: all;
}

/* ---------- Toast tweaks ---------- */
.toast { border-radius: 10px; }
.toast-text { font-size: 14px; line-height: 1.5; }


/* ---------- Runtime component completion ---------- */
#tenantDrawerContent {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.drawer-head {
  position: relative;
  padding: 20px 24px 15px;
}
.drawer-head .eyebrow { margin-bottom: 5px; }
.drawer-title {
  margin: 0;
  font-size: 20.5px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: #202629;
}
.drawer-head .drawer-close {
  top: 17px;
  right: 18px;
  width: 30px;
  height: 30px;
  color: #686a64;
  background: #f3efe7;
  border: 1px solid #e9e3d8;
  backdrop-filter: none;
}
.drawer-head .drawer-close:hover { color: #252a2b; background: #ebe5da; }
.drawer-loading { display: flex; flex-direction: column; padding: 2px 0; }
.drawer-loading .skeleton { display: block; }

/* Avatar sizing honours the local token */
.avatar { width: var(--avatar-size, 38px); height: var(--avatar-size, 38px); }
.avatar-sm { --avatar-size: 28px; }
.avatar-lg { --avatar-size: 52px; }
.kpi-recent .avatar { font-size: 12px; }

/* KPI supporting bits */
.kpi-foot-note { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.kpi-card.is-dark .kpi-foot-note { color: #858a85; }
.kpi-recent {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: #aaa49a;
}
.kpi-recent .avatar-stack { margin-right: 1px; }
.kpi-recent .avatar { --avatar-size: 22px; font-size: 12px; }

/* Banner as a real button */
button.inline-banner {
  width: 100%;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.banner-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.banner-copy strong { font-size: 14px; }
.banner-copy span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.banner-action { display: inline-flex; align-items: center; gap: 3px; flex: 0 0 auto; font-size: 13px; font-weight: 500; color: #a44720; }

/* Buttons that are structurally cards */
button.rank-row,
button.legend-row {
  width: 100%;
  font: inherit;
  text-align: left;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}
button.legend-row { border-radius: 6px; }
button.legend-row:hover { background: #faf7f1; }

/* Toolbar controls */
.toolbar .input,
.toolbar .input-group .input {
  height: 34px;
  min-height: 34px;
  padding-top: 0;
  padding-bottom: 0;
  font-size: 13.5px;
}
.toolbar .input-group .input { padding-left: 30px; }
.toolbar .input-group .input-icon { left: 9px; }
.toolbar .toolbar-search { width: 250px; }

/* Audit expansion */
.audit-detail-row { display: none; }
.audit-detail-row.is-open { display: table-row; }
.audit-row.is-open > td { background: #fcfaf6; }
.audit-row.is-open > td:first-child { box-shadow: inset 2px 0 0 var(--brand); }
.audit-expand {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-left: auto;
  color: #9b958a;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.audit-expand:hover { color: #4d504d; background: #f4f0e8; }
.audit-expand svg { transition: transform 180ms ease; }
.audit-expand.is-rotated svg { transform: rotate(180deg); }
.table-link {
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: #6d5a45;
  text-decoration: underline;
  text-decoration-color: #d6c8b8;
  text-underline-offset: 3px;
  background: none;
  border: 0;
  cursor: pointer;
}
.table-link:hover { color: var(--brand-strong); text-decoration-color: var(--brand); }
.audit-ip { font-size: 11.5px; color: #9a958c; }

/* Confirm dialog */
.confirm-body { display: flex; align-items: flex-start; gap: 13px; }
.confirm-symbol {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  color: #a59d90;
  background: #f5f1e9;
  border: 1px solid #ece6da;
  border-radius: 11px;
}
.confirm-symbol.danger { color: #b54d42; background: #fbeeec; border-color: #f4dcd8; }
.confirm-symbol.primary { color: #a65b2f; background: #fdf2e8; border-color: #f4e2d2; }
.confirm-symbol.success { color: #2f8462; background: #edf7f2; border-color: #dcefe6; }
.confirm-copy { flex: 1; min-width: 0; }
.confirm-message {
  margin: 0;
  font-size: 15px;
  font-weight: 400;
  line-height: 1.65;
  color: #353a3b;
}
.confirm-copy .confirm-detail { margin-top: 8px; }
.confirm-copy .confirm-detail:empty { display: none; }

/* Tenant profile dark badge treatment */
.tenant-profile .badge {
  padding: 2px 6px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid transparent;
}
.tenant-profile .badge-active { color: #9ed8bd; background: rgba(59, 151, 112, 0.16); border-color: rgba(107, 191, 153, 0.22); }
.tenant-profile .badge-trial { color: #eccb8d; background: rgba(197, 143, 52, 0.16); border-color: rgba(214, 171, 101, 0.2); }
.tenant-profile .badge-suspended { color: #e9a49a; background: rgba(190, 83, 70, 0.17); border-color: rgba(219, 126, 113, 0.19); }
.tenant-profile .badge-closed { color: #b9b8b0; background: rgba(150, 150, 142, 0.13); border-color: rgba(180, 180, 170, 0.14); }
.tenant-profile .badge-neutral { color: #c0beb6; background: rgba(160, 158, 150, 0.12); border-color: rgba(180, 178, 168, 0.14); }

/* Table loading */
.table-skeleton { padding: 8px 21px; }
.table-skeleton-row {
  display: flex;
  align-items: center;
  gap: 13px;
  height: 61px;
  border-bottom: 1px solid #f4f0e9;
}
.table-skeleton-row:last-child { border-bottom: 0; }
.table-skeleton-row .skeleton { display: block; height: 9px; border-radius: 5px; }
.table-skeleton-row .skeleton:first-child { height: 30px; width: 30px !important; border-radius: 9px; }

@media (max-width: 760px) {
  .kpi-recent { display: none; }
  .toolbar .toolbar-search { width: 100%; }
  .banner-copy span { white-space: normal; }
  .confirm-body { align-items: flex-start; }
  .audit-diff { grid-template-columns: 1fr; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1320px) {
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar-meta { display: none; }
}
@media (max-width: 1180px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    transform: translateX(-100%);
    transition: transform 260ms cubic-bezier(0.22, 0.8, 0.3, 1);
    box-shadow: 24px 0 60px -30px rgba(8, 12, 13, 0.7);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-scrim.is-open { display: block; }
  .mobile-menu { display: inline-grid; }
  .global-search { width: 250px; }
  .span-7, .span-5 { grid-column: span 6; }
  .span-8, .span-4 { grid-column: span 12; }
  .status-body { max-width: 560px; }
  .plan-grid { grid-template-columns: repeat(3, minmax(240px, 1fr)); overflow-x: auto; padding-bottom: 4px; }
}
@media (max-width: 980px) {
  .page-head { align-items: flex-start; flex-direction: column; gap: 16px; }
  .page-actions { padding-bottom: 0; }
  .span-7, .span-5, .span-6 { grid-column: span 12; }
  .plan-grid { grid-template-columns: 1fr; overflow: visible; }
  .plan-card { min-height: auto; }
  .plan-features { min-height: 0; }
  .rank-row { grid-template-columns: 22px 32px minmax(0, 1fr) 80px 60px; }
  .audit-diff { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .topbar { padding: 0 15px; height: 60px; }
  .breadcrumb-root, .breadcrumb-sep { display: none; }
  .global-search { display: none; }
  .view { padding: 20px 15px 30px; }
  .app-footer { padding: 0 15px 18px; }
  .page-title { font-size: 31.5px; }
  .page-sub { font-size: 14.5px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .kpi-card { min-height: 132px; padding: 14px; }
  .kpi-value { font-size: 25.5px; }
  .kpi-spark { display: none; }
  .toolbar-card { padding: 8px; }
  .toolbar { gap: 7px; }
  .toolbar .input-group { width: 100%; }
  .toolbar .select { flex: 1; }
  .filter-tabs { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 2px; }
  .filter-tab { white-space: nowrap; }
  .toolbar-sep { display: none; }
  .result-summary { margin-left: auto; }
  .pagination { flex-direction: column; align-items: flex-start; gap: 10px; padding: 11px 15px; }
  .status-body { gap: 14px; }
  .donut-wrap { width: 112px; height: 112px; flex-basis: 112px; }
  .donut-hole { inset: 15px; }
  .donut-hole strong { font-size: 24.5px; }
  .chart-wrap { padding: 0 4px 8px; }
  .chart-tooltip { display: none; }
  .rank-row { grid-template-columns: 20px 30px minmax(0, 1fr) 74px; }
  .rank-orders { display: none; }
  .drawer-body { padding: 14px 15px 26px; }
  .quick-grid { gap: 5px; }
  .info-cell { padding: 10px 11px; }
  .tenant-profile { padding: 16px; }
  .tenant-profile-name { font-size: 18.5px; }
  .plan-limits { grid-template-columns: repeat(4, 1fr); }
  .app-footer { flex-wrap: wrap; gap: 6px 8px; }
  .app-footer .grow { display: none; }
  #dataUpdatedAt { width: 100%; }
  .page-loading-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi-card { min-height: 124px; }
  .kpi-spark { display: block; }
  .page-actions { width: 100%; flex-wrap: wrap; }
  .page-actions .btn { flex: 1; }
  .topbar-right { gap: 3px; }
  .status-body { flex-direction: column; align-items: flex-start; }
  .status-body .donut-wrap { align-self: center; }
  .status-legend { width: 100%; }
  .quick-grid { grid-template-columns: repeat(2, 1fr); }
  .tenant-profile-stats { grid-template-columns: 1fr 1fr 1fr; }
}

/* ==========================================================================
   Readability pass + richer plan & entitlement workspace
   ========================================================================== */

/* Larger breathing room after the type scale increase */
.topbar { height: 72px; }
.nav-item { height: 46px; }
.global-search { width: 312px; height: 40px; }
.global-search input { font-size: 15px; }
.global-search kbd { font-size: 11.5px; }
.topbar-meta { font-size: 13px; }
.icon-btn.topbar-action { width: 38px; height: 38px; }
.data-table { min-width: 1020px; }
.data-table thead th { height: 46px; font-size: 12.5px; letter-spacing: 0.04em; }
.data-table tbody td { height: 70px; }
.table-tenant-name { font-size: 15px; }
.table-tenant-meta,
.table-contact span,
.table-usage-text,
.table-money span,
.table-expiry span { font-size: 12px; }
.table-money strong { font-size: 14.5px; }
.table-expiry strong { font-size: 13px; }
.table-action { width: 31px; height: 31px; }
.pagination-info { font-size: 13px; }
.pager button { min-width: 30px; height: 30px; font-size: 13px; }
.card-title { font-size: 17px; }
.card-sub { font-size: 13px; }
.card-link { font-size: 13px; }
.eyebrow { font-size: 12.5px; }
.page-sub { font-size: 15px; }
.page-head { margin-bottom: 24px; }
.inline-banner { font-size: 14px; padding: 14px 17px; }
.inline-banner button { font-size: 13px; }

/* Plan page summary */
.plan-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 18px;
}
.plan-metric {
  min-height: 124px;
  padding: 18px 19px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: var(--shadow-xs);
}
.plan-metric.is-accent {
  color: #f3eee4;
  background:
    radial-gradient(240px 170px at 100% -10%, rgba(239, 106, 43, 0.25), transparent 68%),
    linear-gradient(147deg, #1c282c, #121b1f);
  border-color: #1c282c;
}
.plan-metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
}
.plan-metric.is-accent .plan-metric-top { color: #c0beb6; }
.plan-metric-icon {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  color: #9a6a4d;
  background: var(--brand-tint);
  border-radius: 8px;
}
.plan-metric.is-accent .plan-metric-icon { color: #f0a77f; background: rgba(255, 255, 255, 0.07); }
.plan-metric-value {
  margin-top: 10px;
  font-size: 31px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: #1e2426;
}
.plan-metric.is-accent .plan-metric-value { color: #faf5eb; }
.plan-metric-value small { margin-left: 5px; font-size: 14px; font-weight: 400; letter-spacing: 0; color: #99958c; }
.plan-metric.is-accent .plan-metric-value small { color: #8f948e; }
.plan-metric-foot { margin-top: 9px; font-size: 12.5px; color: var(--text-3); }
.plan-metric.is-accent .plan-metric-foot { color: #929791; }

/* Plan cards */
.plan-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.plan-card { padding: 22px 21px 17px; border-radius: 17px; }
.plan-card-top { min-height: 51px; }
.plan-name-row { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.plan-name { font-size: 20px; }
.plan-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: 99px;
  white-space: nowrap;
}
.plan-status i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.plan-status.is-on { color: #267355; background: #edf7f1; }
.plan-status.is-off { color: #8a7566; background: #f5efe8; }
.plan-card.is-featured .plan-status.is-on { color: #9ee0c2; background: rgba(73, 177, 132, 0.13); }
.plan-code { margin-top: 5px; font-size: 12px; letter-spacing: 0.06em; }
.plan-desc { min-height: 44px; margin: 12px 0 14px; font-size: 13.5px; line-height: 1.55; }
.plan-price { flex-wrap: wrap; }
.plan-price .price-amount { font-size: 39.5px; }
.plan-price .price-currency { font-size: 16px; }
.plan-price .price-period { font-size: 13px; }
.plan-price .plan-monthly {
  width: 100%;
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--text-3);
}
.plan-card.is-featured .plan-price .plan-monthly { color: #919892; }
.plan-limits { margin: 14px 0 4px; padding: 12px 0; }
.plan-limit-value { font-size: 15px; }
.plan-limit-label { font-size: 12px; }
.plan-feature-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--text-3);
}
.plan-feature-head span:last-child { font-variant-numeric: tabular-nums; }
.plan-card.is-featured .plan-feature-head { color: #858d87; }
.plan-features { min-height: 136px; gap: 7px; padding: 9px 0 10px; }
.plan-feature { font-size: 13px; }
.plan-usage-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding: 12px 0;
  border-top: 1px solid #f1ece4;
  font-size: 12.5px;
  color: var(--text-3);
}
.plan-card.is-featured .plan-usage-line { border-color: rgba(255, 255, 255, 0.08); color: #9a9e98; }
.plan-usage-copy strong { font-weight: 500; color: var(--text-2); }
.plan-card.is-featured .plan-usage-copy strong { color: #e9e4da; }
.plan-paying { margin-left: 6px; padding-left: 7px; border-left: 1px solid var(--line); }
.plan-card.is-featured .plan-paying { border-color: rgba(255, 255, 255, 0.15); }
.plan-mrr { font-size: 14px; font-weight: 500; color: #444b4c; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan-mrr small { margin-left: 2px; font-size: 11.5px; font-weight: 400; color: var(--text-3); }
.plan-card.is-featured .plan-mrr { color: #ede7dc; }
.plan-card.is-featured .plan-mrr small { color: #8c928c; }
.plan-foot { padding-top: 13px; }
.plan-detail-link {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.plan-detail-link:hover { color: var(--brand-strong); }
.plan-card.is-featured .plan-detail-link { color: #d6d1c7; }
.plan-card.is-featured .plan-detail-link:hover { color: #f2a77e; }
.plan-foot .btn { min-height: 36px; font-size: 13px; }

.matrix-table { font-size: 13px; }
.matrix-table th { padding: 11px 15px; font-size: 12.5px; }
.matrix-table td { padding: 10px 15px; }
.matrix-table th:first-child { width: 30%; }
.matrix-plan-name { display: block; font-size: 14px; color: #33383a; }
.matrix-plan-sub { display: block; margin-top: 4px; font-family: var(--font-mono); font-size: 11.5px; font-weight: 400; color: var(--text-3); letter-spacing: 0.03em; }
.matrix-table th.is-featured-plan { background: #fbf5ee; }
.matrix-value-row td { font-size: 13px; color: #4e534f; }
.matrix-value-row td strong { font-weight: 500; color: #262c2d; }
.matrix-muted { color: var(--text-3); font-size: 11.5px; }
.matrix-table td.is-current { background: rgba(239, 106, 43, 0.035); }
.matrix-group-row td { font-size: 11.5px; padding: 8px 21px; }
.matrix-check { width: 19px; height: 19px; }

/* Plan detail drawer */
.plan-drawer { width: min(650px, 100%); }
#planDrawerContent { flex: 1; min-height: 0; overflow-y: auto; }
.plan-drawer-body { padding-top: 18px; }
.plan-detail-hero {
  position: relative;
  overflow: hidden;
  padding: 19px 20px 17px;
  color: #eee9df;
  background:
    radial-gradient(300px 180px at 100% -20%, rgba(239, 106, 43, 0.28), transparent 68%),
    linear-gradient(145deg, #1b262a, #111a1e);
  border-radius: 16px;
}
.plan-detail-hero::after {
  content: "";
  position: absolute;
  right: -44px;
  bottom: -75px;
  width: 190px;
  height: 190px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
  pointer-events: none;
}
.plan-detail-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.plan-detail-kicker { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: 0.1em; color: #979d96; }
.plan-detail-status { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; font-size: 11.5px; border-radius: 99px; }
.plan-detail-status i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.plan-detail-status.is-on { color: #a6e4c4; background: rgba(76, 178, 133, 0.15); }
.plan-detail-status.is-off { color: #d8b59b; background: rgba(210, 150, 106, 0.14); }
.plan-detail-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-top: 13px; }
.plan-detail-title-row h3 { margin: 0; font-size: 27px; font-weight: 500; letter-spacing: -0.02em; color: #faf6ed; }
.plan-detail-title-row p { max-width: 360px; margin: 7px 0 0; font-size: 12.5px; line-height: 1.55; color: #9aa09a; }
.plan-detail-price { flex: 0 0 auto; text-align: right; }
.plan-detail-price span { display: block; font-size: 11.5px; letter-spacing: 0.06em; color: #8b928c; }
.plan-detail-price strong { display: block; margin-top: 2px; font-size: 28px; font-weight: 500; letter-spacing: -0.04em; color: #f8f2e7; font-variant-numeric: tabular-nums; }
.plan-detail-price em { display: block; margin-top: 2px; font-style: normal; font-size: 11.5px; color: #939a94; }
.plan-detail-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: 19px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, 0.09); }
.plan-detail-stats > div { padding-left: 15px; border-left: 1px solid rgba(255, 255, 255, 0.08); }
.plan-detail-stats > div:first-child { padding-left: 0; border-left: 0; }
.plan-detail-stats span { display: block; font-size: 11.5px; color: #8d948e; }
.plan-detail-stats strong { display: block; margin-top: 4px; font-size: 19px; font-weight: 500; color: #f2ede3; font-variant-numeric: tabular-nums; }
.plan-detail-stats strong small { margin-left: 2px; font-size: 11.5px; font-weight: 400; color: #8d938e; }
.plan-quick-grid { margin: 14px 0 20px; }
.plan-quick-grid .quick-action { min-height: 76px; font-size: 12.5px; gap: 7px; }
.plan-quick-grid .quick-action svg { width: 18px; height: 18px; }
.plan-spec-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; overflow: hidden; background: #ece7dd; border: 1px solid #ece7dd; border-radius: 12px; }
.plan-spec-grid > div { padding: 13px 14px; background: #fff; }
.plan-spec-grid span { display: block; font-size: 12px; color: var(--text-3); }
.plan-spec-grid strong { display: block; margin-top: 5px; font-size: 16px; font-weight: 500; color: #33393a; font-variant-numeric: tabular-nums; }
.plan-spec-grid small { margin-left: 2px; font-size: 11.5px; font-weight: 400; color: var(--text-3); }
.plan-entitlements { display: flex; flex-direction: column; overflow: hidden; background: #fff; border: 1px solid #ece7de; border-radius: 12px; }
.plan-entitlement-group { padding: 12px 14px; border-bottom: 1px solid #f2eee7; }
.plan-entitlement-group:last-child { border-bottom: 0; }
.plan-entitlement-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.plan-entitlement-head strong { font-size: 13.5px; font-weight: 500; color: #343a3b; }
.plan-entitlement-head span { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.plan-entitlement-list { display: flex; flex-wrap: wrap; gap: 6px; }
.plan-entitlement { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px 3px 6px; font-size: 12px; border-radius: 6px; }
.plan-entitlement.is-on { color: #277255; background: #edf7f1; }
.plan-entitlement.is-off { color: #a29b90; background: #f7f4ee; text-decoration: line-through; text-decoration-color: #d3cdc2; }
.plan-tenant-list { display: flex; flex-direction: column; overflow: hidden; background: #fff; border: 1px solid #ece7de; border-radius: 12px; }
.plan-tenant-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 11px 13px; text-align: left; background: transparent; border: 0; border-bottom: 1px solid #f2eee7; cursor: pointer; }
.plan-tenant-row:last-child { border-bottom: 0; }
.plan-tenant-row:hover { background: #fbf8f3; }
.plan-tenant-copy { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; }
.plan-tenant-copy strong { font-size: 13.5px; font-weight: 500; color: #343a3b; }
.plan-tenant-copy span { font-size: 11.5px; color: var(--text-3); }
.plan-tenant-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex: 0 0 auto; }
.plan-tenant-side em { font-style: normal; font-size: 12px; color: var(--text-3); white-space: nowrap; }
.plan-empty-inline { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 24px 14px; font-size: 13px; color: var(--text-3); background: #fff; border: 1px dashed var(--line-strong); border-radius: 12px; }

/* Plan form */
.plan-form .form-section-title:first-child { margin-top: 0; }
.plan-form .plan-limit-grid .field-hint { display: none; }
.plan-permission-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.plan-selected-count { font-size: 12.5px; font-weight: 400; color: var(--text-3); }
.plan-selected-count strong { color: var(--brand-strong); font-weight: 500; }
.feature-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 8px 0 11px; font-size: 12.5px; color: var(--text-3); }
.feature-toolbar > div { display: flex; align-items: center; gap: 14px; }
.text-action { padding: 0; font: inherit; font-size: 12.5px; font-weight: 500; color: var(--brand-strong); background: transparent; border: 0; cursor: pointer; }
.text-action:hover { text-decoration: underline; }
.permission-groups { display: flex; flex-direction: column; gap: 0; border: 1px solid #ece7de; border-radius: 12px; overflow: hidden; }
.permission-groups .permission-group { padding: 12px 14px; border-bottom: 1px solid #f2eee7; }
.permission-groups .permission-group:last-child { border-bottom: 0; }
.permission-groups .permission-group-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; font-size: 12.5px; }
.permission-groups .permission-group-title span:last-child { font-size: 11.5px; color: var(--text-3); }
.permission-groups .plan-feature-grid { gap: 8px 18px; }
.permission-groups .plan-feature-grid .checkbox { font-size: 13px; padding: 3px 0; }
.permission-groups .checkbox .box { width: 19px; height: 19px; flex: 0 0 19px; }

/* Responsive additions */
@media (max-width: 1320px) {
  .plan-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1180px) {
  .plan-detail-stats { grid-template-columns: repeat(2, 1fr); gap: 12px 0; }
  .plan-detail-stats > div:nth-child(3) { padding-left: 0; border-left: 0; }
}
@media (max-width: 980px) {
  .plan-grid { grid-template-columns: 1fr; }
  .plan-features { min-height: 0; }
  .plan-detail-title-row { align-items: flex-start; flex-direction: column; gap: 12px; }
  .plan-detail-price { text-align: left; }
}
@media (max-width: 720px) {
  .plan-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .plan-metric { min-height: 108px; padding: 14px; }
  .plan-metric-value { font-size: 28px; }
  .plan-quick-grid { grid-template-columns: repeat(2, 1fr); }
  .plan-spec-grid { grid-template-columns: repeat(2, 1fr); }
  .plan-detail-stats { grid-template-columns: repeat(2, 1fr); }
  .feature-toolbar { align-items: flex-start; flex-direction: column; gap: 7px; }
  .plan-tenant-row { align-items: flex-start; }
  .plan-tenant-side { padding-top: 2px; }
  .matrix-table { font-size: 12px; }
  .matrix-table th, .matrix-table td { padding-left: 10px; padding-right: 10px; }
}

/* Plan editor tabs + guard note */
.plan-form-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 22px;
  padding: 4px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 11px;
}
.plan-form-tab {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-2);
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}
.plan-form-tab:hover { color: var(--text); }
.plan-form-tab.is-active {
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.plan-form-tab em {
  font-style: normal;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.plan-form-tab.is-active em { color: var(--brand-strong); }
.plan-form-panel[hidden] { display: none; }
.plan-form-panel .form-section-title:first-child { margin-top: 0; }
.plan-guard-note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 10px;
  padding: 10px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  color: #7f6a51;
  background: #fbf5ec;
  border: 1px solid #eee2d1;
  border-radius: 9px;
}
.plan-guard-note svg { flex: 0 0 auto; margin-top: 1px; }
@media (max-width: 720px) {
  .plan-form-tabs { margin-bottom: 18px; }
  .plan-form-tab { font-size: 13px; padding: 9px 7px; }
  .plan-form-tab em { font-size: 11.5px; }
}

/* The plan editor has two dense tabs; give it more vertical room than a normal modal. */
.modal-plan-editor {
  width: min(820px, 100%);
  max-height: min(94vh, 980px);
}
.modal-plan-editor .modal-body { scrollbar-width: thin; }
.modal-plan-editor .modal-body::-webkit-scrollbar { width: 8px; }
.modal-plan-editor .modal-body::-webkit-scrollbar-thumb { background: #d8d2c7; border-radius: 99px; }
