/* =====================================================================
   Griva CRM – "premium" look (loaded after app.css, only by layouts/premium.html).
   Same colour tokens as app.css; this file only changes shape, depth, type and layout.
   Remove this file + layouts/premium.html (or set UI_THEME=classic) to go back.
   ===================================================================== */
:root {
  --radius: 12px; --radius-sm: 8px;
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-md: 0 8px 24px -6px rgba(16, 24, 40, .12), 0 2px 6px rgba(16, 24, 40, .05);
  --ring: 0 0 0 3px var(--brand-soft);
  --sidebar: 248px; --topbar: 60px;
}
body.premium {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; letter-spacing: -0.006em; -webkit-font-smoothing: antialiased;
  background: var(--bg);
  background-image: radial-gradient(1200px 400px at 20% -120px, var(--brand-soft), transparent 70%);
  background-attachment: fixed;
}
.premium a { text-decoration: none; } .premium a:hover { text-decoration: none; color: var(--brand); }

/* ---------- shell: sidebar + main column ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 40;
  display: flex; flex-direction: column; background: rgba(255, 255, 255, .86);
  backdrop-filter: saturate(160%) blur(12px); border-right: 1px solid var(--border);
}
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; color: var(--text); }
.sb-brand span { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  border-left: 1px solid var(--border); padding-left: 10px; }
.sb-nav { flex: 1; overflow-y: auto; padding: 4px 12px 12px; }
.sb-group { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
  padding: 16px 10px 6px; }
.sb-nav a { position: relative; display: flex; align-items: center; gap: 10px; padding: 8px 10px; margin: 1px 0;
  border-radius: var(--radius-sm); color: #3d4556; font-weight: 500; transition: background .15s, color .15s; }
.sb-nav a .icon { color: var(--muted); transition: color .15s; flex: none; }
.sb-nav a:hover { background: #f1f2f5; color: var(--text); }
.sb-nav a.on { background: var(--brand-soft); color: var(--brand); }
.sb-nav a.on .icon { color: var(--brand); }
.sb-nav a.on::before { content: ""; position: absolute; left: -12px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--brand); }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--border); }
.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  background: var(--brand); color: #fff; font-weight: 600; font-size: 13px; box-shadow: var(--ring); }
.sb-user-text { min-width: 0; flex: 1; line-height: 1.25; }
.sb-user-text b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user-text span { display: block; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-user-actions { display: flex; gap: 2px; }
.sb-user-actions a, .sb-user-actions button { display: grid; place-items: center; width: 30px; height: 30px; padding: 0;
  border-radius: 7px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.sb-user-actions a:hover, .sb-user-actions button:hover { background: #f1f2f5; color: var(--text); filter: none; }
.sb-user-actions form { margin: 0; }
.main-col { flex: 1; min-width: 0; margin-left: var(--sidebar); display: flex; flex-direction: column; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 30; height: var(--topbar); display: flex; align-items: center; gap: 12px;
  padding: 0 28px; background: rgba(246, 247, 249, .78); backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--border); }
.sb-toggle { display: none; width: 38px; height: 38px; padding: 0; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid var(--border); color: var(--text); place-items: center; }
.cmd-search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-xs);
  transition: box-shadow .15s, border-color .15s; }
.cmd-search:focus-within { border-color: var(--brand); box-shadow: var(--ring); }
.cmd-search .icon { color: var(--muted); flex: none; }
.cmd-search input { border: 0; padding: 0; height: 100%; background: transparent; box-shadow: none !important; }
.cmd-search input:focus { outline: none; }
kbd { font: 500 11px/1 "Inter", system-ui, sans-serif; color: var(--muted); background: #f1f2f5; border: 1px solid var(--border);
  border-bottom-width: 2px; border-radius: 5px; padding: 3px 6px; }
.topbar-actions { margin-left: auto; display: flex; gap: 8px; }
.topbar-actions .btn .icon, .btn .icon { width: 16px; height: 16px; margin: -2px 6px -3px -2px; }

/* ---------- content ---------- */
.premium main { max-width: 1240px; width: 100%; margin: 0 auto; padding: 28px 28px 64px; animation: rise .25s ease-out both; }
@keyframes rise { from { transform: translateY(3px); } to { transform: none; } }
.premium h1 { font-size: 24px; font-weight: 650; letter-spacing: -0.022em; margin-bottom: 4px; }
.premium h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.premium .sub { font-size: 14px; }
.premium .head { margin-bottom: 22px; align-items: center; }
.premium .last-edit { margin: 4px 0 0; }

.premium .card { border-radius: var(--radius); border-color: var(--border); box-shadow: var(--shadow-sm); padding: 20px; margin-bottom: 20px; }
.premium .card h2:first-child { margin-bottom: 14px; }
.premium .grid, .premium .grid-2 { gap: 20px; }

/* KPI tiles */
.premium .kpi, .premium .mini-kpis a, .premium .pipeline a {
  border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s; }
.premium .kpi { padding: 16px 18px; }
.premium .kpi b, .premium .mini-kpis b, .premium .pipeline a b { font-variant-numeric: tabular-nums; letter-spacing: -0.03em; font-weight: 650; }
.premium .kpi b { font-size: 28px; }
.premium .mini-kpis a:hover, .premium .pipeline a:hover, .premium a.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: #d6d9e0; }
.premium .mini-kpis { gap: 10px; } .premium .mini-kpis a { padding: 12px 14px; }
.premium .mini-kpis b { font-size: 24px; }
.premium .tracker-card { position: relative; overflow: hidden; }
.premium .tracker-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 40%, #fff)); }
.premium .tracker-card h2 a:hover { color: var(--brand); }
.premium .pipeline { gap: 10px; } .premium .pipeline a { padding: 12px 14px; }

/* tables */
.premium table { border-collapse: separate; border-spacing: 0; }
.premium th { font-size: 11.5px; font-weight: 600; letter-spacing: .04em; color: var(--muted); background: #fafbfc;
  border-bottom: 1px solid var(--border); padding: 10px 12px; }
.premium th:first-child { border-top-left-radius: var(--radius-sm); } .premium th:last-child { border-top-right-radius: var(--radius-sm); }
.premium td { padding: 12px; border-bottom: 1px solid #eef0f3; }
.premium tbody tr { transition: background .12s; }
.premium tbody tr:hover td { background: #fafafd; }
.premium tbody tr:last-child td { border-bottom: 0; }
.premium .table-wrap > table, .premium .card > table { margin-top: 4px; }

/* badges & chips: same colours, refined shape */
.premium .badge { font-size: 11.5px; font-weight: 600; padding: 3px 9px 3px 8px; border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .06); display: inline-flex; align-items: center; gap: 6px; }
.premium .badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .75; }
.premium .chip { border-radius: 6px; padding: 2px 8px; font-size: 11.5px; font-weight: 500; box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .06); }

/* buttons */
.premium .btn, .premium button { height: 36px; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; border-radius: var(--radius-sm); font-weight: 550; font-size: 13.5px; line-height: 1;
  box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, .18); transition: filter .15s, box-shadow .15s, transform .05s, background .15s; }
.premium .btn:hover, .premium button:hover { filter: brightness(1.06); color: #fff; }
.premium .btn:active, .premium button:active { transform: translateY(1px); }
.premium .btn:focus-visible, .premium button:focus-visible { outline: none; box-shadow: var(--ring); }
.premium .btn.ghost { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: var(--shadow-xs); }
.premium .btn.ghost:hover { background: #f6f7f9; color: var(--brand); filter: none; border-color: #d6d9e0; }
.premium .btn.small { height: 30px; padding: 0 11px; font-size: 12.5px; }
.premium .btn.danger-ghost { background: var(--surface); }
.premium .btn.danger-ghost:hover { background: var(--bad-soft); color: var(--bad); filter: none; }
.premium .actions { gap: 8px; }

/* forms */
.premium input, .premium select, .premium textarea { border-radius: var(--radius-sm); border-color: #dcdfe5; padding: 8px 11px;
  font-size: 14px; background: #fff; box-shadow: var(--shadow-xs); transition: border-color .15s, box-shadow .15s; }
.premium input:not([type=checkbox]):not([type=radio]), .premium select { height: 38px; }
.premium input:focus, .premium select:focus, .premium textarea:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
.premium input[type=checkbox], .premium input[type=radio] { accent-color: var(--brand); width: 16px; height: 16px; box-shadow: none; }
.premium .field { margin-bottom: 16px; } .premium .field label { font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #2c3344; }
.premium .help { font-size: 12.5px; margin-top: 5px; }

/* filter pills & section bar as segmented controls */
.premium .filters a, .premium .section-nav a { border-radius: 999px; padding: 6px 12px; font-weight: 500; font-size: 12.5px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-xs); transition: all .15s; }
.premium .filters a:hover, .premium .section-nav a:hover { border-color: #cfd3db; color: var(--brand); }
.premium .filters a.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.premium .section-nav { top: var(--topbar); background: transparent; backdrop-filter: blur(8px); padding: 10px 0; margin-bottom: 12px; }
.premium .section-nav a b { font-variant-numeric: tabular-nums; color: var(--brand); }
.premium .section-nav a.alert b { color: var(--bad); }
.premium .tracker-section { scroll-margin-top: calc(var(--topbar) + 60px); }

/* facts, timelines, details */
.premium dl.facts { gap: 9px 18px; } .premium dl.facts dt { font-size: 13px; }
.premium .timeline li { border-left-color: #e6e8ee; padding-bottom: 18px; }
.premium .timeline li::before { width: 10px; height: 10px; left: -6px; top: 4px; box-shadow: 0 0 0 4px var(--brand-soft); }
.premium .history li::before { box-shadow: 0 0 0 4px #eef0f3; }
.premium details.action { border-radius: var(--radius-sm); padding: 0; overflow: hidden; box-shadow: var(--shadow-xs); }
.premium details.action summary { padding: 12px 14px; list-style: none; display: flex; align-items: center; justify-content: space-between; }
.premium details.action summary::-webkit-details-marker { display: none; }
.premium details.action summary::after { content: "›"; color: var(--muted); font-size: 18px; transition: transform .15s; }
.premium details.action[open] summary { border-bottom: 1px solid var(--border); background: #fafbfc; }
.premium details.action[open] summary::after { transform: rotate(90deg); }
.premium details.action form, .premium details.action > p { padding: 0 14px; } .premium details.action form { padding-bottom: 14px; }
.premium .callout { border-radius: var(--radius-sm); border-left-width: 3px; box-shadow: var(--shadow-xs); }
.premium .pm-countdown { border-radius: var(--radius); box-shadow: inset 0 0 0 1px rgba(16, 24, 40, .05); }
.premium .check-row { border-radius: var(--radius-sm); transition: border-color .15s, background .15s; }
.premium .check-row:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }

/* toasts */
.premium .messages li { border-radius: var(--radius-sm); box-shadow: var(--shadow-sm); border: 1px solid rgba(16, 24, 40, .06); font-weight: 500; }

/* login / auth pages */
body.premium.auth-page { display: grid; place-items: center; min-height: 100vh;
  background-image: radial-gradient(900px 500px at 50% -10%, var(--brand-soft), transparent 70%); }
.premium .auth-main { width: 100%; max-width: 440px; padding: 24px 16px; animation: rise .3s ease-out both; }
.premium.auth-page .card { margin: 0 !important; max-width: none !important; padding: 32px; box-shadow: var(--shadow-md); border-radius: 16px; }
.premium.auth-page .card h1 { font-size: 26px; }
.premium.auth-page button[type=submit] { width: 100%; height: 40px; }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow-md); background: #fff; }
  body.nav-open .sidebar { transform: none; }
  .sb-backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(16, 24, 40, .35); opacity: 0; pointer-events: none; transition: opacity .2s; }
  body.nav-open .sb-backdrop { opacity: 1; pointer-events: auto; }
  .main-col { margin-left: 0; }
  .sb-toggle { display: grid; }
  .topbar { padding: 0 16px; }
  .premium main { padding: 20px 16px 48px; }
  .cmd-search kbd { display: none; }
}
@media (max-width: 560px) { .topbar-actions .btn { padding: 0 10px; font-size: 0; gap: 0; } .topbar-actions .btn .icon { margin: 0; } }

/* ---------- print (acknowledgement letters etc.) ---------- */
@media print {
  .sidebar, .topbar, .sb-backdrop { display: none !important; }
  .main-col { margin: 0; } body.premium { background: #fff; } .premium main { padding: 0; animation: none; }
  .premium .card { box-shadow: none; }
}

/* ---------- component overrides (must beat the generic .premium button / input rules above) ---------- */
.premium .sb-toggle { display: none; width: 38px; height: 38px; padding: 0; background: var(--surface); color: var(--text);
  border: 1px solid var(--border); box-shadow: var(--shadow-xs); }
.premium .sb-toggle:hover { color: var(--brand); filter: none; }
.premium .sb-toggle .icon { margin: 0; width: 18px; height: 18px; }
.premium .sb-user-actions a, .premium .sb-user-actions button { width: 30px; height: 30px; padding: 0; border: 0;
  background: transparent; color: var(--muted); box-shadow: none; }
.premium .sb-user-actions a:hover, .premium .sb-user-actions button:hover { background: #f1f2f5; color: var(--text); filter: none; }
.premium .sb-user-actions .icon { margin: 0; width: 17px; height: 17px; }
.premium .cmd-search input, .premium .cmd-search input:focus { border: 0; box-shadow: none; background: transparent;
  height: 100%; padding: 0; border-radius: 0; }
/* the top bar already has "Log a query" – hide the copy in page headers */
.premium .head .actions a[href="/tickets/new/"] { display: none; }
/* login: logo instead of the word GRIVA */
.premium.auth-page .card > h1:first-child { font-size: 0; height: 30px; margin-bottom: 6px;
  background: url("../img/griva-logo.48523b26411e.png") left center / contain no-repeat; }
@media (max-width: 960px) { .premium .sb-toggle { display: grid; place-items: center; } }
@media (prefers-reduced-motion: reduce) { .premium main, .premium .auth-main { animation: none; } }
.premium .sb-classic { display: inline-block; margin-top: 3px; font-size: 11.5px; color: var(--muted); text-decoration: underline;
  text-underline-offset: 2px; text-decoration-color: #cfd3db; }
.premium .sb-classic:hover { color: var(--brand); }
