/* BESH Admin — design tokens, layout and components. Light and dark themes. */
:root {
  --bg: #f6f5f2; --surface: #ffffff; --surface-2: #faf9f7; --surface-3: #f1efeb;
  --border: #e7e3dc; --border-strong: #d6d1c8;
  --text: #1d1a16; --text-2: #4a453e; --muted: #847d72;
  --accent: #c2410c; --accent-hover: #9a3412; --accent-soft: #fff1e8; --accent-text: #9a3412;
  --sidebar: #17140f; --sidebar-2: #221e18; --sidebar-text: #cfc8bc; --sidebar-muted: #8b8377; --sidebar-active: #2d2820;
  --green: #15803d; --green-soft: #e8f6ec; --amber: #b45309; --amber-soft: #fdf3e1; --red: #b91c1c; --red-soft: #fdecec;
  --blue: #1d4ed8; --blue-soft: #e9effd; --violet: #6d28d9; --violet-soft: #f1ebfd; --orange: #c2410c; --orange-soft: #fff1e8;
  --c1: #c2410c; --c2: #2563eb; --c3: #0f766e; --c4: #a16207; --c5: #7c3aed; --c6: #be185d;
  --radius: 12px; --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(29, 26, 22, .05);
  --shadow: 0 1px 3px rgba(29, 26, 22, .06), 0 6px 16px -8px rgba(29, 26, 22, .10);
  --shadow-lg: 0 20px 50px -12px rgba(29, 26, 22, .30);
  --font: "Inter", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #12100d; --surface: #1b1814; --surface-2: #211d18; --surface-3: #29241e;
  --border: #2f2a23; --border-strong: #3d372e;
  --text: #f1ece4; --text-2: #cfc7bb; --muted: #958c7f;
  --accent: #f97316; --accent-hover: #fb923c; --accent-soft: #3a2113; --accent-text: #fdba74;
  --sidebar: #0d0b09; --sidebar-2: #161310; --sidebar-active: #241f19;
  --green: #4ade80; --green-soft: #13291b; --amber: #fbbf24; --amber-soft: #2e2410; --red: #f87171; --red-soft: #321515;
  --blue: #93b4fd; --blue-soft: #16213b; --violet: #c4b5fd; --violet-soft: #251b3d; --orange: #fb923c; --orange-soft: #3a2113;
  --c1: #f97316; --c2: #60a5fa; --c3: #2dd4bf; --c4: #facc15; --c5: #a78bfa; --c6: #f472b6;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 6px 16px -8px rgba(0, 0, 0, .5);
  --shadow-lg: 0 20px 50px -12px rgba(0, 0, 0, .7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01", "tnum"; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.015em; }
.icon { flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--muted); } .small { font-size: 12px; } .mono { font-family: var(--mono); font-size: 12px; }
.nowrap { white-space: nowrap; } .right { text-align: right; } .grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 10px; } .row-wrap { flex-wrap: wrap; } .stack { display: flex; flex-direction: column; gap: 4px; }
.between { justify-content: space-between; } .gap-lg { gap: 16px; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { color: var(--accent-text); font-weight: 500; cursor: pointer; } .link:hover { text-decoration: underline; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 18px; }
.brand-mark { width: 32px; height: 32px; border-radius: 9px; background: linear-gradient(135deg, #f97316, #c2410c); display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 15px; letter-spacing: -0.04em; box-shadow: 0 4px 14px -4px rgba(249, 115, 22, .6); }
.brand-name { font-weight: 700; color: #fff; font-size: 15px; letter-spacing: -0.01em; }
.brand-sub { font-size: 11px; color: var(--sidebar-muted); }
.nav { padding: 4px 10px 16px; flex: 1; }
.nav-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--sidebar-muted); padding: 16px 10px 6px; font-weight: 600; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px; color: var(--sidebar-text); font-weight: 500; font-size: 13.5px; transition: background .12s, color .12s; }
.nav a:hover { background: var(--sidebar-2); color: #fff; }
.nav a.active { background: var(--sidebar-active); color: #fff; box-shadow: inset 2px 0 0 #f97316; }
.nav a .icon { opacity: .85; }
.nav-badge { margin-left: auto; background: #f97316; color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 18px; padding: 0 6px; border-radius: 9px; display: grid; place-items: center; }
.nav-badge.soft { background: var(--sidebar-active); color: var(--sidebar-text); }
.sidebar-foot { padding: 14px; border-top: 1px solid var(--sidebar-2); display: flex; align-items: center; gap: 10px; }
.sidebar-foot .who { min-width: 0; flex: 1; } .sidebar-foot .who b { color: #fff; font-size: 13px; display: block; } .sidebar-foot .who span { font-size: 11.5px; color: var(--sidebar-muted); }
.sidebar-foot .icon-btn { color: var(--sidebar-muted); } .sidebar-foot .icon-btn:hover { background: var(--sidebar-2); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 28px; background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.search-trigger { display: flex; align-items: center; gap: 10px; width: min(440px, 100%); padding: 8px 12px; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; color: var(--muted); cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color .15s; }
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger kbd { margin-left: auto; }
kbd { font-family: var(--font); font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--border); background: var(--surface-2); color: var(--muted); }
.mode-pill { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.mode-pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-green { background: var(--green-soft); color: var(--green); } .pill-blue { background: var(--blue-soft); color: var(--blue); }
.pill-violet { background: var(--violet-soft); color: var(--violet); } .pill-orange { background: var(--orange-soft); color: var(--orange); }
.pill-amber { background: var(--amber-soft); color: var(--amber); }
.mode-pill:not(.pill-amber) > i { animation: pulse 2s infinite; }
/* Server switch: the pill opens a menu of servers. */
.env-switch { position: relative; }
button.mode-pill { border: 0; cursor: pointer; font-family: inherit; line-height: 1.4; }
button.mode-pill:hover { filter: brightness(.96); } [data-theme="dark"] button.mode-pill:hover { filter: brightness(1.15); }
button.mode-pill:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
.mode-pill .icon { margin: 0 -3px 0 -1px; opacity: .75; transition: transform .15s; }
.mode-pill[aria-expanded="true"] .icon { transform: rotate(180deg); }
.env-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; width: 300px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.env-menu-head { padding: 6px 10px 4px; font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.env-menu-foot { margin-top: 4px; padding: 8px 10px 4px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.env-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.env-item:hover:not([disabled]), .env-item:focus-visible { background: var(--surface-3); outline: none; }
.env-item[disabled] { cursor: not-allowed; opacity: .55; }
.env-item[aria-checked="true"] { background: var(--surface-2); }
.env-item > .icon { margin-left: auto; color: var(--accent); flex: none; }
.env-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: currentColor; }
.env-dot.pill-green { color: var(--green); } .env-dot.pill-blue { color: var(--blue); } .env-dot.pill-violet { color: var(--violet); } .env-dot.pill-orange { color: var(--orange); }
.env-item-text { display: flex; flex-direction: column; min-width: 0; }
.env-item-text b { font-size: 13px; font-weight: 600; }
.env-item-text small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.bell { position: relative; } .bell .dot { position: absolute; top: 4px; right: 4px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--bg); }
.content { padding: 24px 28px 64px; max-width: 1480px; width: 100%; }
.icon-btn.menu-btn { display: none; }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; } .crumbs a:hover { color: var(--text); }

/* ---------- cards & grids ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.card-head h3 { font-size: 14px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.card-head .sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.card-body { padding: 16px 18px; } .card-body.flush { padding: 0; }
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-main { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); } .g-side { grid-template-columns: 340px minmax(0, 1fr); }
.mt { margin-top: 16px; } .mt-lg { margin-top: 24px; } .mb { margin-bottom: 16px; }

.kpi { padding: 16px 18px; position: relative; overflow: hidden; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: 26px; font-weight: 700; letter-spacing: -0.03em; margin-top: 6px; }
.kpi-sub { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; gap: 8px; flex-wrap: wrap; }
.kpi-sub b { color: var(--text-2); font-weight: 600; }
.kpi .spark { position: absolute; right: 14px; bottom: 14px; opacity: .9; }
.kpi-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); position: absolute; right: 14px; top: 14px; }
a.kpi:hover { border-color: var(--border-strong); }

/* attention queue */
.attention { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.attn { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); transition: border-color .15s, transform .15s; }
.attn:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.attn-n { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; min-width: 28px; }
.attn-t { font-size: 12.5px; color: var(--text-2); line-height: 1.3; }
.attn.hot { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); background: linear-gradient(0deg, var(--accent-soft), var(--surface) 140%); }
.attn.hot .attn-n { color: var(--accent-text); }
.attn.zero .attn-n { color: var(--muted); }

/* ---------- badges / pills ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; line-height: 1.5; }
.badge-green { background: var(--green-soft); color: var(--green); } .badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red-soft); color: var(--red); } .badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-violet { background: var(--violet-soft); color: var(--violet); } .badge-orange { background: var(--orange-soft); color: var(--orange); }
.badge-neutral { background: var(--surface-3); color: var(--text-2); }
.pill-proposed { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--violet-soft); color: var(--violet); border: 1px dashed color-mix(in srgb, var(--violet) 40%, transparent); white-space: nowrap; cursor: help; vertical-align: middle; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 12.5px; font-weight: 500; cursor: pointer; color: var(--text-2); transition: all .12s; }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip .n { font-size: 11px; opacity: .7; }

/* ---------- buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px; border: 1px solid transparent; font-weight: 550; font-size: 13px; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; } .btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-danger { background: var(--red); color: #fff; } .btn-danger:hover:not(:disabled) { filter: brightness(.92); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text-2); } .btn-ghost:hover:not(:disabled) { border-color: var(--border-strong); color: var(--text); }
.btn-soft { background: var(--surface-3); color: var(--text); } .btn-soft:hover { background: var(--border); }
.btn-success { background: var(--green); color: #fff; } [data-theme="dark"] .btn-success { color: #08200f; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn.loading { position: relative; color: transparent !important; } .btn.loading::after { content: ""; position: absolute; width: 14px; height: 14px; border: 2px solid #fff; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.btn-ghost.loading::after { border-color: var(--text); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }
.icon-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; border: 0; background: transparent; color: var(--text-2); cursor: pointer; }
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
input:not([type]), input[type=text], input[type=search], input[type=email], input[type=password], input[type=number], input[type=date], input[type=datetime-local], input[type=url], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); outline: none; transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
textarea { resize: vertical; min-height: 72px; }
.input-icon { position: relative; } .input-icon .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); } .input-icon input { padding-left: 34px; }
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .input-icon { width: 300px; max-width: 100%; }
.toolbar select { width: auto; min-width: 140px; }
.field { margin-bottom: 14px; } .field label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 6px; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 5px; } .req { color: var(--red); margin-left: 2px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.switch { position: relative; width: 36px; height: 20px; flex: none; } .switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border-strong); border-radius: 20px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--accent); } .switch input:checked + span::before { transform: translateX(16px); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr.clickable { cursor: pointer; } .table tbody tr.clickable:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-user { display: flex; align-items: center; gap: 10px; min-width: 0; } .cell-user b { font-weight: 600; display: block; } .cell-user span { font-size: 12px; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-top: 1px solid var(--border); gap: 10px; }
.pager-btns { display: flex; gap: 6px; }

.avatar { display: inline-grid; place-items: center; border-radius: 50%; flex: none; font-weight: 650; color: hsl(var(--h, 20) 55% 30%); background: hsl(var(--h, 20) 70% 90%); letter-spacing: -0.02em; object-fit: cover; }
[data-theme="dark"] .avatar { color: hsl(var(--h, 20) 70% 82%); background: hsl(var(--h, 20) 35% 22%); }
.thumb { position: relative; display: inline-grid; place-items: center; flex: none; border-radius: 8px; overflow: hidden; background: linear-gradient(135deg, hsl(var(--h) 60% 88%), hsl(calc(var(--h) + 30) 55% 78%)); color: hsl(var(--h) 45% 28%); font-weight: 700; font-size: 12px; }
[data-theme="dark"] .thumb { background: linear-gradient(135deg, hsl(var(--h) 30% 24%), hsl(calc(var(--h) + 30) 30% 18%)); color: hsl(var(--h) 60% 80%); }
.thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tab { border: 0; background: none; padding: 10px 14px; font-weight: 550; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.tab:hover { color: var(--text); } .tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-count { font-size: 11px; background: var(--surface-3); color: var(--text-2); padding: 0 6px; border-radius: 8px; min-width: 18px; text-align: center; }

/* ---------- kv ---------- */
.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 9px 16px; margin: 0; font-size: 13.5px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------- profile header ---------- */
.profile-head { display: flex; gap: 18px; align-items: center; padding: 20px; }
.profile-head h2 { font-size: 22px; font-weight: 700; }
.profile-meta { display: flex; gap: 8px 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; margin-top: 6px; align-items: center; }
.profile-meta span { display: inline-flex; align-items: center; gap: 5px; }
.profile-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); border-top: 1px solid var(--border); }
.stat-strip > div { padding: 14px 20px; border-right: 1px solid var(--border); } .stat-strip > div:last-child { border-right: 0; }
.stat-strip b { display: block; font-size: 18px; font-weight: 700; letter-spacing: -0.02em; } .stat-strip span { font-size: 12px; color: var(--muted); }

/* ---------- timeline / feed ---------- */
.timeline { position: relative; padding-left: 4px; }
.tl-day { font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin: 18px 0 8px; }
.tl-day:first-child { margin-top: 0; }
.tl-item { display: flex; gap: 12px; padding: 7px 0; position: relative; }
.tl-item::before { content: ""; position: absolute; left: 13px; top: 34px; bottom: -8px; width: 1px; background: var(--border); }
.tl-item:last-child::before { display: none; }
.tl-icon { width: 27px; height: 27px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface-3); color: var(--text-2); z-index: 1; }
.tl-icon.t-green { background: var(--green-soft); color: var(--green); } .tl-icon.t-blue { background: var(--blue-soft); color: var(--blue); }
.tl-icon.t-amber { background: var(--amber-soft); color: var(--amber); } .tl-icon.t-red { background: var(--red-soft); color: var(--red); }
.tl-icon.t-violet { background: var(--violet-soft); color: var(--violet); } .tl-icon.t-orange { background: var(--orange-soft); color: var(--orange); }
.tl-body { flex: 1; min-width: 0; padding-top: 3px; } .tl-title { font-size: 13.5px; } .tl-title b { font-weight: 600; }
.tl-meta { font-size: 12px; color: var(--muted); margin-top: 1px; }
.tl-time { font-size: 12px; color: var(--muted); white-space: nowrap; padding-top: 4px; }
.feed-item { display: flex; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--border); align-items: flex-start; }
.feed-item:last-child { border-bottom: 0; }
.feed-item:hover { background: var(--surface-2); }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; animation: pulse 1.6s infinite; }

/* ---------- chat ---------- */
.chat-layout { display: grid; grid-template-columns: 330px 1fr; grid-template-rows: minmax(0, 1fr); height: calc(100vh - 210px); min-height: 520px; overflow: hidden; }
.chat-list { border-right: 1px solid var(--border); overflow-y: auto; }
.chat-row { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); cursor: pointer; align-items: flex-start; }
.chat-row:hover { background: var(--surface-2); } .chat-row.active { background: var(--accent-soft); }
.chat-row .preview { font-size: 12.5px; color: var(--muted); } .chat-row.unread .preview { color: var(--text); font-weight: 550; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; margin-top: 6px; }
.chat-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; }
.chat-pane-head { padding: 12px 18px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.chat-messages { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 18px; display: flex; flex-direction: column; gap: 6px; background: var(--surface-2); }
.msg { max-width: 72%; display: flex; flex-direction: column; gap: 2px; }
.msg-bubble { padding: 8px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; align-items: flex-end; } .msg.me .msg-bubble { background: var(--accent); color: #fff; border-color: transparent; border-bottom-right-radius: 4px; }
.msg.them .msg-bubble { border-bottom-left-radius: 4px; }
.msg.side-b { align-self: flex-end; align-items: flex-end; } .msg.side-b .msg-bubble { background: var(--blue-soft); border-color: transparent; border-bottom-right-radius: 4px; }
.msg.notice { align-self: center; max-width: 85%; } .msg.notice .msg-bubble { background: var(--amber-soft); border: 0; color: var(--amber); font-size: 12.5px; text-align: center; border-radius: 8px; }
.msg-meta { font-size: 11px; color: var(--muted); padding: 0 4px; }
.msg-day { align-self: center; font-size: 11px; color: var(--muted); background: var(--surface); border: 1px solid var(--border); padding: 2px 10px; border-radius: 999px; margin: 10px 0; }
.chat-compose { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-compose textarea { min-height: 40px; max-height: 140px; resize: none; }

/* ---------- charts ---------- */
.chart-wrap { width: 100%; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke-width: 2.2; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart .area { opacity: .1; }
.chart .hover-line { stroke: var(--border-strong); stroke-dasharray: 3 3; }
.chart .hover-dot { stroke: var(--surface); stroke-width: 2; }
.chart .bar { transition: opacity .15s; } .chart .bar:hover { opacity: .8; }
.chart-tip { position: fixed; z-index: 100; pointer-events: none; opacity: 0; transition: opacity .1s; background: var(--text); color: var(--bg); padding: 8px 10px; border-radius: 8px; font-size: 12px; box-shadow: var(--shadow-lg); min-width: 120px; }
.tip-label { font-weight: 600; margin-bottom: 4px; opacity: .8; } .tip-row { display: flex; align-items: center; gap: 6px; } .tip-row b { margin-left: auto; padding-left: 12px; }
.tip-row i, .legend i, .donut-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex: none; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-bottom: 8px; } .legend span { display: inline-flex; align-items: center; gap: 6px; }
.barlist { display: flex; flex-direction: column; gap: 6px; }
.barlist-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 10px; border-radius: 6px; font-size: 13px; overflow: hidden; }
a.barlist-row:hover .barlist-label { text-decoration: underline; }
.barlist-fill { position: absolute; left: 0; top: 0; bottom: 0; opacity: .13; border-radius: 6px; }
.barlist-label { position: relative; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .barlist-value { position: relative; font-weight: 600; font-variant-numeric: tabular-nums; }
.funnel { display: flex; flex-direction: column; gap: 14px; }
.funnel-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; } .funnel-head b { font-variant-numeric: tabular-nums; }
.funnel-track { height: 10px; background: var(--surface-3); border-radius: 5px; overflow: hidden; }
.funnel-bar { height: 100%; background: linear-gradient(90deg, var(--c1), color-mix(in srgb, var(--c1) 70%, #fbbf24)); border-radius: 5px; }
.funnel-sub { margin-top: 4px; }
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut circle { fill: none; stroke-width: 16; } .donut .donut-bg { stroke: var(--surface-3); }
.donut-center { font-size: 22px; font-weight: 700; fill: var(--text); } .donut-sub { font-size: 10px; fill: var(--muted); }
.donut-legend { display: flex; flex-direction: column; gap: 6px; font-size: 13px; flex: 1; min-width: 150px; }
.donut-legend > div { display: flex; align-items: center; gap: 8px; } .donut-legend b { margin-left: auto; font-variant-numeric: tabular-nums; }
.spark polyline { fill: none; stroke-width: 1.8; stroke-linejoin: round; }
.meter { height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; } .meter > div { height: 100%; border-radius: 3px; }

/* ---------- feedback ---------- */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 40px 20px; text-align: center; color: var(--muted); }
.empty .icon { opacity: .6; margin-bottom: 4px; } .empty-title { font-weight: 600; color: var(--text-2); } .empty-text { font-size: 13px; max-width: 420px; }
.error-box { display: flex; gap: 10px; padding: 14px 16px; border-radius: 10px; background: var(--red-soft); color: var(--red); font-size: 13px; margin: 12px; }
.error-box b { display: block; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 10px; font-size: 13px; line-height: 1.5; }
.notice .icon { margin-top: 1px; }
.notice-warn { background: var(--amber-soft); color: var(--amber); } .notice-info { background: var(--blue-soft); color: var(--blue); }
.notice-danger { background: var(--red-soft); color: var(--red); } .notice-proposed { background: var(--violet-soft); color: var(--violet); }
.notice b { font-weight: 650; }
.notice code, .notice-proposed code { font-family: var(--mono); font-size: 12px; background: color-mix(in srgb, currentColor 10%, transparent); padding: 1px 5px; border-radius: 4px; }
.skeleton-wrap { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.skeleton { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
#toasts { position: fixed; bottom: 20px; right: 20px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 13.5px; box-shadow: var(--shadow-lg); transform: translateY(10px); opacity: 0; transition: .25s; max-width: 420px; }
.toast.show { transform: none; opacity: 1; }
.toast-ok .icon { color: #4ade80; } .toast-error { background: var(--red); color: #fff; } .toast-warn .icon { color: #fbbf24; }

/* ---------- modal & drawer ---------- */
.modal-backdrop, .drawer-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(15, 12, 8, .45); opacity: 0; transition: opacity .2s; }
.modal-backdrop { display: grid; place-items: center; padding: 20px; }
.modal-backdrop.show, .drawer-backdrop.show { opacity: 1; }
.modal { background: var(--surface); border-radius: 14px; width: min(480px, 100%); box-shadow: var(--shadow-lg); transform: translateY(8px) scale(.98); transition: transform .2s; max-height: calc(100vh - 40px); display: flex; flex-direction: column; }
.modal-wide { width: min(680px, 100%); }
.show .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 0; } .modal-head h3 { font-size: 16px; }
.modal-body { padding: 16px 20px 6px; overflow-y: auto; } .modal-body > p { margin: 0 0 14px; color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.form-error { background: var(--red-soft); color: var(--red); padding: 9px 12px; border-radius: 8px; font-size: 13px; margin-bottom: 12px; }
.drawer { position: absolute; right: 0; top: 0; bottom: 0; background: var(--bg); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .25s cubic-bezier(.2, .8, .2, 1); }
.show .drawer { transform: none; }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--border); background: var(--surface); } .drawer-head h3 { font-size: 17px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 18px 20px 40px; }
.drawer-body .card + .card { margin-top: 14px; }

/* ---------- command palette ---------- */
.palette-backdrop { position: fixed; inset: 0; z-index: 95; background: rgba(15, 12, 8, .4); display: flex; justify-content: center; padding-top: 12vh; }
.palette { width: min(620px, 92vw); background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); overflow: hidden; align-self: flex-start; border: 1px solid var(--border); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.palette-input input { border: 0; padding: 0; font-size: 16px; box-shadow: none !important; background: transparent; }
.palette-list { max-height: 400px; overflow-y: auto; padding: 6px; }
.palette-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 10px 4px; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.palette-item.sel { background: var(--accent-soft); } .palette-item .hint { margin-left: auto; font-size: 12px; color: var(--muted); }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-art { background: radial-gradient(1200px 600px at 10% 0%, #3a1d0c 0%, transparent 60%), radial-gradient(800px 500px at 100% 100%, #5b2208 0%, transparent 60%), #120e0a; color: #f1ece4; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art h1 { font-size: 40px; line-height: 1.1; font-weight: 750; letter-spacing: -0.035em; max-width: 520px; }
.login-art p { color: #b9ae9f; max-width: 460px; font-size: 15px; }
.login-feats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 520px; }
.login-feats div { display: flex; gap: 10px; align-items: center; font-size: 13.5px; color: #d9cfc1; }
.login-feats .icon { color: #fb923c; }
.login-form-wrap { display: grid; place-items: center; padding: 40px; background: var(--bg); }
.login-form { width: min(380px, 100%); }
.login-form h2 { font-size: 22px; margin-bottom: 4px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 20px 0; } .divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
details.adv summary { cursor: pointer; font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }

.json { font-family: var(--mono); font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px; white-space: pre-wrap; overflow-wrap: anywhere; max-height: 240px; overflow: auto; margin: 0; }
.seg-row { display: flex; align-items: center; gap: 10px; padding: 9px 18px; border-bottom: 1px solid var(--border); cursor: pointer; }
.seg-row:hover { background: var(--surface-2); } .seg-row.active { background: var(--accent-soft); } .seg-row:last-child { border-bottom: 0; }
.seg-row .n { margin-left: auto; font-weight: 650; font-variant-numeric: tabular-nums; }
.channel-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.field .channel, .channel { margin: 0; border: 1px solid var(--border); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: pointer; font-size: 12.5px; font-weight: 550; color: var(--text-2); }
.channel:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.channel input { display: none; }
.sensitive { display: inline-flex; align-items: center; gap: 6px; }
.sensitive button { border: 0; background: none; color: var(--accent-text); font-size: 12px; cursor: pointer; padding: 0; font-weight: 600; }

/* ---------- responsive ---------- */
@media (max-width: 1200px) { .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g-main, .g-side { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 80; width: 260px; transform: translateX(-100%); transition: transform .25s; }
  .sidebar.open { transform: none; box-shadow: var(--shadow-lg); }
  .icon-btn.menu-btn { display: grid; } .content { padding: 18px 16px 48px; } .topbar { padding: 10px 16px; }
  .g-2, .g-3 { grid-template-columns: 1fr; } .chat-layout { grid-template-columns: 1fr; } .chat-list { max-height: 260px; border-right: 0; border-bottom: 1px solid var(--border); }
  .login { grid-template-columns: 1fr; } .login-art { display: none; }
  .profile-head { flex-wrap: wrap; } .profile-actions { margin-left: 0; justify-content: flex-start; }
}

/* clickable rows and notification alerts */
.feed-item.clickable, .tl-item.clickable, tr.clickable { cursor: pointer; }
.feed-item.clickable > .icon:last-child { color: var(--muted); align-self: center; opacity: 0; transition: opacity .15s; }
.feed-item.clickable:hover > .icon:last-child { opacity: 1; }
.tl-item.clickable { border-radius: 8px; margin: 0 -8px; padding-left: 8px; padding-right: 8px; }
.tl-item.clickable:hover { background: var(--surface-2); }
.tl-item.clickable:hover .tl-title { color: var(--accent-text); }
.tl-go { color: var(--muted); padding-top: 5px; opacity: 0; } .tl-item.clickable:hover .tl-go { opacity: 1; }
.toast-alert { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-left: 4px solid var(--accent); align-items: flex-start; cursor: pointer; width: 360px; max-width: calc(100vw - 40px); }
.toast-alert:hover { border-color: var(--accent); }
.toast-alert .alert-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.toast-alert .alert-msg { font-size: 12.5px; color: var(--text-2); margin-top: 2px; }
.toast-alert .alert-cta { font-size: 12px; font-weight: 600; color: var(--accent-text); margin-top: 6px; display: inline-flex; align-items: center; gap: 4px; }
.toast-alert .icon-btn { width: 26px; height: 26px; margin: -4px -6px 0 0; }
.badge-btn { border: 0; cursor: pointer; font: inherit; font-size: 11.5px; font-weight: 600; transition: transform .1s, box-shadow .1s; }
.badge-btn .icon { opacity: .55; }
.badge-btn:hover { box-shadow: 0 0 0 2px var(--accent); transform: translateY(-1px); }
.badge-btn:hover .icon { opacity: 1; }
/* quick chat panel and row actions */
.drawer-body.qc-body { padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.qc-bar { display: flex; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap; }
.qc-msgs { flex: 1; min-height: 0; }
.row-actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: nowrap; }
.row-actions .btn-sm { padding: 0 8px; }
.act-chat { position: relative; }
.act-chat.has-unread { border-color: var(--accent); color: var(--accent-text); background: var(--accent-soft); }
.unread-pill { background: var(--accent); color: #fff; font-size: 10px; font-weight: 700; border-radius: 8px; min-width: 16px; height: 16px; padding: 0 4px; display: inline-grid; place-items: center; margin-left: 2px; }

/* ---------- newer screens: catalogue, Explore, releases, media, automations ---------- */
.img-preview { position: relative; display: inline-grid; place-items: center; border-radius: 8px; background: var(--surface-3); color: var(--muted); overflow: hidden; flex: none; border: 1px solid var(--border); }
.img-preview img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.ship-steps { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.ship-steps span { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--surface-3); color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.ship-steps span.done { background: var(--green-soft); color: var(--green); }
.tl-mini { padding: 7px 0; border-top: 1px solid var(--border); font-size: 13px; }
.tl-mini:first-child { border-top: 0; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; border: 1px solid var(--border-strong); vertical-align: -2px; }
.banner-card { display: grid; grid-template-columns: 200px 1fr auto; gap: 14px; align-items: center; padding: 12px 16px; border-top: 1px solid var(--border); }
.banner-card:first-child { border-top: 0; }
.banner-thumb { width: 200px; height: 100px; border-radius: 10px; display: flex; align-items: flex-end; padding: 10px; color: #fff; font-weight: 700; font-size: 13px; position: relative; overflow: hidden; }
.banner-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.banner-thumb span { position: relative; text-shadow: 0 1px 3px rgba(0,0,0,.4); }
.camp-card { border-radius: 12px; padding: 16px; min-height: 150px; display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; position: relative; overflow: hidden; }
.camp-card .eyebrow { font-size: 11px; letter-spacing: .12em; font-weight: 700; opacity: .85; }
.camp-card .title { font-size: 20px; font-weight: 800; }
.camp-card .cta { margin-top: 8px; align-self: flex-start; font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,.18); }
.order-btns { display: inline-flex; flex-direction: column; gap: 2px; }
.order-btns button { border: 0; background: none; padding: 0 4px; color: var(--muted); cursor: pointer; line-height: 1; }
.order-btns button:hover { color: var(--text); }
.order-btns button:disabled { opacity: .3; cursor: default; }
.score-bar { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; width: 70px; display: inline-block; vertical-align: middle; }
.score-bar i { display: block; height: 100%; background: var(--accent); }
.email-frame { width: 100%; height: 640px; border: 1px solid var(--border); border-radius: 10px; background: #fff; }
.term { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border-radius: 999px; border: 1px solid var(--border); margin: 3px; font-size: 13px; background: var(--surface); }
.term.off { opacity: .5; text-decoration: line-through; }
.term button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0 2px; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.media-grid .tile { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--surface); }
.media-grid .tile .img-preview { width: 100% !important; height: 110px !important; border: 0; border-radius: 0; }
.media-grid .tile .meta { padding: 8px 10px; font-size: 12px; }
.json-edit { width: 100%; min-height: 120px; font-family: var(--mono, ui-monospace, monospace); font-size: 12.5px; }
.cfg-section { border-top: 1px solid var(--border); padding: 14px 18px; }
.cfg-section:first-child { border-top: 0; }
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 16px; margin-top: 10px; }
.cfg-grid label { font-size: 12.5px; color: var(--text-2); display: block; margin-bottom: 3px; }
.key-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin-top: 8px; }
.key-grid label { display: flex; gap: 6px; align-items: center; font-size: 12.5px; font-family: var(--mono, ui-monospace, monospace); }

@media (max-width: 900px) { .banner-card { grid-template-columns: 1fr; } .banner-thumb { width: 100%; height: 120px; } }

/* show/hide password */
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 40px; }
.pw-toggle { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; border: 0; background: none; border-radius: 6px; display: grid; place-items: center; color: var(--muted); cursor: pointer; }
.pw-toggle:hover { color: var(--text); background: var(--surface-3); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.chat-mismatch { margin: 0; border-radius: 0; border-left: 0; border-right: 0; }
.chat-older { align-self: center; margin-bottom: 6px; }

/* ---------- product photos: gallery, full-screen viewer, photo cards ---------- */
.gallery-main { position: relative; display: grid; place-items: center; width: 100%; height: 420px; padding: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: zoom-in; background: var(--surface-3); }
.gallery-main img, .gallery-main video { width: 100%; height: 100%; object-fit: contain; }
.gallery-main img.broken, .gallery-thumb img.broken { visibility: hidden; }
.gallery-count, .gallery-zoom { position: absolute; bottom: 10px; padding: 3px 9px; border-radius: 999px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px; }
.gallery-count { left: 10px; } .gallery-zoom { right: 10px; opacity: 0; transition: opacity .15s; }
.gallery-main:hover .gallery-zoom, .gallery-main:focus-visible .gallery-zoom { opacity: 1; }
.gallery-play { position: absolute; inset: 0; margin: auto; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .55); color: #fff; pointer-events: none; }
.gallery-play.small { width: 26px; height: 26px; }
.gallery-strip, .lb-strip { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; }
.gallery-thumb { position: relative; flex: none; width: 64px; height: 64px; padding: 0; border: 2px solid transparent; border-radius: 8px; overflow: hidden; cursor: pointer; background: var(--surface-3); opacity: .75; transition: opacity .12s, border-color .12s; }
.gallery-thumb img, .gallery-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-thumb:hover { opacity: 1; } .gallery-thumb.active { opacity: 1; border-color: var(--accent); }
.gallery-empty { display: flex; align-items: center; gap: 14px; padding: 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius); }

.lightbox { position: fixed; inset: 0; z-index: 150; display: flex; flex-direction: column; background: rgba(8, 7, 5, .97); color: #fff; padding: 14px 18px 18px; }
.lb-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.lb-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #d8d2c8; }
.lb-btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 11px; border: 1px solid rgba(255, 255, 255, .18); border-radius: 8px; background: rgba(255, 255, 255, .06); color: #fff; font: inherit; font-size: 13px; cursor: pointer; text-decoration: none; }
.lb-btn:hover { background: rgba(255, 255, 255, .14); } .lb-icon { padding: 6px; }
.lb-stage { position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; margin-top: 12px; }
.lb-media { height: 100%; max-width: 100%; display: flex; align-items: center; justify-content: center; }
.lb-media img, .lb-media video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 1; width: 48px; height: 48px; border-radius: 50%; border: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .12); color: #fff; cursor: pointer; }
.lb-nav:hover { background: rgba(255, 255, 255, .24); } .lb-prev { left: 4px; } .lb-next { right: 4px; }
.lb-strip { justify-content: center; margin-top: 14px; }
.lb-strip .gallery-thumb { background: rgba(255, 255, 255, .08); }

.layout-toggle { display: inline-flex; padding: 2px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); }
.layout-toggle button { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border: 0; border-radius: 7px; background: none; color: var(--muted); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.layout-toggle button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }

.product-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.product-card { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s; }
.product-card:hover, .product-card:focus-visible { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); outline: none; }
.product-card:focus-visible { border-color: var(--accent); }
.pc-photo { position: relative; aspect-ratio: 4 / 5; display: grid; place-items: center; overflow: hidden; background: linear-gradient(135deg, hsl(var(--h) 60% 88%), hsl(calc(var(--h) + 30) 55% 78%)); color: hsl(var(--h) 45% 28%); }
[data-theme="dark"] .pc-photo { background: linear-gradient(135deg, hsl(var(--h) 30% 24%), hsl(calc(var(--h) + 30) 30% 18%)); color: hsl(var(--h) 60% 80%); }
.pc-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pc-initials { font-size: 26px; font-weight: 700; }
.pc-nophoto { position: absolute; bottom: 10px; font-size: 11.5px; opacity: .8; }
.pc-badges { position: absolute; top: 8px; left: 8px; display: flex; gap: 4px; flex-wrap: wrap; }
.pc-badges .badge { box-shadow: 0 1px 4px rgba(0, 0, 0, .25); }
.pc-count { position: absolute; bottom: 8px; right: 8px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 999px; background: rgba(0, 0, 0, .6); color: #fff; font-size: 11.5px; font-weight: 600; }
.pc-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pc-title { font-weight: 600; font-size: 13.5px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pc-price { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.pc-live .badge { font-size: 10.5px; }
@media (max-width: 640px) { .gallery-main { height: 300px; } .product-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; } }

/* ---------- dispute page: one group chat for buyer, vendor and BESH Support ---------- */
.dc-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.dc-head h1 { margin: 0; font-size: 24px; } .dc-head p { margin: 6px 0 0; }
.dc-stage { list-style: none; margin: 0 0 14px; padding: 0; display: flex; gap: 6px; }
.dc-stage li { flex: 1 1 0; } .dc-stage li.now { flex: 2 1 0; }
.dc-stage li { position: relative; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 9px 12px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 13px; font-weight: 500; }
.dc-stage .dot { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--surface-3); color: var(--muted); }
.dc-stage li.done { color: var(--text-2); } .dc-stage li.done .dot { background: var(--green-soft); color: var(--green); }
.dc-stage li.now { color: var(--text); border-color: var(--accent); background: var(--accent-soft); font-weight: 600; } .dc-stage li.now .dot { background: var(--accent); color: #fff; }
.dc-stage li.alert.now { border-color: var(--red); background: var(--red-soft); } .dc-stage li.alert.now .dot { background: var(--red); }

.dc-layout { display: grid; grid-template-columns: minmax(0, 1fr) 310px; gap: 16px; align-items: start; }
.dc-chat { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 560px; overflow: hidden; position: sticky; top: 76px; }
.dc-chat-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.dc-faces { display: flex; } .dc-faces .dc-avatar { width: 30px; height: 30px; font-size: 11px; border: 2px solid var(--surface); margin-left: -8px; } .dc-faces .dc-avatar:first-child { margin-left: 0; }
.dc-avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--surface-3); color: var(--text-2); }
.tone-blue .dc-avatar, .dc-avatar.tone-blue { background: var(--blue-soft); color: var(--blue); }
.tone-violet .dc-avatar, .dc-avatar.tone-violet { background: var(--violet-soft); color: var(--violet); }
.tone-orange .dc-avatar, .dc-avatar.tone-orange { background: var(--orange-soft); color: var(--orange); }
.dc-thread { gap: 12px; padding: 18px 20px; }
.dc-msg { display: flex; gap: 10px; max-width: 78%; align-self: flex-start; }
.dc-msg.mine { align-self: flex-end; flex-direction: row-reverse; }
.dc-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.dc-msg.mine .dc-body { align-items: flex-end; }
.dc-who { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12.5px; }
.dc-role { font-size: 10.5px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase; padding: 1px 6px; border-radius: 5px; background: var(--surface-3); color: var(--muted); }
.tone-blue .dc-role { background: var(--blue-soft); color: var(--blue); } .tone-violet .dc-role { background: var(--violet-soft); color: var(--violet); } .tone-orange .dc-role { background: var(--orange-soft); color: var(--orange); }
.dc-tag { font-size: 11.5px; color: var(--muted); }
.dc-bubble { padding: 9px 13px; border-radius: 14px; border-top-left-radius: 4px; background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--border-strong); font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.tone-blue .dc-bubble { border-left-color: var(--blue); } .tone-violet .dc-bubble { border-left-color: var(--violet); }
.dc-msg.mine .dc-bubble { background: var(--accent); color: #fff; border: 0; border-radius: 14px; border-top-right-radius: 4px; }
.dc-msg.note .dc-bubble { background: var(--amber-soft); color: var(--text); border: 1px dashed var(--amber); }
.dc-msg.note .dc-role { background: var(--amber-soft); color: var(--amber); }
.dc-check { margin: 6px 0 0; padding-left: 18px; }
.dc-photos { display: flex; flex-wrap: wrap; gap: 6px; }
.dc-photo { width: 120px; height: 120px; padding: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; cursor: zoom-in; background: var(--surface-3); }
.dc-photo img { width: 100%; height: 100%; object-fit: cover; display: block; } .dc-photo.broken img { visibility: hidden; }
.dc-time { font-size: 11px; color: var(--muted); }
.dc-event { align-self: center; display: inline-flex; align-items: center; gap: 6px; max-width: 90%; padding: 4px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); font-size: 12px; }
.dc-event time { color: var(--muted); }
.dc-earlier { align-self: center; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border: 1px dashed var(--border-strong); border-radius: 999px; background: none; color: var(--text-2); font: inherit; font-size: 12.5px; cursor: pointer; }
.dc-earlier:hover { background: var(--surface); }
.dc-divider { display: flex; align-items: center; gap: 10px; color: var(--accent); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.dc-divider::before, .dc-divider::after { content: ''; flex: 1; height: 1px; background: var(--accent); opacity: .4; }

.dc-compose { border-top: 1px solid var(--border); padding: 10px 14px 12px; background: var(--surface); display: flex; flex-direction: column; gap: 8px; }
.dc-closed { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dc-modes { display: flex; flex-wrap: wrap; gap: 6px; }
.dc-modes button { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.dc-modes button:hover { border-color: var(--border-strong); }
.dc-modes button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-text); font-weight: 600; }
.dc-compose.is-note .dc-modes button[aria-pressed="true"] { background: var(--amber-soft); border-color: var(--amber); color: var(--amber); }
.dc-input { border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); overflow: hidden; }
.dc-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dc-compose.is-note .dc-input { background: var(--amber-soft); border-style: dashed; border-color: var(--amber); }
.dc-input textarea { display: block; width: 100%; min-height: 54px; max-height: 180px; resize: none; border: 0; outline: 0; background: transparent; padding: 10px 12px; font: inherit; font-size: 14px; color: var(--text); box-shadow: none; }
.dc-actions { display: flex; align-items: center; gap: 6px; padding: 6px 8px 8px; }
.dc-hint { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dc-hint b { color: var(--text-2); }

.dc-person { display: flex; align-items: center; gap: 10px; padding: 8px; margin: -8px; border-radius: 10px; color: inherit; text-decoration: none; }
a.dc-person:hover { background: var(--surface-2); }
.dc-person .dc-role { display: inline-block; margin-bottom: 2px; }
.dc-item-photo { padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 8px; }
.dc-raw summary { cursor: pointer; list-style: none; } .dc-raw summary::-webkit-details-marker { display: none; }
.dc-raw:not([open]) summary { border-bottom: 0; }

@media (max-width: 960px) { .dc-layout { grid-template-columns: 1fr; } .dc-chat { position: static; height: 72vh; } }
@media (max-width: 640px) { .dc-stage { flex-wrap: wrap; } .dc-stage li { flex-basis: 40%; } .dc-msg { max-width: 94%; } .dc-head { flex-direction: column; } .dc-keys { display: none; } }

/* Orders: clickable summary tiles and status chips inside a stage */
button.kpi-link { display: block; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
button.kpi-link:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
button.kpi-link.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chip-sm { padding: 3px 9px; font-size: 12px; }
.order-substatus { gap: 6px; align-items: center; }

/* Photos in chat messages */
.msg-photos { display: flex; flex-wrap: wrap; gap: 6px; }
.msg-bubble.has-photo .msg-photos { margin-bottom: 6px; }
.msg-bubble.photo-only { padding: 4px; background: var(--surface); border: 1px solid var(--border); }
.msg.me .msg-bubble.photo-only, .msg.side-b .msg-bubble.photo-only { background: var(--surface); border: 1px solid var(--border); }
.msg-photo { position: relative; display: block; width: 240px; height: 300px; max-width: 100%; border-radius: 10px; overflow: hidden; background: var(--surface-3); cursor: zoom-in; }
.msg-photos .msg-photo:not(:only-child) { width: 150px; height: 180px; }
.msg-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.msg-photo-link { display: none; }
.msg-photo.broken, .msg-photos .msg-photo.broken:not(:only-child) { width: auto; height: auto; cursor: pointer; background: none; }
.msg-photo.broken img { display: none; }
.msg-photo.broken .msg-photo-link { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; color: var(--accent-text); font-size: 13px; text-decoration: underline; }
.chat-compose #attach { align-self: center; }
