/* =====================================================================
   AMAX Aliexpress — dashboard styles
   Dark navy + orange gradient (reference screenshot). No framework.
   ===================================================================== */

:root {
  --bg: #0b1020;
  --bg-2: #0a0f1e;
  --panel: #0f1629;
  --panel-2: #121a31;
  --panel-3: #172039;
  --panel-hover: #18223e;
  --border: rgba(255, 255, 255, .06);
  --border-2: rgba(255, 255, 255, .1);
  --border-3: rgba(255, 255, 255, .16);
  --text: #eef1f8;
  --text-2: #b4bdd3;
  --muted: #7a85a3;
  --muted-2: #5b6585;

  --orange: #ff6a00;
  --orange-2: #ff3d00;
  --orange-soft: rgba(255, 106, 0, .14);
  --grad: linear-gradient(135deg, #ff7a1a 0%, #ff3d00 100%);
  --grad-soft: linear-gradient(135deg, rgba(255, 122, 26, .22), rgba(255, 61, 0, .1));
  --blue: #3b82f6;
  --purple: #a855f7;
  --teal: #14b8a6;
  --pink: #ec4899;
  --indigo: #6366f1;
  --green: #22c55e;
  --yellow: #f59e0b;
  --red: #ef4444;

  --radius-xs: 8px;
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 18px;
  --shadow: 0 12px 32px rgba(0, 0, 0, .35);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, .55);
  --glow: 0 8px 24px rgba(255, 90, 0, .35);

  --sidebar-w: 260px;
  --topbar-h: 80px;
  --gutter: 28px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(900px 500px at 85% -10%, rgba(255, 90, 0, .07), transparent 60%),
    radial-gradient(700px 500px at -10% 110%, rgba(99, 102, 241, .06), transparent 60%);
  background-attachment: fixed;
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.modal-open { overflow: hidden; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
code, kbd { font-family: var(--mono); font-size: .92em; }
code { background: rgba(255, 255, 255, .06); padding: 1px 6px; border-radius: 6px; color: #ffb27a; word-break: break-word; }
[hidden] { display: none !important; }
::selection { background: rgba(255, 106, 0, .35); }
:focus-visible { outline: 2px solid rgba(255, 122, 26, .85); outline-offset: 2px; border-radius: 6px; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .08); border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: rgba(255, 255, 255, .16); }

.i { display: block; flex: none; }
.ico { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.muted { color: var(--muted); }
.text-2 { color: var(--text-2); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.text-danger { color: #ff7b7b; }
.text-success { color: #4ade80; }
.text-warn { color: #fbbf24; }
.text-orange { color: #ff8a3d; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.break { word-break: break-word; overflow-wrap: anywhere; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout helpers (shared by all pages) ---------- */
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack-lg { display: flex; flex-direction: column; gap: 20px; }
.grid { display: grid; gap: 18px; }
.grid-2 { display: grid; gap: 18px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { display: grid; gap: 18px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { display: grid; gap: 18px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.spacer { flex: 1; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; }
.mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 12px; }
.divider { height: 1px; background: var(--border); margin: 14px 0; border: 0; }

/* ---------- boot / noscript ---------- */
.boot { position: fixed; inset: 0; display: flex; flex-direction: column; gap: 22px; align-items: center; justify-content: center; background: var(--bg); z-index: 200; }
.boot img { width: 170px; height: auto; }
.noscript { padding: 40px; text-align: center; }

/* ---------- spinner ---------- */
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid rgba(255, 255, 255, .12); border-top-color: var(--orange); animation: spin .75s linear infinite; display: inline-block; flex: none; }
.spinner-sm { width: 15px; height: 15px; border-width: 2px; }
.spinner-xs { width: 11px; height: 11px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================================
   Login
   ===================================================================== */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; position: relative; overflow: hidden; }
.login-glow { position: absolute; inset: -20%; background:
  radial-gradient(520px 380px at 30% 30%, rgba(255, 106, 0, .22), transparent 65%),
  radial-gradient(520px 380px at 75% 75%, rgba(255, 61, 0, .14), transparent 65%),
  url('/assets/hero.png') center / cover no-repeat;
  filter: blur(40px) saturate(1.1); opacity: .45; pointer-events: none; }
.login-card { position: relative; width: 100%; max-width: 410px; background: rgba(15, 22, 41, .9); backdrop-filter: blur(14px);
  border: 1px solid var(--border-2); border-radius: 22px; padding: 34px 30px 26px; box-shadow: var(--shadow-lg); }
.login-logo { width: 168px; height: auto; margin: 0 auto 18px; }
.login-title { font-size: 22px; font-weight: 800; margin: 0; text-align: center; letter-spacing: -.01em; }
.login-sub { margin: 6px 0 24px; color: var(--muted); text-align: center; font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }
.login-error { background: rgba(239, 68, 68, .12); border: 1px solid rgba(239, 68, 68, .35); color: #ffb3b3; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 13px; }
.login-foot { margin: 20px 0 0; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.6; }

/* =====================================================================
   Shell: sidebar + topbar
   ===================================================================== */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); z-index: 60;
  background: linear-gradient(180deg, #0a0f1e 0%, #0b1122 100%);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 18px 18px 18px; overflow-y: auto; overscroll-behavior: contain;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 22px; }
.brand img { width: 180px; height: auto; }
.sidebar-close { display: none; }
.nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 12px;
  color: var(--text-2); font-weight: 500; font-size: 15px; transition: background .15s, color .15s, transform .15s;
  position: relative;
}
.nav-ico { display: inline-flex; color: #c9d1e6; opacity: .9; }
.nav-item:hover { background: rgba(255, 255, 255, .045); color: var(--text); }
.nav-item.active { background: var(--grad); color: #fff; font-weight: 600; box-shadow: var(--glow); }
.nav-item.active .nav-ico { color: #fff; opacity: 1; }

.scrim { position: fixed; inset: 0; background: rgba(3, 6, 15, .65); backdrop-filter: blur(2px); z-index: 55; }

.main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px; padding: 0 var(--gutter);
  background: rgba(11, 16, 32, .82); backdrop-filter: blur(14px); border-bottom: 1px solid var(--border);
}
.menu-btn { display: none; }
.search-trigger {
  flex: 1; max-width: 780px; height: 48px; display: flex; align-items: center; gap: 12px; padding: 0 10px 0 16px;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--border-2); border-radius: 14px; color: var(--muted); text-align: left;
  transition: border-color .15s, background .15s;
}
.search-trigger:hover { border-color: var(--border-3); background: rgba(255, 255, 255, .05); }
.search-ico { display: inline-flex; color: #c3cbe0; }
.search-placeholder { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
.kbd { font-family: var(--font); font-size: 12px; color: var(--text-2); background: rgba(255, 255, 255, .07); border: 1px solid var(--border-2);
  padding: 4px 9px; border-radius: 8px; white-space: nowrap; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.topbar-divider { width: 1px; height: 34px; background: var(--border-2); }
.icon-btn {
  width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; flex: none;
  border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--text-2); transition: background .15s, color .15s;
}
.icon-btn:hover { background: rgba(255, 255, 255, .06); color: var(--text); }
.icon-btn.menu-btn, .icon-btn.sidebar-close { display: none; }
.icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.bell-btn { position: relative; width: 46px; height: 46px; color: #dfe5f3; }
.bell-count {
  position: absolute; top: 4px; right: 4px; min-width: 19px; height: 19px; padding: 0 5px; border-radius: 10px;
  background: linear-gradient(135deg, #ff4d4d, #ff2d55); color: #fff; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center; border: 2px solid var(--bg); line-height: 1;
}
.user-chip { display: flex; align-items: center; gap: 12px; background: transparent; border: 0; padding: 4px 6px 4px 4px; border-radius: 14px; text-align: left; }
.user-chip:hover { background: rgba(255, 255, 255, .04); }
.user-meta { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-name { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.user-role { font-size: 12.5px; color: var(--muted); }
.user-caret { display: inline-flex; color: var(--text-2); }

.avatar {
  position: relative; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; overflow: hidden;
  font-weight: 800; color: #fff; background: var(--grad); box-shadow: 0 6px 18px rgba(255, 80, 0, .3); width: 44px; height: 44px; font-size: 19px;
}
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar-blue { background: linear-gradient(135deg, #60a5fa, #2563eb); box-shadow: none; }
.avatar-purple { background: linear-gradient(135deg, #c084fc, #7c3aed); box-shadow: none; }
.avatar-teal { background: linear-gradient(135deg, #2dd4bf, #0f766e); box-shadow: none; }
.avatar-muted { background: #2a3352; box-shadow: none; }
.user-avatar { width: 46px; height: 46px; font-size: 20px; }

/* dropdowns */
.dropdown-wrap { position: relative; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 70; min-width: 240px;
  background: var(--panel-2); border: 1px solid var(--border-2); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  padding: 6px; animation: pop .14s ease-out;
}
/* deep-link highlight (Ctrl+K search result → card on the target page) */
.focus-flash { outline: 2px solid var(--orange, #ff6a00); outline-offset: 3px; animation: focusflash 1.4s ease-out 2; }
@keyframes focusflash { 0% { box-shadow: 0 0 0 0 rgba(255, 106, 0, .55); } 100% { box-shadow: 0 0 0 14px rgba(255, 106, 0, 0); } }
@media (prefers-reduced-motion: reduce) { .focus-flash { animation: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.dropdown-userhead { padding: 10px 12px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 0; background: transparent; color: var(--text-2); text-align: left; font-size: 14px; }
.menu-item:hover, .menu-item:focus-visible { background: rgba(255, 255, 255, .06); color: var(--text); }
.menu-item.danger { color: #ff8e8e; }
.menu-item.active { color: #ff9a52; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }
.dropdown-notif { width: min(380px, calc(100vw - 24px)); padding: 0; overflow: hidden; }
.dropdown-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 10px 16px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: min(460px, 70vh); overflow-y: auto; padding: 6px; }
.notif-list .loader, .notif-list .empty { padding: 26px 12px; }
.notif-item { width: 100%; display: flex; gap: 12px; padding: 11px 12px; border: 0; border-radius: 11px; background: transparent; text-align: left; color: var(--text-2); }
.notif-item:hover { background: rgba(255, 255, 255, .04); }
.notif-item.unread { background: rgba(255, 106, 0, .06); color: var(--text); }
.notif-dot { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--muted); }
.notif-item:not(.unread) .notif-dot { opacity: .35; }
.dot-danger { background: var(--red); } .dot-warn { background: var(--yellow); } .dot-success { background: var(--green); } .dot-info { background: var(--blue); }
.notif-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.notif-title { font-weight: 600; font-size: 13.5px; }
.notif-body { font-size: 12.5px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.notif-time { font-size: 11.5px; color: var(--muted-2); }

/* view */
.view { padding: 24px var(--gutter) 40px; outline: none; min-width: 0; }
.page { display: flex; flex-direction: column; gap: 22px; min-width: 0; animation: fadein .2s ease-out; }
@keyframes fadein { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-title { font-size: 24px; font-weight: 800; margin: 0; letter-spacing: -.015em; display: flex; align-items: center; gap: 12px; }
.page-title .ico { width: 40px; height: 40px; border-radius: 12px; background: var(--grad-soft); color: #ff8a3d; border: 1px solid rgba(255, 106, 0, .25); }
.page-sub { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; max-width: 760px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.page-error { padding: 40px 0; }
:where(.section-title) { margin: 0; }
.section-title { font-size: 16px; font-weight: 700; display: flex; align-items: center; gap: 10px; }

/* =====================================================================
   Cards
   ===================================================================== */
.card {
  background: linear-gradient(180deg, rgba(19, 27, 50, .85), rgba(15, 22, 41, .92));
  border: 1px solid var(--border); border-radius: var(--radius-lg); min-width: 0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .03) inset;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 0; flex-wrap: wrap; }
.card-title-wrap { display: flex; align-items: center; gap: 12px; min-width: 0; }
.card-ico { width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(255, 80, 0, .28); }
.card-titles { min-width: 0; }
.card-title { margin: 0; font-size: 16.5px; font-weight: 700; letter-spacing: -.005em; }
.card-subtitle { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.card-body { padding: 16px 20px 20px; min-width: 0; }
.card-flush .card-body { padding: 0; }
.card-link { color: #ff8a3d; font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; padding: 4px 2px; border-radius: 6px; }
.card-link:hover { color: #ffae73; }
.subcard { background: rgba(255, 255, 255, .025); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 8px 16px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; word-break: break-word; }

/* =====================================================================
   Stat cards
   ===================================================================== */
.stats-grid { display: grid; gap: 16px; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stat-card {
  --c: var(--orange); --c-rgb: 255, 106, 0;
  position: relative; overflow: hidden; min-width: 0; text-align: left; color: var(--text);
  padding: 18px 18px 16px; border-radius: var(--radius-lg); min-height: 162px;
  background: linear-gradient(160deg, rgba(var(--c-rgb), .12), rgba(15, 22, 41, .95) 55%);
  border: 1px solid rgba(var(--c-rgb), .38);
  box-shadow: 0 0 0 1px rgba(var(--c-rgb), .05) inset, 0 10px 30px rgba(var(--c-rgb), .08);
  display: flex; flex-direction: column; gap: 4px; transition: transform .18s, box-shadow .18s;
  font: inherit;
}
.stat-card.is-clickable { cursor: pointer; }
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(var(--c-rgb), .12) inset, 0 16px 36px rgba(var(--c-rgb), .16); }
.stat-orange { --c: #ff6a00; --c-rgb: 255, 106, 0; }
.stat-blue { --c: #3b82f6; --c-rgb: 59, 130, 246; }
.stat-purple { --c: #a855f7; --c-rgb: 168, 85, 247; }
.stat-teal { --c: #14b8a6; --c-rgb: 20, 184, 166; }
.stat-pink { --c: #ec4899; --c-rgb: 236, 72, 153; }
.stat-indigo { --c: #6366f1; --c-rgb: 99, 102, 241; }
.stat-green { --c: #22c55e; --c-rgb: 34, 197, 94; }
.stat-yellow { --c: #f59e0b; --c-rgb: 245, 158, 11; }
.stat-red { --c: #ef4444; --c-rgb: 239, 68, 68; }
.stat-filled { background: linear-gradient(150deg, #ff8a2a 0%, #ff5a0a 45%, #e83a00 100%); border-color: rgba(255, 170, 110, .7); box-shadow: 0 14px 36px rgba(255, 80, 0, .35); }
.stat-top { display: flex; align-items: center; gap: 12px; min-width: 0; }
.stat-ico { width: 40px; height: 40px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; flex: none;
  background: var(--c); color: #fff; box-shadow: 0 6px 16px rgba(var(--c-rgb), .4); }
.stat-filled .stat-ico { background: rgba(255, 255, 255, .95); color: #ff5a0a; box-shadow: none; }
.stat-label { font-size: 13.5px; font-weight: 500; color: #dfe4f1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin-top: 10px; line-height: 1.1; position: relative; z-index: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: 12.5px; color: var(--text-2); position: relative; z-index: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; text-shadow: 0 1px 6px rgba(0, 0, 0, .45); }
.stat-filled .stat-sub, .stat-filled .stat-label { color: rgba(255, 255, 255, .9); }
.stat-spark { position: absolute; right: 0; bottom: 0; width: 62%; height: 58%; pointer-events: none; }
.delta { display: inline-flex; align-items: center; gap: 4px; font-weight: 700; font-size: 13.5px; margin-top: auto; padding-top: 8px; position: relative; z-index: 1; }
.delta-up { color: #4ade80; } .delta-down { color: #ff7b7b; } .delta-flat { color: var(--text-2); }
.stat-filled .delta { color: #fff; }

/* =====================================================================
   Badges / tabs / buttons
   ===================================================================== */
.badge {
  --b-rgb: 122, 133, 163;
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 7px; font-size: 11.5px; font-weight: 600;
  white-space: nowrap; letter-spacing: .01em; color: rgb(var(--b-rgb)); background: rgba(var(--b-rgb), .14); border: 1px solid rgba(var(--b-rgb), .22);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis;
}
.badge .ico { margin-left: -1px; }
.badge-success { --b-rgb: 74, 222, 128; }
.badge-warn { --b-rgb: 251, 191, 36; }
.badge-danger { --b-rgb: 255, 120, 120; }
.badge-info, .badge-blue { --b-rgb: 96, 165, 250; }
.badge-orange { --b-rgb: 255, 138, 61; }
.badge-purple { --b-rgb: 192, 132, 252; }
.badge-teal { --b-rgb: 45, 212, 191; }
.badge-pink { --b-rgb: 244, 114, 182; }
.badge-indigo { --b-rgb: 129, 140, 248; }
.badge-muted { --b-rgb: 148, 158, 186; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
/* AI health alerts (all AI providers failed / no key) */
.ai-alert { display: flex; gap: 18px; align-items: flex-start; padding: 22px 24px; border-radius: 18px; border: 2px solid rgba(var(--a-rgb), .75);
  background: linear-gradient(120deg, rgba(var(--a-rgb), .24), rgba(var(--a-rgb), .07) 70%); box-shadow: 0 14px 40px -18px rgba(var(--a-rgb), .9); min-width: 0; margin-bottom: 18px; }
.ai-alert-down { --a-rgb: 239, 68, 68; animation: aiPulse 2.4s ease-in-out infinite; }
.ai-alert-unconf { --a-rgb: 255, 138, 61; }
@keyframes aiPulse { 0%, 100% { box-shadow: 0 14px 40px -18px rgba(var(--a-rgb), .9); } 50% { box-shadow: 0 0 0 4px rgba(var(--a-rgb), .25), 0 14px 40px -18px rgba(var(--a-rgb), .9); } }
@media (prefers-reduced-motion: reduce) { .ai-alert-down { animation: none; } }
.ai-alert-ico { flex: none; width: 60px; height: 60px; border-radius: 16px; display: flex; align-items: center; justify-content: center; color: #fff; background: rgb(var(--a-rgb)); }
.ai-alert-main { min-width: 0; flex: 1; display: grid; gap: 8px; }
.ai-alert-title { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.25; color: rgb(var(--a-rgb)); letter-spacing: .01em; word-break: break-word; }
.ai-alert-down .ai-alert-title { color: #ff8a8a; }
.ai-alert-text { margin: 0; font-size: 14px; line-height: 1.55; color: var(--text); }
.ai-alert-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; word-break: break-word; }
.ai-alert-error { font-size: 12.5px; line-height: 1.5; padding: 8px 10px; border-radius: 10px; background: rgba(0, 0, 0, .25); border: 1px solid rgba(var(--a-rgb), .35); word-break: break-word; white-space: pre-wrap; }
.ai-alert-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.ai-template-note { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); margin-bottom: 12px; }
@media (max-width: 560px) {
  .ai-alert { flex-direction: column; padding: 16px; gap: 12px; }
  .ai-alert-ico { width: 48px; height: 48px; }
  .ai-alert-title { font-size: 18px; }
  .ai-alert-actions .btn { flex: 1 1 auto; justify-content: center; }
}
.ai-strip { position: sticky; top: var(--topbar-h); z-index: 39; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px var(--gutter, 16px); background: #b91c1c; color: #fff; font-size: 13px; font-weight: 600; line-height: 1.4; }
.ai-strip[hidden] { display: none; }
.ai-strip .ico { flex: none; }
.ai-strip-text { flex: 1 1 200px; min-width: 0; word-break: break-word; }
.ai-strip a { color: #fff; text-decoration: underline; font-weight: 700; white-space: nowrap; }
.ai-strip.is-unconf { background: #c2410c; }
.ai-status { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: rgba(255, 255, 255, .03); font-size: 13px; line-height: 1.5; }
.ai-status.is-ok { border-color: rgba(74, 222, 128, .45); }
.ai-status.is-down { border-color: rgba(239, 68, 68, .7); background: rgba(239, 68, 68, .1); }
.ai-status.is-unconf { border-color: rgba(255, 138, 61, .6); background: rgba(255, 138, 61, .08); }
.ai-status-main { flex: 1 1 220px; min-width: 0; display: grid; gap: 2px; word-break: break-word; }
/* Bell: error-level notifications stand out */
.notif-item.is-error { box-shadow: inset 3px 0 0 var(--red); }
.notif-item.is-error .notif-title { color: #ff8a8a; }
.notif-item.is-error.unread { background: rgba(239, 68, 68, .1); }
.notif-ico-err { flex: none; color: var(--red); margin-top: 2px; line-height: 0; }
#bell-btn.has-error { color: #ff8a8a; }
#bell-btn.has-error #bell-count { background: var(--red); }
.badge .badge-legacy { font-weight: 500; opacity: .65; margin-left: -2px; }
.badge-ai { font-variant-numeric: tabular-nums; max-width: min(100%, 260px); display: inline-block; line-height: 22px; }
.badge-ai .ico { vertical-align: -2px; margin-right: 4px; }

.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: rgba(255, 255, 255, .035); border: 1px solid var(--border); flex-wrap: wrap; max-width: 100%; }
.tab { border: 0; background: transparent; color: var(--text-2); padding: 7px 18px; border-radius: 9px; font-weight: 600; font-size: 13.5px; display: inline-flex; align-items: center; gap: 7px; transition: background .15s, color .15s; white-space: nowrap; }
.tab:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.tab.active { background: var(--grad); color: #fff; box-shadow: 0 6px 16px rgba(255, 80, 0, .3); }
.tab-count { font-size: 11px; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; background: rgba(255, 255, 255, .1); display: inline-flex; align-items: center; justify-content: center; }
.tab.active .tab-count { background: rgba(255, 255, 255, .25); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border-radius: 11px; font-weight: 600; white-space: nowrap;
  border: 1px solid transparent; transition: filter .15s, background .15s, border-color .15s, transform .1s, box-shadow .15s; user-select: none;
  height: 40px; padding: 0 16px; font-size: 14px; text-decoration: none; line-height: 1;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; gap: 6px; }
.btn-lg { height: 48px; padding: 0 22px; font-size: 15px; border-radius: 13px; }
.btn-block { width: 100%; }
.btn-icon-only { padding: 0; width: 40px; }
.btn-sm.btn-icon-only { width: 32px; }
.btn-ico { display: inline-flex; }
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 6px 18px rgba(255, 80, 0, .3); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 8px 24px rgba(255, 80, 0, .42); }
.btn-secondary { background: rgba(255, 255, 255, .05); color: var(--text); border-color: var(--border-2); }
.btn-secondary:hover:not(:disabled) { background: rgba(255, 255, 255, .09); border-color: var(--border-3); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: rgba(255, 255, 255, .06); color: var(--text); }
.btn-danger { background: rgba(239, 68, 68, .14); color: #ff8e8e; border-color: rgba(239, 68, 68, .35); }
.btn-danger:hover:not(:disabled) { background: rgba(239, 68, 68, .24); color: #ffb0b0; }
.btn-success { background: rgba(34, 197, 94, .15); color: #6ee7a0; border-color: rgba(34, 197, 94, .35); }
.btn-success:hover:not(:disabled) { background: rgba(34, 197, 94, .25); }
.btn.is-loading { cursor: progress; }

/* =====================================================================
   Forms
   ===================================================================== */
.form { display: flex; flex-direction: column; gap: 16px; }
.form-grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: 1 / -1; }
.form-section { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 16px 18px; background: rgba(255, 255, 255, .018); }
.form-section-title { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14.5px; margin: 0 0 4px; }
.form-section-title .ico { width: 28px; height: 28px; border-radius: 8px; background: var(--orange-soft); color: #ff8a3d; }
.form-section-desc { color: var(--muted); font-size: 12.5px; margin: 0 0 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: #d5dbea; }
.field-label .req { color: #ff8a3d; }
.field-help { font-size: 12px; color: var(--muted); line-height: 1.45; }
.field.has-error .input { border-color: rgba(239, 68, 68, .6); }
.input {
  width: 100%; min-width: 0; height: 42px; padding: 0 13px; border-radius: 11px; background: rgba(8, 12, 26, .65);
  border: 1px solid var(--border-2); color: var(--text); font-size: 14px; transition: border-color .15s, box-shadow .15s, background .15s;
}
.input::placeholder { color: var(--muted-2); }
.input:hover { border-color: var(--border-3); }
.input:focus { outline: none; border-color: rgba(255, 122, 26, .75); box-shadow: 0 0 0 3px rgba(255, 106, 0, .16); background: rgba(8, 12, 26, .85); }
.input:disabled { opacity: .55; cursor: not-allowed; }
.textarea { height: auto; padding: 11px 13px; line-height: 1.5; resize: vertical; min-height: 84px; }
.select { appearance: none; -webkit-appearance: none; padding-right: 36px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a7b0c8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.select option { background: #121a31; color: var(--text); }
.input-group { position: relative; display: flex; }
.input-group .input { padding-right: 46px; }
.input-addon { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 34px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); display: inline-flex; align-items: center; justify-content: center; }
.input-addon:hover { color: var(--text); background: rgba(255, 255, 255, .06); }
.input-time { width: 120px; height: 36px; }
.input-time::-webkit-calendar-picker-indicator { filter: invert(.8); }

/* position: relative keeps the hidden input INSIDE its label: without it the input's containing block
   was the fixed modal overlay, so focusing it (label click) scrolled the overlay to the input's
   unscrolled position and pushed the whole modal off-screen (only the blur stayed visible). */
.switch { position: relative; display: inline-flex; align-items: center; gap: 12px; cursor: pointer; user-select: none; min-height: 28px; }
.switch input { position: absolute; top: 0; left: 0; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.switch-track { width: 44px; height: 24px; border-radius: 12px; background: #2a3352; border: 1px solid var(--border-2); position: relative; transition: background .18s; flex: none; }
.switch-thumb { position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #cfd6e8; transition: transform .18s, background .18s; box-shadow: 0 2px 6px rgba(0, 0, 0, .35); }
.switch input:checked + .switch-track { background: var(--grad); border-color: rgba(255, 140, 70, .6); }
.switch input:checked + .switch-track .switch-thumb { transform: translateX(20px); background: #fff; }
.switch input:focus-visible + .switch-track { outline: 2px solid rgba(255, 122, 26, .85); outline-offset: 2px; }
.switch input:disabled + .switch-track { opacity: .5; }
.switch-text { font-size: 13.5px; font-weight: 600; color: #d5dbea; }
.checkbox { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.checkbox input { position: absolute; top: 0; left: 0; opacity: 0; width: 1px; height: 1px; }
.checkbox-box { width: 19px; height: 19px; border-radius: 6px; border: 1.5px solid var(--border-3); display: inline-flex; align-items: center; justify-content: center; color: transparent; transition: all .15s; flex: none; }
.checkbox input:checked + .checkbox-box { background: var(--grad); border-color: transparent; color: #fff; }
.checkbox input:focus-visible + .checkbox-box { outline: 2px solid rgba(255, 122, 26, .85); outline-offset: 2px; }
.checkbox-text { font-size: 13.5px; }

.tags-input { display: flex; flex-direction: column; gap: 8px; }
.tags-preview { display: flex; flex-wrap: wrap; gap: 6px; min-height: 26px; align-items: center; }
.tag-chip { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 8px; font-size: 12.5px; font-weight: 600; background: rgba(255, 106, 0, .12); color: #ffa766; border: 1px solid rgba(255, 106, 0, .25); }
.tag-chip.over { background: rgba(239, 68, 68, .12); color: #ff9a9a; border-color: rgba(239, 68, 68, .35); text-decoration: line-through; }
.tags-meta { font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 8px; font-size: 12.5px; background: rgba(255, 255, 255, .05); border: 1px solid var(--border-2); color: var(--text-2); white-space: nowrap; }
.chip-orange { background: rgba(255, 106, 0, .1); color: #ffa766; border-color: rgba(255, 106, 0, .25); }

.timelist { display: flex; flex-direction: column; gap: 10px; }
.timelist-items { display: flex; flex-wrap: wrap; gap: 8px; }
.timelist-row { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 10px; background: rgba(255, 255, 255, .03); border: 1px solid var(--border-2); border-radius: 12px; }
.timelist-row .input { border: 0; background: transparent; padding: 0 4px; width: 104px; box-shadow: none; }
.timelist-row .icon-btn { width: 30px; height: 30px; border-radius: 8px; }
.timelist-foot { display: flex; align-items: center; gap: 12px; }
.timelist-count { font-size: 12px; color: var(--muted); }

/* =====================================================================
   Tables
   ===================================================================== */
.table-wrap { width: 100%; overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); background: rgba(255, 255, 255, .012); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl th { text-align: left; font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: rgba(255, 255, 255, .02); }
.tbl td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; min-width: 0; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: rgba(255, 255, 255, .025); }
.tbl tr.is-clickable { cursor: pointer; }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl-empty-row:hover { background: transparent !important; }
.tbl-empty { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 26px 10px; color: var(--muted); }

/* =====================================================================
   Modal
   ===================================================================== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(3, 6, 15, .7); backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 24px; overflow-y: auto; animation: fade .16s ease-out;
}
.modal-overlay.leaving { animation: fadeout .18s ease-in forwards; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeout { to { opacity: 0; } }
.modal {
  width: 100%; background: linear-gradient(180deg, #141c35, #0f1629); border: 1px solid var(--border-2); border-radius: 20px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; max-height: calc(100dvh - 6vh - 24px); outline: none; animation: rise .2s ease-out; min-width: 0; overflow: hidden;
}
.modal-head, .modal-foot { flex: none; }
.modal-body { overflow-y: auto; overscroll-behavior: contain; flex: 1 1 auto; min-height: 0; }
@keyframes rise { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-sm { max-width: 440px; } .modal-md { max-width: 620px; } .modal-lg { max-width: 860px; } .modal-xl { max-width: 1120px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 4px 22px; }
.modal-title { margin: 0; font-size: 18px; font-weight: 800; letter-spacing: -.01em; }
.modal-x { width: 36px; height: 36px; border-radius: 10px; border: 0; background: rgba(255, 255, 255, .05); color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.modal-x:hover { background: rgba(255, 255, 255, .1); color: var(--text); }
.modal-body { padding: 14px 22px 20px; min-width: 0; }
.modal-text { margin: 0; color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; background: #0f1629; }
.confirm-body { display: flex; gap: 14px; align-items: flex-start; }
.confirm-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--orange-soft); color: #ff8a3d; }
.confirm-ico.danger { background: rgba(239, 68, 68, .14); color: #ff8e8e; }
.confirm-msg { color: var(--text-2); padding-top: 2px; min-width: 0; word-break: break-word; }

/* palette */
.modal-palette { max-width: 680px; }
.modal-palette .modal-head { display: none; }
.modal-palette .modal-body { padding: 0; }
.palette-bar { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.palette-ico { display: inline-flex; color: var(--muted); }
.palette-input { flex: 1; min-width: 0; height: 40px; border: 0; background: transparent; font-size: 16px; color: var(--text); outline: none; }
.palette-input::-webkit-search-cancel-button { display: none; }
.palette-results { max-height: min(430px, 60vh); overflow-y: auto; padding: 8px; }
.palette-group { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 12px 6px; font-weight: 600; }
.palette-item { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px; border: 0; background: transparent; text-align: left; color: var(--text-2); }
.palette-item.active { background: rgba(255, 106, 0, .12); color: var(--text); }
.palette-item-ico { width: 32px; height: 32px; border-radius: 9px; background: rgba(255, 255, 255, .05); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.palette-item.active .palette-item-ico { background: var(--grad); color: #fff; }
.palette-item-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.palette-item-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item-go { display: inline-flex; opacity: 0; color: var(--muted); }
.palette-item.active .palette-item-go { opacity: 1; }
.palette-empty { padding: 30px 12px; text-align: center; color: var(--muted); }
.palette-foot { display: flex; justify-content: space-between; gap: 12px; padding: 10px 18px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.palette-status { display: inline-flex; align-items: center; gap: 8px; }

/* =====================================================================
   Toasts
   ===================================================================== */
.toast-stack { position: fixed; right: 20px; bottom: 20px; z-index: 300; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; border-radius: 13px;
  background: #151e38; border: 1px solid var(--border-2); box-shadow: var(--shadow-lg); animation: toastin .2s ease-out; border-left: 3px solid var(--blue);
}
.toast.leaving { animation: toastout .2s ease-in forwards; }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toastout { to { opacity: 0; transform: translateX(20px); } }
.toast-success { border-left-color: var(--green); } .toast-success .toast-ico { color: #4ade80; }
.toast-error { border-left-color: var(--red); } .toast-error .toast-ico { color: #ff7b7b; }
.toast-warn { border-left-color: var(--yellow); } .toast-warn .toast-ico { color: #fbbf24; }
.toast-info .toast-ico { color: #60a5fa; }
.toast-ico { margin-top: 1px; }
.toast-msg { flex: 1; min-width: 0; font-size: 13.5px; word-break: break-word; }
.toast-close { border: 0; background: transparent; color: var(--muted); width: 24px; height: 24px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.toast-close:hover { background: rgba(255, 255, 255, .08); color: var(--text); }

/* =====================================================================
   States: empty, loader, skeleton, progress
   ===================================================================== */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; padding: 34px 16px; color: var(--muted); }
.empty-ico { width: 56px; height: 56px; border-radius: 16px; display: inline-flex; align-items: center; justify-content: center; background: rgba(255, 106, 0, .1); color: #ff8a3d; border: 1px solid rgba(255, 106, 0, .2); margin-bottom: 4px; }
.empty-title { font-weight: 700; color: var(--text); font-size: 15px; }
.empty-text { font-size: 13px; max-width: 460px; word-break: break-word; }
.empty-action { margin-top: 8px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.loader { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 30px 12px; color: var(--muted); }
.skel { position: relative; overflow: hidden; background: rgba(255, 255, 255, .035); border-radius: var(--radius); }
.skel::after, .skel-line::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%); background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .05), transparent); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); }
.skel-card { height: 150px; padding: 20px; display: flex; flex-direction: column; gap: 14px; border: 1px solid var(--border); }
.skel-lines { display: flex; flex-direction: column; gap: 12px; padding: 4px 0; }
.skel-line { position: relative; overflow: hidden; height: 12px; border-radius: 6px; background: rgba(255, 255, 255, .06); }
.skel-line.tall { height: 26px; }
.w40 { width: 40%; } .w50 { width: 50%; } .w55 { width: 55%; } .w60 { width: 60%; } .w70 { width: 70%; } .w75 { width: 75%; } .w85 { width: 85%; } .w90 { width: 90%; }
.skel-block { width: 100%; }
.page-loading { gap: 20px; }

.progress { --c: var(--orange); height: 8px; border-radius: 6px; background: rgba(255, 255, 255, .07); overflow: hidden; width: 100%; min-width: 60px; }
.progress-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, rgba(255, 255, 255, .15), var(--c)); transition: width .4s ease; box-shadow: 0 0 10px var(--c); }
.progress-orange { --c: #ff6a00; } .progress-blue { --c: #3b82f6; } .progress-purple { --c: #a855f7; } .progress-teal { --c: #14b8a6; }
.progress-pink { --c: #ec4899; } .progress-indigo { --c: #6366f1; } .progress-green { --c: #22c55e; } .progress-yellow { --c: #f59e0b; } .progress-red { --c: #ef4444; }

/* =====================================================================
   Link panel & job progress
   ===================================================================== */
.link-panel { display: flex; flex-direction: column; gap: 10px; padding: 14px; border-radius: var(--radius); border: 1px solid rgba(255, 106, 0, .25); background: rgba(255, 106, 0, .05); }
.link-panel-head { display: flex; align-items: center; gap: 8px; font-weight: 700; color: #ffa766; }
.link-panel-head .muted { margin-left: auto; font-weight: 500; }
.link-full { height: auto; padding: 10px 12px; font-family: var(--mono); font-size: 12.5px; word-break: break-all; resize: none; line-height: 1.5; }
.link-panel-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.jobp { display: flex; flex-direction: column; gap: 12px; }
.jobp-head { display: flex; align-items: center; gap: 10px; font-weight: 700; flex-wrap: wrap; }
.jobp-done .ico { color: #4ade80; } .jobp-failed .ico { color: #ff7b7b; }
.jobp-time { margin-left: auto; font-weight: 500; color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.jobp-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; position: relative; }
.jobp-step { display: flex; gap: 12px; padding: 8px 4px; position: relative; }
.jobp-step:not(:last-child)::before { content: ''; position: absolute; left: 15px; top: 32px; bottom: -6px; width: 2px; background: var(--border-2); }
.jobp-dot { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; background: rgba(255, 255, 255, .06); border: 1px solid var(--border-2); position: relative; z-index: 1; color: var(--muted); }
.jobp-dot > span { display: inline-flex; }
.is-done .jobp-dot { background: rgba(34, 197, 94, .16); border-color: rgba(34, 197, 94, .45); color: #4ade80; }
.is-failed .jobp-dot { background: rgba(239, 68, 68, .16); border-color: rgba(239, 68, 68, .45); color: #ff7b7b; }
.is-running .jobp-dot { background: rgba(255, 106, 0, .14); border-color: rgba(255, 106, 0, .45); }
.is-skipped .jobp-dot { opacity: .6; }
.jobp-main { min-width: 0; padding-top: 2px; }
.jobp-label { font-weight: 600; font-size: 13.5px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.jobp-status { font-size: 11.5px; font-weight: 600; color: var(--muted); }
.is-done .jobp-status { color: #4ade80; } .is-failed .jobp-status { color: #ff7b7b; } .is-running .jobp-status { color: #ffa766; }
.jobp-detail { font-size: 12.5px; color: var(--text-2); margin-top: 2px; word-break: break-word; white-space: pre-wrap; }
.jobp-error { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; background: rgba(239, 68, 68, .1); border: 1px solid rgba(239, 68, 68, .3); color: #ffb3b3; font-size: 13px; word-break: break-word; }

/* callouts */
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 13px; border: 1px solid; word-break: break-word; }
.callout .ico { margin-top: 1px; }
.callout-info { background: rgba(59, 130, 246, .08); border-color: rgba(59, 130, 246, .28); color: #bcd6ff; }
.callout-warn { background: rgba(245, 158, 11, .08); border-color: rgba(245, 158, 11, .3); color: #fde1a8; }
.callout-danger { background: rgba(239, 68, 68, .08); border-color: rgba(239, 68, 68, .3); color: #ffc0c0; }
.callout-success { background: rgba(34, 197, 94, .08); border-color: rgba(34, 197, 94, .28); color: #bff3d2; }
.callout-orange { background: rgba(255, 106, 0, .08); border-color: rgba(255, 106, 0, .28); color: #ffd2b0; }

/* light markdown */
.md { color: var(--text-2); font-size: 13.8px; line-height: 1.65; }
.md p { margin: 0 0 10px; }
.md h4 { margin: 14px 0 6px; color: var(--text); font-size: 14.5px; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 20px; }
.md li { margin: 3px 0; }
.md strong { color: var(--text); }
.md > :last-child { margin-bottom: 0; }

/* =====================================================================
   Dashboard
   ===================================================================== */
.dash-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: -6px; }
.refresh-status { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); min-width: 0; }
.refresh-status .ico { color: var(--muted); }
.refresh-status.ok .ico { color: #4ade80; } .refresh-status.err .ico { color: #ff9a9a; }
.date-chip { display: inline-flex; align-items: center; gap: 10px; height: 38px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--border-2); background: rgba(15, 22, 41, .9); color: var(--text); font-weight: 600; font-size: 13.5px; }
.date-chip:hover { border-color: var(--border-3); background: var(--panel-3); }
.date-chip .ico { color: var(--text-2); }
.dash-grid-2 { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr); align-items: start; }
.dash-grid-3 { display: grid; gap: 18px; grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr); align-items: start; }

.acc-list { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.acc-row {
  position: relative; overflow: hidden; border-radius: 16px; padding: 16px; border: 1px solid rgba(255, 106, 0, .18);
  background: linear-gradient(120deg, rgba(255, 255, 255, .02), rgba(255, 106, 0, .08));
}
.acc-row.inactive { border-color: var(--border); background: rgba(255, 255, 255, .02); opacity: .85; }
.acc-row-spark { position: absolute; right: 0; bottom: 0; width: 46%; height: 70%; pointer-events: none; opacity: .9; }
.acc-row-top { display: flex; align-items: flex-start; gap: 14px; position: relative; z-index: 1; }
.acc-row-id { min-width: 0; flex: 1; }
.acc-row-name { font-weight: 700; font-size: 15.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-row-sub { color: var(--muted); font-size: 12.5px; margin-bottom: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-delta { flex: none; display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 10px; border-radius: 8px; font-weight: 700; font-size: 12.5px; background: var(--grad); color: #fff; box-shadow: 0 6px 14px rgba(255, 80, 0, .3); }
.acc-delta.down { background: rgba(239, 68, 68, .2); color: #ffb0b0; box-shadow: none; }
.acc-delta.flat { background: rgba(255, 255, 255, .08); color: var(--text-2); box-shadow: none; }
.metric-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 14px; position: relative; z-index: 1; }
.metric-tile { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(8, 12, 26, .55); border: 1px solid var(--border); min-width: 0; }
.metric-tile .ico { color: var(--text-2); }
.metric-val { font-weight: 700; font-size: 15px; line-height: 1.15; font-variant-numeric: tabular-nums; }
.metric-lbl { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.metric-tile > div { min-width: 0; }
.acc-row-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; flex-wrap: wrap; position: relative; z-index: 1; }
.funnel { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); min-width: 0; }
.funnel::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); flex: none; }

.health-list { display: flex; flex-direction: column; margin-top: 6px; }
.health-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) minmax(70px, 150px) 20px; align-items: center; gap: 12px; padding: 11px 6px; border-bottom: 1px solid var(--border); border-radius: 10px; background: transparent; border-left: 0; border-right: 0; border-top: 0; text-align: left; width: 100%; color: inherit; }
.health-row:last-child { border-bottom: 0; }
.health-row:hover { background: rgba(255, 255, 255, .03); }
.health-ico { width: 38px; height: 38px; border-radius: 11px; display: inline-flex; align-items: center; justify-content: center; color: #fff; }
.tile-dark { background: #0a0d18; border: 1px solid var(--border-3); }
.tile-orange { background: var(--grad); } .tile-red { background: linear-gradient(135deg, #ff5a5a, #e11d48); } .tile-purple { background: linear-gradient(135deg, #a855f7, #6d28d9); }
.tile-blue { background: linear-gradient(135deg, #60a5fa, #2563eb); } .tile-teal { background: linear-gradient(135deg, #2dd4bf, #0f766e); } .tile-indigo { background: linear-gradient(135deg, #818cf8, #4f46e5); }
.tile-pink { background: linear-gradient(135deg, #f472b6, #db2777); } .tile-green { background: linear-gradient(135deg, #4ade80, #16a34a); }
.health-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.health-meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.health-meta .row { gap: 8px; flex-wrap: nowrap; min-width: 0; }
.health-meta .row .badge { flex: none; }
.health-meta .health-name { min-width: 0; flex: 0 1 auto; }
.health-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.health-chev { color: var(--muted); display: inline-flex; }

.camp-health { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(0, 1.25fr); gap: 14px; }
.camp-tile { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, .025); border: 1px solid var(--border); min-width: 0; text-align: left; color: inherit; width: 100%; transition: background .15s, border-color .15s; }
button.camp-tile:hover { background: rgba(255, 255, 255, .05); border-color: var(--border-2); }
.camp-tile-main { min-width: 0; flex: 1; }
.camp-tile-title { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.camp-tile-state { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; }
.camp-tile-state.ok { color: #4ade80; } .camp-tile-state.warn { color: #fbbf24; } .camp-tile-state.error { color: #ff7b7b; } .camp-tile-state.off { color: var(--muted); }
.camp-tile-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cta-tile {
  display: flex; align-items: center; gap: 14px; padding: 16px 18px; border-radius: 16px; border: 1px solid rgba(255, 170, 110, .6);
  background: linear-gradient(120deg, #ff7a1a, #ff4d00 55%, #d93400); color: #fff; text-align: left; box-shadow: 0 14px 34px rgba(255, 70, 0, .35);
  transition: transform .15s, box-shadow .15s, filter .15s; min-width: 0; width: 100%; font: inherit;
}
.cta-tile:hover { transform: translateY(-2px); filter: brightness(1.05); box-shadow: 0 18px 40px rgba(255, 70, 0, .45); }
.cta-ico { display: inline-flex; flex: none; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .25)); }
.cta-text { flex: 1; min-width: 0; font-weight: 800; font-size: 16px; line-height: 1.25; }
.cta-text small { display: block; font-weight: 500; font-size: 12px; opacity: .9; margin-top: 2px; }
.cta-go { width: 38px; height: 38px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, .8); display: inline-flex; align-items: center; justify-content: center; flex: none; }

.analysis-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.insight-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 16px; }
.insight { padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .025); border: 1px solid var(--border); min-width: 0; }
.insight-lbl { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.insight-val { font-weight: 700; font-size: 15px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.insight-sub { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-box { position: relative; height: 210px; margin-bottom: 16px; }
.top-posts { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.top-post { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .02); border: 1px solid var(--border); }
.top-post-rank { width: 26px; height: 26px; border-radius: 8px; background: var(--orange-soft); color: #ff9a52; font-weight: 800; font-size: 12.5px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.top-post-main { min-width: 0; flex: 1; }
.top-post-text { font-size: 13px; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.top-post-meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 4px; }
.top-post-meta span { display: inline-flex; align-items: center; gap: 4px; }

.stock-list { display: flex; flex-direction: column; gap: 12px; }
.stock-row { padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, .02); border: 1px solid var(--border); }
.stock-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.stock-name { font-weight: 700; display: flex; align-items: center; gap: 8px; min-width: 0; }
.stock-nums { font-size: 12.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.tier-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tier-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border-radius: 8px; font-size: 12px; font-weight: 600; background: rgba(255, 255, 255, .04); border: 1px solid var(--border-2); color: var(--text-2); }
.tier-chip b { color: var(--text); font-variant-numeric: tabular-nums; }
.tier-chip i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* =====================================================================
   Accounts page
   ===================================================================== */
.acc-cards { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr)); }
.acc-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: linear-gradient(180deg, rgba(19, 27, 50, .9), rgba(15, 22, 41, .95)); position: relative; min-width: 0; transition: border-color .15s; }
.acc-card:hover { border-color: var(--border-2); }
.acc-card.selected { border-color: rgba(255, 106, 0, .55); box-shadow: 0 0 0 1px rgba(255, 106, 0, .2), 0 14px 34px rgba(255, 70, 0, .1); }
.acc-card-head { display: flex; gap: 14px; align-items: flex-start; }
.acc-card-id { min-width: 0; flex: 1; }
.acc-card-name { font-weight: 800; font-size: 16.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-card-niche { color: var(--text-2); font-size: 13px; margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-card-geo { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; margin-top: 2px; min-width: 0; }
.acc-card-geo .ico { flex: 0 0 auto; color: #ff8a3d; }
.acc-card-geo span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }

/* Account setup form: niche + "Isi dengan AI", country → language hint, AI fill result */
.ai-niche-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; min-width: 0; }
.ai-niche-row > .field { flex: 1 1 240px; }
.ai-niche-row > .ai-fill-btn { flex: 0 0 auto; height: 42px; }
.btn.ai-fill-btn { background: var(--orange-soft); border-color: rgba(255, 122, 26, .45); color: #ffb27a; }
.btn.ai-fill-btn:hover:not(:disabled) { background: rgba(255, 106, 0, .22); border-color: rgba(255, 122, 26, .7); color: #ffd2b0; }
.ai-note { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; background: var(--grad-soft); border: 1px solid rgba(255, 106, 0, .28); animation: fadein .2s ease-out; min-width: 0; }
.ai-note-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.ai-note-meta { font-size: 12px; color: var(--text-2); min-width: 0; word-break: break-word; }
.ai-note-text { font-size: 12.5px; color: #ffd9bd; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.country-lang { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); line-height: 1.45; }
.country-lang strong { color: var(--text-2); font-weight: 600; }
.country-lang-note { display: flex; align-items: flex-start; gap: 6px; color: #fbbf24; }
.country-lang-note .ico { flex: 0 0 auto; margin-top: 1px; }
.field.ai-flash .input { animation: aiflash 1.8s ease-out 1; }
@keyframes aiflash {
  0%, 25% { border-color: rgba(255, 122, 26, .9); box-shadow: 0 0 0 3px rgba(255, 106, 0, .32); background: rgba(255, 106, 0, .12); }
  100% { box-shadow: 0 0 0 3px rgba(255, 106, 0, 0); }
}
@media (max-width: 420px) { .ai-niche-row > .ai-fill-btn { flex: 1 1 100%; } }

/* Persona akun (add + settings modals, account cards) */
.persona-section { display: flex; flex-direction: column; gap: 10px; }
.persona-section > .form-section-desc { margin: 0; }
.persona-head { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; min-width: 0; }
.persona-head .form-section-title { margin: 0; }
.persona-status { display: inline-flex; align-items: center; min-width: 0; }
.persona-guard { display: flex; align-items: flex-start; gap: 8px; margin: 0; padding: 9px 12px; border-radius: 11px; font-size: 12.5px; line-height: 1.5; color: #ffd9bd; background: rgba(255, 106, 0, .07); border: 1px solid rgba(255, 106, 0, .22); }
.persona-guard .ico { flex: 0 0 auto; margin-top: 2px; color: #ff8a3d; }
.persona-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.persona-actions .ai-fill-btn { height: 42px; }
.persona-toggle { margin-left: auto; }
.persona-toggle .ico { display: inline-flex; }
.persona-fields { margin-top: 4px; }
.persona-current { margin: 0; }
.persona-current span:last-child { white-space: normal; overflow-wrap: anywhere; }
.persona-style-grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); min-width: 0; }
.list-chip { height: auto; min-height: 26px; padding: 3px 10px; white-space: normal; word-break: break-word; line-height: 1.35; }
.char-count { align-self: flex-end; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; margin-top: -2px; }
.acc-card-persona { display: flex; align-items: center; gap: 6px; max-width: 100%; color: var(--muted); font-size: 12.5px; margin-top: 2px; min-width: 0; text-align: left; }
.acc-card-persona .ico { flex: 0 0 auto; color: #ff8a3d; }
.acc-card-persona span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
button.acc-card-persona { padding: 0; border: 0; background: none; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--muted-2); font-style: italic; }
button.acc-card-persona .ico { color: var(--muted-2); }
button.acc-card-persona:hover, button.acc-card-persona:focus-visible { color: #ffb27a; }
button.acc-card-persona:hover .ico, button.acc-card-persona:focus-visible .ico { color: #ff8a3d; }
button.acc-card-persona:focus-visible { outline: 2px solid rgba(255, 122, 26, .85); outline-offset: 2px; border-radius: 6px; }
@media (max-width: 420px) {
  .persona-actions .ai-fill-btn { flex: 1 1 100%; }
  .persona-toggle { margin-left: 0; }
}
.token-box { padding: 12px 14px; border-radius: 12px; background: rgba(8, 12, 26, .5); border: 1px solid var(--border); display: flex; flex-direction: column; gap: 8px; }
.token-box-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.token-days { font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; }
.token-days small { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.token-days.ok { color: #4ade80; } .token-days.warn { color: #fbbf24; } .token-days.err { color: #ff7b7b; } .token-days.unk { color: var(--text-2); }
.acc-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.fact { padding: 9px 11px; border-radius: 11px; background: rgba(255, 255, 255, .025); border: 1px solid var(--border); min-width: 0; }
.fact-lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fact-val { font-weight: 700; font-size: 13.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acc-card-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; padding-top: 4px; }
.acc-selector { display: flex; gap: 8px; flex-wrap: wrap; }
.status-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.status-tile { padding: 12px; border-radius: 12px; background: rgba(255, 255, 255, .025); border: 1px solid var(--border); min-width: 0; }
.status-tile .fact-val { font-size: 16px; }
.span-full { grid-column: 1 / -1; }

/* Mode Rawat (care mode): mix bar, stepper, account panel */
.care-mix { display: flex; flex-direction: column; gap: 9px; padding: 12px 14px; border-radius: 12px; background: rgba(20, 184, 166, .06); border: 1px solid rgba(45, 212, 191, .24); min-width: 0; }
.care-mix.is-off { flex-direction: row; align-items: center; gap: 8px; background: rgba(255, 255, 255, .02); border-color: var(--border); color: var(--muted); font-size: 13px; }
.care-mix.is-off .ico { flex: 0 0 auto; }
.care-mix-title { font-size: 13px; color: var(--text-2); line-height: 1.45; word-break: break-word; }
.care-mix-title strong { color: var(--text); font-weight: 700; }
.care-mix-bar { display: flex; gap: 4px; height: 12px; min-width: 0; }
.care-seg { flex: 1 1 0; min-width: 4px; border-radius: 4px; }
.care-seg-neutral { background: linear-gradient(90deg, #14b8a6, #2dd4bf); }
.care-seg-affiliate { background: var(--grad); }
.care-seg-empty { background: rgba(255, 255, 255, .06); }
.care-mix-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12px; color: var(--text-2); }
.care-chip { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.care-chip i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; flex: none; }
.care-chip-neutral i { background: #2dd4bf; }
.care-chip-affiliate i { background: #ff7a1a; }
.care-mix-note { font-size: 12px; color: var(--muted); line-height: 1.45; }
.care-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 16px; align-items: start; }
.care-controls { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.care-step-row { display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .025); border: 1px solid var(--border); }
.care-step-row.is-off { opacity: .6; }
.care-step-label { font-size: 13px; font-weight: 600; color: #d5dbea; }
.care-step-hint { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.care-explain { font-size: 12.5px; color: var(--text-2); line-height: 1.55; margin: 0; }
.care-explain-note { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 0; }
.care-state { display: inline-flex; align-items: center; gap: 8px; }
.stepper { display: inline-flex; align-items: stretch; height: 36px; border: 1px solid var(--border-2); border-radius: 10px; background: rgba(8, 12, 26, .65); overflow: hidden; flex: none; }
.stepper:focus-within { border-color: rgba(255, 122, 26, .75); box-shadow: 0 0 0 3px rgba(255, 106, 0, .16); }
.stepper-btn { width: 36px; border: 0; background: transparent; color: var(--text-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.stepper-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .07); color: var(--text); }
.stepper-btn:disabled { opacity: .35; cursor: not-allowed; }
.stepper-input { width: 46px; border: 0; border-left: 1px solid var(--border); border-right: 1px solid var(--border); background: transparent; color: var(--text); text-align: center; font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.stepper-input::-webkit-inner-spin-button, .stepper-input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.stepper-input:focus { outline: none; }
.stepper.is-disabled { opacity: .55; }

/* =====================================================================
   Settings / help
   ===================================================================== */
.integration-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 12px; }
.integration { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: rgba(255, 255, 255, .02); min-width: 0; }
.integration-main { min-width: 0; flex: 1; }
.integration-name { font-weight: 700; font-size: 13.5px; }
.integration-detail { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.masked { font-family: var(--mono); font-size: 12.5px; color: var(--text-2); background: rgba(255, 255, 255, .04); padding: 3px 8px; border-radius: 7px; border: 1px solid var(--border); word-break: break-all; }
.grow { flex: 1; min-width: 0; }

/* App config (.env settings editable from the dashboard) */
.cfg-tab-label { display: inline-flex; align-items: center; gap: 7px; }
.cfg-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cfg-field { padding: 14px; border-radius: 14px; border: 1px solid var(--border); background: rgba(255, 255, 255, .02); }
.cfg-field:focus-within { border-color: rgba(255, 106, 0, .4); }
.cfg-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.cfg-key { font-family: var(--mono); font-size: 11px; color: var(--muted); word-break: break-all; }
.cfg-clear { margin-top: 2px; }
.cfg-actions { padding-top: 4px; }
.cfg-subcard { background: rgba(255, 255, 255, .018); }
.cfg-wide { grid-column: 1 / -1; }

/* Multi API key list (secret-list) with auto-rotate status */
.skl { gap: 10px; }
.skl-rotate { display: flex; align-items: flex-start; gap: 7px; }
.skl-rotate .ico { color: #ff8a3d; margin-top: 1px; flex: none; }
.skl-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; font-size: 13px; color: var(--text); }
.skl-summary .muted { font-size: 12.5px; }
.skl-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.skl-row { padding: 10px 12px; border-radius: 12px; border: 1px solid var(--border); background: rgba(8, 12, 26, .45); border-left: 3px solid rgba(148, 158, 186, .35); min-width: 0; }
.skl-row.is-ok { border-left-color: rgba(74, 222, 128, .7); }
.skl-row.is-cooldown { border-left-color: rgba(251, 191, 36, .75); }
.skl-row.is-invalid { border-left-color: rgba(255, 120, 120, .75); }
.skl-main { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; min-width: 0; }
.skl-num { font-weight: 700; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 24px; }
.skl-key { font-family: var(--mono); font-size: 12.5px; color: var(--text); background: rgba(255, 255, 255, .04); border: 1px solid var(--border); border-radius: 7px; padding: 2px 8px; flex: 1 1 120px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.skl-counts { display: inline-flex; align-items: center; gap: 10px; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.skl-counts > span { display: inline-flex; align-items: center; gap: 3px; }
.skl-ok .ico { color: #4ade80; } .skl-fail .ico { color: #ff7b7b; }
.skl-del { margin-left: auto; color: var(--muted); }
.skl-del:hover:not(:disabled) { color: #ff7b7b; }
.skl-sub { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 6px; padding-left: 34px; font-size: 11.5px; color: var(--muted); min-width: 0; }
.skl-err { display: block; flex: 1 1 200px; min-width: 0; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #c9a3a3; }
.skl-test { display: flex; align-items: flex-start; gap: 6px; margin-top: 6px; margin-left: 34px; padding: 6px 9px; border-radius: 9px; font-size: 12px; line-height: 1.45; word-break: break-word; border: 1px solid; }
.skl-test .ico { margin-top: 1px; flex: none; }
.skl-test.is-ok { background: rgba(34, 197, 94, .08); border-color: rgba(34, 197, 94, .26); color: #bff3d2; }
.skl-test.is-fail { background: rgba(239, 68, 68, .08); border-color: rgba(239, 68, 68, .28); color: #ffc0c0; }
.skl-empty { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px dashed var(--border-2); background: rgba(255, 255, 255, .015); }
.skl-empty > .ico { color: #ff8a3d; margin-top: 1px; flex: none; }
.skl-empty-title { font-weight: 600; font-size: 13px; color: var(--text); margin-bottom: 2px; }
.skl-link { color: #ff8a3d; display: inline-flex; align-items: center; gap: 4px; text-decoration: underline; text-decoration-color: rgba(255, 138, 61, .45); text-underline-offset: 2px; }
.skl-link:hover { color: #ffa766; }
.skl-add { display: flex; flex-direction: column; gap: 6px; padding-top: 4px; border-top: 1px dashed var(--border); }
.skl-add > .field-label { margin-top: 8px; }
.skl-input { font-family: var(--mono); font-size: 12.5px; min-height: 72px; }
.skl-actions { gap: 8px; }
@media (max-width: 520px) {
  .skl-row { padding: 9px 10px; }
  .skl-sub, .skl-test { padding-left: 0; margin-left: 0; }
  .skl-actions > .btn { flex: 1 1 calc(50% - 8px); }
}

.help-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 22px; align-items: start; }
.help-toc { position: sticky; top: calc(var(--topbar-h) + 20px); display: flex; flex-direction: column; gap: 2px; padding: 10px; border-radius: var(--radius-lg); background: rgba(15, 22, 41, .8); border: 1px solid var(--border); }
.toc-link { padding: 9px 12px; border-radius: 10px; color: var(--text-2); font-size: 13.5px; font-weight: 500; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; text-align: left; }
.toc-link .ico { color: #ff8a3d; }
.toc-link:hover { background: rgba(255, 255, 255, .05); color: var(--text); }
.help-content { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.help-content section { scroll-margin-top: calc(var(--topbar-h) + 16px); }
.prose { color: var(--text-2); font-size: 14px; line-height: 1.7; }
.prose p { margin: 0 0 12px; }
.prose ul, .prose ol { margin: 0 0 12px; padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose strong { color: var(--text); }
.prose h4 { color: var(--text); margin: 18px 0 8px; font-size: 15px; }
.prose > :last-child { margin-bottom: 0; }
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.steps > li { counter-increment: step; position: relative; padding: 14px 14px 14px 56px; border-radius: 14px; background: rgba(255, 255, 255, .02); border: 1px solid var(--border); color: var(--text-2); }
.steps > li::before { content: counter(step); position: absolute; left: 14px; top: 13px; width: 28px; height: 28px; border-radius: 9px; background: var(--grad); color: #fff; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
.steps > li strong { color: var(--text); display: block; margin-bottom: 2px; }
.env-block { font-family: var(--mono); font-size: 12.5px; background: #070b17; border: 1px solid var(--border-2); border-radius: 12px; padding: 14px 16px; overflow-x: auto; white-space: pre; color: #c6cde0; line-height: 1.7; margin: 10px 0 0; }
.env-block .c { color: #66708c; } .env-block .k { color: #ffa766; }
.mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.mode-card { padding: 14px; border-radius: 14px; background: rgba(255, 255, 255, .02); border: 1px solid var(--border); }
.mode-card h5 { margin: 0 0 6px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.mode-card p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.6; }
.tier-table td:first-child { white-space: nowrap; }
.checklist { display: flex; flex-direction: column; gap: 8px; }
.checklist .field { padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .02); border: 1px solid var(--border); }
.tip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 12px; }
.tip { padding: 14px; border-radius: 14px; border: 1px solid rgba(255, 106, 0, .2); background: linear-gradient(160deg, rgba(255, 106, 0, .07), rgba(255, 255, 255, .01)); }
.tip h5 { margin: 0 0 6px; font-size: 14px; display: flex; gap: 8px; align-items: center; color: var(--text); }
.tip h5 .ico { color: #ff8a3d; }
.tip p { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.6; }
.tip .example { margin-top: 8px; font-size: 12.5px; padding: 8px 10px; border-radius: 9px; background: rgba(8, 12, 26, .6); color: #e9ecf5; border-left: 2px solid var(--orange); font-style: italic; }

/* =====================================================================
   Responsive
   ===================================================================== */
@media (max-width: 1500px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .camp-health { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .camp-health .cta-tile { grid-column: 1 / -1; }
}
@media (max-width: 1280px) {
  :root { --gutter: 22px; }
  .dash-grid-2, .dash-grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .status-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: none; width: min(300px, 86vw); }
  body.drawer-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  body.drawer-open { overflow: hidden; }
  .icon-btn.sidebar-close { display: inline-flex; }
  .main { margin-left: 0; }
  .icon-btn.menu-btn { display: inline-flex; }
  .help-layout { grid-template-columns: minmax(0, 1fr); }
  .help-toc { position: static; flex-direction: row; flex-wrap: wrap; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  :root { --gutter: 16px; --topbar-h: 66px; }
  .topbar { gap: 8px; }
  .search-trigger { height: 42px; padding: 0 12px; }
  .search-placeholder, .search-trigger .kbd { display: none; }
  .search-trigger { flex: 0 0 auto; width: 42px; justify-content: center; padding: 0; margin-left: auto; }
  .topbar-right { margin-left: 0; gap: 6px; }
  .topbar-divider, .user-meta, .user-caret { display: none; }
  .user-avatar { width: 38px; height: 38px; font-size: 16px; }
  .bell-btn { width: 42px; height: 42px; }
  /* The bell sits left of the avatar, so a right-anchored 380px panel would spill off the left edge.
     Pin it to the viewport instead (the topbar spans the full width from the origin at this size). */
  .dropdown-notif { position: fixed; top: calc(var(--topbar-h) + 6px); left: 12px; right: 12px; width: auto; min-width: 0; }
  .view { padding-top: 16px; }
  .page { gap: 16px; }
  .page-title { font-size: 20px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat-card { min-height: 140px; padding: 14px; }
  .stat-ico { width: 34px; height: 34px; }
  .stat-value { font-size: 23px; margin-top: 8px; }
  .stat-sub { max-width: 100%; }
  .metric-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .grid-3, .grid-4, .form-grid, .cfg-grid { grid-template-columns: minmax(0, 1fr); }
  .camp-health { grid-template-columns: minmax(0, 1fr); }
  .insight-grid { grid-template-columns: minmax(0, 1fr); }
  .acc-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .care-panel { grid-template-columns: minmax(0, 1fr); }
  .card-head { padding: 16px 16px 0; }
  .card-body { padding: 14px 16px 16px; }
  .modal-overlay { padding: 0; align-items: flex-end; }
  .modal { border-radius: 20px 20px 0 0; max-height: 94dvh; }
  .modal-palette { border-radius: 0 0 20px 20px; align-self: flex-start; }
  .modal-body { padding: 12px 16px 18px; }
  .modal-head { padding: 16px 16px 4px; }
  .modal-foot { padding: 12px 16px 16px; border-radius: 0; }
  .toast-stack { right: 16px; left: 16px; bottom: 16px; width: auto; }
  .health-row { grid-template-columns: 38px minmax(0, 1fr) 20px; }
  .health-row .progress { grid-column: 2 / 3; grid-row: 2; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .kv dd { margin-bottom: 8px; }

  /* stacked tables */
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { padding: 10px 12px; border-bottom: 1px solid var(--border); }
  .tbl tr:last-child { border-bottom: 0; }
  .tbl td { padding: 5px 0; border: 0; display: grid; grid-template-columns: minmax(84px, 36%) minmax(0, 1fr); gap: 10px; text-align: left !important; word-break: break-word; }
  .tbl td::before { content: attr(data-label); color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; padding-top: 2px; }
  .tbl td[data-label=""] { grid-template-columns: minmax(0, 1fr); }
  .tbl td[data-label=""]::before { display: none; }
  .tbl-empty-row td { grid-template-columns: minmax(0, 1fr); }
  .tbl-empty-row td::before { display: none; }
  .table-wrap { overflow-x: visible; }
}
@media (max-width: 420px) {
  .stats-grid { gap: 10px; }
  .stat-card { min-height: 128px; padding: 12px; }
  .stat-top { gap: 8px; }
  .stat-ico { width: 30px; height: 30px; border-radius: 9px; }
  .stat-ico .i { width: 16px; height: 16px; }
  .stat-label { font-size: 12.5px; }
  .stat-value { font-size: 20px; }
  .stat-sub { font-size: 11.5px; }
  .delta { font-size: 12.5px; }
  .stat-spark { width: 70%; height: 50%; }
  .acc-facts { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tabs { width: 100%; }
  .tab { flex: 1; justify-content: center; padding: 7px 10px; }
  .btn { padding: 0 13px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1 1 auto; }
  .status-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .login-card { padding: 28px 20px 22px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
