/* ============================================================================
   Refined UI · light SaaS reference theme
   Loaded after styles.css. Keeps all existing component markup working while
   re-skinning the shell, cards, metrics, tables, forms and switches.
   ============================================================================ */

:root {
  color-scheme: light;
  --ui-bg: #f5f7fb;
  --ui-bg-soft: #f8fafd;
  --ui-surface: #ffffff;
  --ui-surface-strong: #ffffff;
  --ui-surface-solid: #ffffff;
  --ui-surface-soft: #f5f8fc;
  --ui-surface-hover: #f2f6fc;
  --ui-border: #e9eef6;
  --ui-border-strong: #dce4ef;
  --glass-highlight: transparent;

  --ui-ink: #1f2937;
  --ui-ink-2: #374151;
  --ui-muted: #6b7280;
  --ui-subtle: #9aa4b2;

  --ui-primary: #2f7cf6;
  --ui-primary-hover: #1f6fe8;
  --ui-primary-soft: #eaf2ff;
  --ui-primary-border: #cfe0ff;

  --ui-amber: #f59e0b;
  --ui-amber-soft: #fff6e6;
  --ui-amber-border: #fde7bd;

  --ui-blue: #2f7cf6;
  --ui-blue-soft: #eaf2ff;

  --ui-violet: #7c5cff;
  --ui-violet-soft: #f0edff;

  --ui-danger: #ef5b6b;
  --ui-danger-hover: #e24657;
  --ui-danger-soft: #fff0f2;

  --ui-radius-card: 14px;
  --ui-radius-md: 10px;
  --ui-radius-ctl: 8px;

  --ui-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.03), 0 8px 22px rgba(15, 23, 42, 0.035);
  --ui-shadow-md: 0 12px 30px rgba(15, 23, 42, 0.07);
  --ui-shadow-lg: 0 22px 54px rgba(15, 23, 42, 0.12);

  --ui-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --ui-mono: "SFMono-Regular", Consolas, "Cascadia Mono", monospace;

  --fw-500: 500;
  --fw-600: 600;
  --fw-700: 700;

  --sidebar-bg: #ffffff;
  --topbar-bg: #ffffff;
  --table-head: #f8fafc;
  --select-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

/* Keep the product light like the reference even if the old theme switch was used. */
.dark {
  color-scheme: light;
  --ui-bg: #f5f7fb;
  --ui-bg-soft: #f8fafd;
  --ui-surface: #ffffff;
  --ui-surface-strong: #ffffff;
  --ui-surface-solid: #ffffff;
  --ui-surface-soft: #f5f8fc;
  --ui-surface-hover: #f2f6fc;
  --ui-border: #e9eef6;
  --ui-border-strong: #dce4ef;
  --ui-ink: #1f2937;
  --ui-ink-2: #374151;
  --ui-muted: #6b7280;
  --ui-subtle: #9aa4b2;
  --ui-primary: #2f7cf6;
  --ui-primary-hover: #1f6fe8;
  --ui-primary-soft: #eaf2ff;
  --ui-primary-border: #cfe0ff;
  --ui-amber: #f59e0b;
  --ui-amber-soft: #fff6e6;
  --ui-amber-border: #fde7bd;
  --ui-blue: #2f7cf6;
  --ui-blue-soft: #eaf2ff;
  --ui-violet: #7c5cff;
  --ui-violet-soft: #f0edff;
  --ui-danger: #ef5b6b;
  --ui-danger-soft: #fff0f2;
  --sidebar-bg: #ffffff;
  --topbar-bg: #ffffff;
  --table-head: #f8fafc;
}

html, body {
  background: var(--ui-bg);
  color: var(--ui-ink);
  font-size: 13px;
}

.ambient-bg { display: none !important; }

/* -------------------------------------------------------------------------- */
/* Shell                                                                      */
/* -------------------------------------------------------------------------- */

.app-shell { background: var(--ui-bg); }

.sidebar {
  width: 192px;
  padding: 12px 10px 10px;
  background: #fff;
  border-right: 1px solid var(--ui-border);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.sidebar-brand {
  padding: 2px 6px 12px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--ui-border);
}
.brand-logo.sm { width: 30px; height: 30px; filter: none; }
.brand-title { font-size: 12.5px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-sub { font-size: 10px; color: var(--ui-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#btn-theme-toggle { display: none !important; }

.sidebar-account { margin-bottom: 10px; }
.account-trigger {
  padding: 7px 9px;
  border-radius: 9px;
  border: 1px solid var(--ui-border);
  background: #fff;
  box-shadow: none;
}
.account-trigger:hover { background: #f8fafc; box-shadow: none; }
.account-trigger__avatar { width: 30px; height: 30px; border-radius: 8px; background: #eaf2ff; color: #2f7cf6; }
.account-trigger__avatar img { border-radius: 8px; }
.account-trigger__name { font-size: 12px; }
.account-trigger__meta { font-size: 10px; }
.account-flyout { border-color: var(--ui-border); box-shadow: var(--ui-shadow-md); }

.nav-list { gap: 2px; }
.nav-group-label {
  padding: 10px 9px 4px;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #a4adba;
}
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item {
  min-height: 36px;
  padding: 7px 9px;
  gap: 9px;
  border-radius: 8px;
  font-size: 12.5px;
  color: #5b6675;
}
.nav-item:hover { background: #f5f8fc; color: #1f2937; }
.nav-item.active {
  background: #2f7cf6;
  color: #fff;
  box-shadow: 0 6px 14px rgba(47, 124, 246, 0.22);
}
.nav-item.active .nav-icon { color: #fff; opacity: 1; }
.nav-icon { width: 15px; height: 15px; opacity: 0.72; }
.nav-badge { background: #ef5b6b; font-size: 10px; }

.sidebar-foot { border-top: 1px solid var(--ui-border); padding-top: 10px; }
.sidebar-user {
  padding: 8px 9px;
  border-radius: 9px;
  background: #f8fafc;
  border: 1px solid var(--ui-border);
}
.sidebar-user__avatar { width: 26px; height: 26px; border-radius: 8px; background: #eaf2ff; color: #2f7cf6; font-size: 11px; }
.sidebar-user__info strong { font-size: 11.5px; }
.sidebar-user__info span { font-size: 10px; }
.quota-chip { background: #eaf2ff; color: #2f7cf6; font-size: 10px; }
.token-field { margin-top: 8px; padding: 7px 8px; border-radius: 8px; background: #f8fafc; border: 1px solid var(--ui-border); }
.token-field__label { font-size: 9px; }
.token-field__value { font-size: 10px; color: #64748b; }
.sse-pill { font-size: 10px; padding: 3px 8px; background: #f3fbf6; color: #15803d; border: 1px solid #dcfce7; }
.sidebar-status-row { margin-top: 8px; }
.ghost-link { font-size: 10.5px; }

.main-area { background: var(--ui-bg); }

.topbar {
  min-height: 58px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--ui-border);
  box-shadow: none;
  backdrop-filter: blur(10px);
  flex-wrap: nowrap;
}
.topbar-left { min-width: 0; flex: 1 1 auto; }
.topbar-right { flex-shrink: 0; }
.page-heading { gap: 8px; align-items: center; min-width: 0; }
.page-heading__title { font-size: 14px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.page-heading__sub { display: none; }
.topbar-meta { gap: 6px; }
.topbar-actions { gap: 6px; }
.rtt-tag { font-size: 10px; padding: 2px 7px; background: #f8fafc; border-color: var(--ui-border); }

.content {
  max-width: 1280px;
  padding: 20px 24px 44px;
  gap: 14px;
}

/* -------------------------------------------------------------------------- */
/* Page intro                                                                 */
/* -------------------------------------------------------------------------- */

.page-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 2px 2px 10px;
  margin-bottom: 0;
  flex-wrap: wrap;
}
.page-intro > div:first-child { min-width: 0; flex: 1 1 520px; }
.page-intro h1 { overflow-wrap: anywhere; }
.page-intro__kicker {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #2f7cf6;
  margin-bottom: 5px;
}
.page-intro h1 {
  margin: 0;
  font-size: 27px;
  line-height: 1.15;
  letter-spacing: -0.035em;
  font-weight: 750;
  color: #111827;
}
.page-intro__desc {
  margin: 6px 0 0;
  max-width: 720px;
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--ui-muted);
}
.page-intro__meta { display: flex; align-items: center; justify-content: flex-end; gap: 6px; flex-wrap: wrap; padding-top: 2px; max-width: 100%; }
.page-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid var(--ui-border);
  background: #fff;
  color: #64748b;
  font-size: 10.5px;
  white-space: nowrap;
}
.page-meta-chip strong { color: #111827; font-weight: 600; }
.page-meta-chip .dot {
  width: 6px; height: 6px; border-radius: 999px; background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.12);
}
.page-meta-chip.task { border-color: #cfe0ff; background: #f5f9ff; color: #2f7cf6; }
.page-meta-chip.task strong { color: #1f6fe8; }

/* -------------------------------------------------------------------------- */
/* Cards & sections                                                           */
/* -------------------------------------------------------------------------- */

.glass-card,
.card {
  background: #fff;
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius-card);
  box-shadow: var(--ui-shadow-sm);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.card { padding: 18px; }
.card-head { margin-bottom: 12px; }
.card-title { font-size: 13.5px; font-weight: 700; color: #111827; gap: 7px; }
.card-sub { font-size: 10.5px; color: var(--ui-muted); }
.section-label {
  font-size: 11px;
  font-weight: 650;
  color: #374151;
  letter-spacing: 0.01em;
  padding-top: 6px;
}

/* Metric strip used by restaurant / staff / reference-style pages */
.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.metric-card {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 15px;
  min-height: 78px;
  background: #fff;
  border: 1px solid var(--ui-border);
  border-radius: 12px;
  box-shadow: var(--ui-shadow-sm);
}
.metric-card__icon {
  width: 34px; height: 34px; border-radius: 9px;
  display: grid; place-items: center; flex-shrink: 0;
  background: #eaf2ff; color: #2f7cf6;
}
.metric-card__icon.green { background: #e9fbf2; color: #16a36a; }
.metric-card__icon.red { background: #fff0f2; color: #ef5b6b; }
.metric-card__icon.amber { background: #fff6e6; color: #d97706; }
.metric-card__icon.violet { background: #f0edff; color: #7c5cff; }
.metric-card > div:last-child { min-width: 0; }
.metric-card__label { font-size: 10px; color: #8b95a5; line-height: 1.4; }
.metric-card__value { overflow-wrap: anywhere; }
.metric-card__value { margin-top: 3px; font-size: 18px; line-height: 1.15; font-weight: 700; color: #111827; letter-spacing: -0.02em; }
.metric-card__sub { margin-top: 4px; font-size: 9.5px; color: #94a3b8; line-height: 1.4; }

/* Overview bento */
.overview-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.ov-card { padding: 16px; }
.ov-tiles { gap: 10px; }
.ov-tile {
  padding: 13px 14px;
  border-radius: 11px;
  border: 1px solid var(--ui-border);
  background: #fff;
  box-shadow: none;
}
.ov-tile__label { font-size: 9.5px; color: #8b95a5; letter-spacing: 0.02em; }
.ov-tile__value { font-size: 19px; font-weight: 700; color: #111827; margin-top: 5px; }
.ov-tile__sub { font-size: 9.5px; color: #94a3b8; }
.ov-account { background: linear-gradient(135deg, #ffffff 0%, #f7faff 100%); }
.ov-avatar { width: 42px; height: 42px; border-radius: 12px; background: #eaf2ff; color: #2f7cf6; }
.ov-avatar img { border-radius: 12px; }
.ov-account__name { font-size: 15px; }

.quick-dock { padding: 10px 12px; border-radius: 12px; }
.quick-dock__group { gap: 6px; flex-wrap: wrap; }

.dash-workspace { grid-template-columns: minmax(0, 1fr) 320px; gap: 12px; }
.dash-rail { gap: 12px; }
.log-card { padding: 0; overflow: hidden; }
.log-toolbar { padding: 13px 16px; border-bottom: 1px solid var(--ui-border); margin: 0; }
.log-list { padding: 10px 12px; }

/* -------------------------------------------------------------------------- */
/* Buttons, pills, chips, tabs                                                */
/* -------------------------------------------------------------------------- */

.btn {
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  box-shadow: none;
}
.btn-sm { min-height: 28px; padding: 5px 10px; font-size: 11px; }
.btn-xs { min-height: 23px; padding: 3px 8px; font-size: 10px; border-radius: 6px; }
.btn-lg { min-height: 40px; font-size: 13px; }
.btn-primary { background: #2f7cf6; color: #fff; box-shadow: 0 6px 14px rgba(47, 124, 246, 0.18); }
.btn-primary:hover:not(:disabled) { background: #1f6fe8; }
.btn-soft { background: #fff; border-color: var(--ui-border-strong); color: #374151; }
.btn-soft:hover:not(:disabled) { background: #f8fafc; border-color: #c9d5e5; }
.btn-tint-primary { background: #eaf2ff; color: #2f7cf6; border-color: #d5e4ff; }
.btn-danger-soft { background: #fff0f2; color: #e24657; border-color: #ffd9de; }
.btn-tint-amber { background: #fff6e6; color: #b45309; border-color: #fde7bd; }
.btn-ghost { background: transparent; color: #64748b; }
.btn:disabled { opacity: 0.45; box-shadow: none; }

.status-pill {
  min-height: 20px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 600;
  border: 1px solid transparent;
  background: #f3f4f6;
  color: #64748b;
}
.status-pill.running, .status-pill.ok { background: #e9fbf2; color: #15803d; border-color: #d1fae5; }
.status-pill.stopped { background: #f3f4f6; color: #64748b; border-color: #e5e7eb; }
.status-pill.amber { background: #fff6e6; color: #b45309; border-color: #fde7bd; }
.status-pill.blue { background: #eaf2ff; color: #1f6fe8; border-color: #d5e4ff; }
.status-pill.gold-hi { background: #fff7e0; color: #a16207; border-color: #fde68a; }

.chip {
  min-height: 26px;
  padding: 4px 10px;
  border-radius: 7px;
  border: 1px solid var(--ui-border);
  background: #fff;
  font-size: 10.5px;
  color: #64748b;
}
.chip:hover { background: #f8fafc; }
.chip.active { background: #2f7cf6; color: #fff; border-color: #2f7cf6; }

.seg-tabs { background: #f3f6fb; border: 1px solid var(--ui-border); border-radius: 9px; padding: 3px; gap: 3px; }
.seg-tab { min-height: 30px; padding: 5px 11px; border-radius: 7px; font-size: 11px; color: #64748b; }
.seg-tab.active { background: #fff; color: #1f2937; box-shadow: 0 1px 4px rgba(15, 23, 42, 0.08); }
.seg-count { font-size: 9.5px; background: #eaf2ff; color: #2f7cf6; }

.view-toolbar { gap: 10px; padding: 2px 0; }

/* -------------------------------------------------------------------------- */
/* Forms                                                                      */
/* -------------------------------------------------------------------------- */

.form-grid { gap: 10px; }
.field { gap: 4px; font-size: 11.5px; }
.field > span { font-size: 10px; font-weight: 600; color: #7b8794; letter-spacing: 0.01em; }
.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field input[type="time"],
.field select,
.field textarea,
.select-ctl {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 7px;
  border: 1px solid var(--ui-border-strong);
  background: #fff;
  color: #1f2937;
  font-size: 11.5px;
  box-shadow: none;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: #2f7cf6;
  box-shadow: 0 0 0 3px rgba(47, 124, 246, 0.12);
  outline: none;
}
.field-hint { font-size: 10px; color: #94a3b8; }

.switch-row {
  padding: 11px 12px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--ui-border);
  gap: 12px;
}
.switch-row:hover { border-color: #cfdaea; background: #fbfdff; }
.switch-row strong { font-size: 11.5px; font-weight: 600; color: #1f2937; }
.switch-row small { font-size: 10px; color: #8b95a5; margin-top: 1px; }

.toggle { width: 36px; height: 20px; }
.toggle-track { background: #dbe3ee; border-radius: 999px; }
.toggle input:checked + .toggle-track { background: #2f7cf6; }
.toggle-track::after { width: 16px; height: 16px; top: 2px; left: 2px; }
.toggle input:checked + .toggle-track::after { transform: translateX(16px); }

/* -------------------------------------------------------------------------- */
/* Tables                                                                     */
/* -------------------------------------------------------------------------- */

.table-wrap { border: 1px solid var(--ui-border); border-radius: 10px; overflow: auto; background: #fff; }
table.table { width: 100%; border-collapse: collapse; font-size: 11px; }
.table thead th {
  position: sticky; top: 0; z-index: 1;
  padding: 9px 11px;
  background: #f8fafc;
  border-bottom: 1px solid var(--ui-border);
  font-size: 9.5px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #8b95a5;
  text-align: left;
}
.table tbody td { padding: 10px 11px; border-bottom: 1px solid #f1f4f9; color: #374151; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fbfdff; }
.table-sub { font-size: 9.5px; color: #94a3b8; }
.row-highlight { background: #f7fbff; }

/* -------------------------------------------------------------------------- */
/* Restaurant / cards                                                         */
/* -------------------------------------------------------------------------- */

.three-col { gap: 12px; }
.stove-card {
  padding: 13px;
  border-radius: 11px;
  border: 1px solid var(--ui-border);
  background: #fff;
  box-shadow: none;
}
.stove-card__art { border-radius: 9px; overflow: hidden; background: #f8fafc; }
.stove-card__name { font-size: 12.5px; font-weight: 650; }
.stove-card__qty strong { font-size: 19px; }
.cuisine-tag { background: #eaf2ff; color: #2f7cf6; border-color: #d5e4ff; font-size: 9.5px; }
.desk-tile { border: 1px solid var(--ui-border); border-radius: 10px; background: #fff; padding: 12px; }
.desk-tile.ready { border-color: #bbf7d0; background: #f7fef9; }
.desk-tile.eating { border-color: #dbeafe; background: #f8fbff; }
.desk-head { font-size: 11px; }
.desk-dish { font-size: 12px; font-weight: 600; }
.progress-track { height: 5px; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.progress-fill { background: #2f7cf6; border-radius: 999px; }
.progress-fill.danger { background: #ef5b6b; }

.role-card, .method-card, .hire-card {
  border: 1px solid var(--ui-border);
  border-radius: 11px;
  background: #fff;
  box-shadow: none;
  padding: 14px;
}
.role-card__badge { border-radius: 8px; }
.user-cell { gap: 9px; }
.user-cell img, .user-cell .avatar { border-radius: 8px; }

/* -------------------------------------------------------------------------- */
/* Banners & empty states                                                     */
/* -------------------------------------------------------------------------- */

.banner {
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 11px;
  border: 1px solid var(--ui-border);
  background: #f8fafc;
  color: #475569;
}
.banner.ok { background: #f3fbf6; border-color: #dcfce7; color: #15803d; }
.banner.err { background: #fff5f6; border-color: #ffd9de; color: #b42335; }
.banner.amber { background: #fffbeb; border-color: #fde68a; color: #92400e; }

.empty-state {
  padding: 46px 20px;
  text-align: center;
  border-radius: var(--ui-radius-card);
  border: 1px solid var(--ui-border);
  background: #fff;
  box-shadow: var(--ui-shadow-sm);
}
.empty-state__icon {
  width: 54px; height: 54px; margin: 0 auto 12px;
  border-radius: 999px;
  display: grid; place-items: center;
  color: #2f7cf6;
  background: radial-gradient(circle at 50% 30%, #eaf2ff 0%, #f8fbff 72%);
  border: 1px solid #dce8fb;
}
.empty-state h3 { margin: 0 0 6px; font-size: 14px; color: #111827; }
.empty-state p { margin: 0; font-size: 11px; color: #94a3b8; }

/* -------------------------------------------------------------------------- */
/* Modal / toast                                                              */
/* -------------------------------------------------------------------------- */

.modal-backdrop { background: rgba(15, 23, 42, 0.34); backdrop-filter: blur(4px); }
.modal-card { border-radius: 14px; border: 1px solid var(--ui-border); box-shadow: var(--ui-shadow-lg); }
.modal-head { padding: 14px 18px; }
.modal-head h3 { font-size: 14px; }
.modal-body { padding: 16px 18px; }
.modal-tabs { background: #f3f6fb; border-color: var(--ui-border); border-radius: 9px; }
.modal-tab.active { color: #2f7cf6; box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08); }
.toast { border-radius: 10px; border: 1px solid var(--ui-border); box-shadow: var(--ui-shadow-md); font-size: 11.5px; }

/* -------------------------------------------------------------------------- */
/* Login                                                                      */
/* -------------------------------------------------------------------------- */

.login-screen { background: radial-gradient(900px 500px at 50% -10%, #eaf2ff 0%, #f7f9fd 55%, #f5f7fb 100%); }
.login-card { border-radius: 16px; border: 1px solid var(--ui-border); box-shadow: 0 24px 70px rgba(15, 23, 42, 0.1); }
.login-brand h1 { font-size: 20px; }
.login-brand p { font-size: 11px; }
.login-tabs { background: #f3f6fb; border-radius: 9px; }
.login-tab.active { background: #fff; color: #2f7cf6; }
.login-foot { font-size: 10px; }

/* -------------------------------------------------------------------------- */
/* Responsive                                                                 */
/* -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-workspace { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 960px) {
  .sidebar { display: none; }
  .content { padding: 14px 14px 86px; }
  .topbar { padding: 8px 14px; min-height: 54px; }
  .page-intro h1 { font-size: 22px; }
  .page-intro__desc { font-size: 11px; }
  .page-intro__meta { display: none; }
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric-card { padding: 11px; min-height: 64px; gap: 8px; }
  .metric-card__icon { width: 28px; height: 28px; }
  .metric-card__value { font-size: 16px; }
  .page-intro { padding-bottom: 4px; gap: 8px; }
  .page-intro h1 { font-size: 20px; }
  .topbar { padding: 8px 12px; }
  .topbar-actions { gap: 4px; }
  .topbar-actions .btn > span:not(.ico) { display: none; }
  .topbar-actions .btn .ico { display: inline-flex; }
  .topbar-actions .btn { width: 32px; height: 32px; min-width: 32px; padding: 0; }
  .mobile-nav small { font-size: 8.5px; }
}


/* -------------------------------------------------------------------------- */
/* Profit plan                                                               */
/* -------------------------------------------------------------------------- */

.profit-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 1fr);
  gap: 12px;
  align-items: start;
}
.profit-apply-card { position: sticky; top: 76px; }
.profit-apply-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 12px;
}
.profit-apply-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 7px;
  background: #f8fafc;
  border: 1px solid var(--ui-border);
  font-size: 10.5px;
  color: #7b8794;
}
.profit-apply-list strong { color: #1f2937; font-size: 11px; font-weight: 600; }
.profit-apply-card .btn-block { margin-top: 7px; }
.profit-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.profit-action {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid var(--ui-border);
  background: #fff;
}
.profit-action__badge {
  flex-shrink: 0;
  min-width: 48px;
  padding: 3px 7px;
  border-radius: 6px;
  text-align: center;
  font-size: 9.5px;
  font-weight: 650;
  background: #f3f4f6;
  color: #64748b;
}
.profit-action.high { border-color: #ffd9de; background: #fffafb; }
.profit-action.high .profit-action__badge { background: #fff0f2; color: #e24657; }
.profit-action.medium { border-color: #d5e4ff; background: #fbfdff; }
.profit-action.medium .profit-action__badge { background: #eaf2ff; color: #1f6fe8; }
.profit-action.ok { border-color: #d1fae5; background: #fbfefc; }
.profit-action.ok .profit-action__badge { background: #e9fbf2; color: #15803d; }
.profit-action.low { border-color: #fde7bd; background: #fffdf7; }
.profit-action.low .profit-action__badge { background: #fff6e6; color: #b45309; }
.profit-action strong { display: block; font-size: 11.5px; color: #1f2937; line-height: 1.45; }
.profit-action p { margin: 3px 0 0; font-size: 10px; line-height: 1.55; color: #8b95a5; }
.profit-diagram {
  margin: 0;
  padding: 14px 16px;
  border-radius: 9px;
  border: 1px solid var(--ui-border);
  background: #f8fafc;
  color: #475569;
  font-family: var(--ui-mono);
  font-size: 10.5px;
  line-height: 1.75;
  overflow-x: auto;
}

@media (max-width: 1180px) {
  .profit-layout { grid-template-columns: minmax(0, 1fr); }
  .profit-apply-card { position: static; }
}
@media (max-width: 720px) {
  .profit-actions { grid-template-columns: 1fr; }
}
@media (max-width: 960px) {
  .mobile-nav { grid-template-columns: repeat(8, minmax(0, 1fr)) !important; }
}
