/* ─────────────────────────────────────────────────────────────
   Rezult Mail — shared app shell
   Brand: Rezult orange on near-black + grey/white. Bold clear sans.
   Tokens are the only place palette/type live.
   ───────────────────────────────────────────────────────────── */
:root {
  --bg:       #f4f4f5;   /* app canvas */
  --surface:  #ffffff;   /* cards, panels */
  --surface-2:#fafafa;   /* subtle raised / table head */
  --fg:       #18181b;   /* primary text, near-black */
  --muted:    #71717a;   /* secondary text */
  --faint:    #a1a1aa;   /* tertiary / placeholder */
  --border:   #e4e4e7;   /* hairlines */
  --border-2: #d4d4d8;   /* stronger hairline */

  --accent:   #f5621d;   /* Rezult orange */
  --accent-ink:#c2410c;  /* orange text on light */
  --accent-soft: color-mix(in oklch, var(--accent) 12%, transparent);

  /* sidebar (dark) */
  --side:     #161618;
  --side-2:   #1f1f22;
  --side-fg:  #e7e7ea;
  --side-muted:#8a8a93;
  --side-border:#2a2a2e;

  /* status */
  --green:#16a34a; --green-soft:color-mix(in oklch,#16a34a 12%,transparent);
  --red:#dc2626;   --red-soft:color-mix(in oklch,#dc2626 12%,transparent);
  --amber:#d97706; --amber-soft:color-mix(in oklch,#d97706 14%,transparent);
  --blue:#2563eb;  --blue-soft:color-mix(in oklch,#2563eb 12%,transparent);
  --violet:#7c3aed;--violet-soft:color-mix(in oklch,#7c3aed 12%,transparent);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;

  --radius: 10px;
  --radius-lg: 14px;
  --radius-sm: 7px;
  --shadow-sm: 0 1px 2px rgba(24,24,27,.06), 0 1px 1px rgba(24,24,27,.04);
  --shadow: 0 4px 16px rgba(24,24,27,.08);
  --shadow-pop: 0 12px 40px rgba(24,24,27,.16);

  --side-w: 248px;
  --top-h: 60px;
}

*,*::before,*::after{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{
  margin:0; background:var(--bg); color:var(--fg);
  font-family:var(--font); font-size:14px; line-height:1.5;
  -webkit-font-smoothing:antialiased; text-rendering:optimizeLegibility;
}
img,svg{ display:block; max-width:100%; }
a{ color:inherit; text-decoration:none; }
button{ font:inherit; cursor:pointer; color:inherit; }
h1,h2,h3,h4{ margin:0; letter-spacing:-0.02em; font-weight:800; }
p{ margin:0; text-wrap:pretty; }
:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
.num{ font-family:var(--mono); font-variant-numeric:tabular-nums; }
.muted{ color:var(--muted); }

/* ── app frame ───────────────────────────────────────────────── */
.app{ display:grid; grid-template-columns:var(--side-w) 1fr; min-height:100vh; }

/* ── sidebar ─────────────────────────────────────────────────── */
.sidebar{
  background:var(--side); color:var(--side-fg);
  display:flex; flex-direction:column;
  position:sticky; top:0; height:100vh; border-right:1px solid var(--side-border);
  z-index:40;
}
.brand{ display:flex; align-items:center; gap:10px; padding:18px 18px 14px; }
.brand-mark{
  width:30px; height:30px; border-radius:8px; background:var(--accent);
  display:grid; place-items:center; color:#fff; font-weight:900; font-size:16px;
  box-shadow:0 2px 8px color-mix(in oklch,var(--accent) 45%,transparent);
}
.brand-name{ font-weight:800; font-size:16px; letter-spacing:-0.02em; }
.brand-name span{ color:var(--accent); }

.side-create{ margin:4px 14px 12px; }
.side-create .btn{ width:100%; justify-content:center; }

.nav{ flex:1; overflow-y:auto; padding:4px 10px 16px; }
.nav-label{
  font-size:11px; text-transform:uppercase; letter-spacing:.08em;
  color:var(--side-muted); padding:14px 10px 6px; font-weight:700;
}
.nav-item{
  display:flex; align-items:center; gap:11px; padding:9px 10px; border-radius:8px;
  color:var(--side-muted); font-weight:600; font-size:13.5px; position:relative;
  transition:background .12s, color .12s;
}
.nav-item svg{ width:18px; height:18px; flex:none; stroke-width:1.9; }
.nav-item:hover{ background:var(--side-2); color:var(--side-fg); }
.nav-item.active{ background:color-mix(in oklch,var(--accent) 16%,var(--side)); color:#fff; }
.nav-item.active::before{
  content:""; position:absolute; left:-10px; top:7px; bottom:7px; width:3px;
  border-radius:0 3px 3px 0; background:var(--accent);
}
.nav-item .badge{ margin-left:auto; }

.side-foot{ border-top:1px solid var(--side-border); padding:12px 14px; }
.side-user{ display:flex; align-items:center; gap:10px; }
.side-user .avatar{ background:var(--side-2); color:var(--side-fg); }
.side-user .su-name{ font-size:13px; font-weight:700; color:var(--side-fg); }
.side-user .su-mail{ font-size:11px; color:var(--side-muted); }

/* ── main column ─────────────────────────────────────────────── */
.main{ display:flex; flex-direction:column; min-width:0; }
.topbar{
  position:sticky; top:0; z-index:30; height:var(--top-h);
  background:color-mix(in oklch,var(--bg) 88%, transparent);
  backdrop-filter:blur(12px);
  border-bottom:1px solid var(--border);
  display:flex; align-items:center; gap:14px; padding:0 22px;
}
.hamburger{ display:none; background:none; border:1px solid var(--border); border-radius:8px;
  width:36px; height:36px; align-items:center; justify-content:center; }
.search{ flex:1; max-width:420px; position:relative; }
.search svg{ position:absolute; left:11px; top:50%; transform:translateY(-50%); width:16px; height:16px; color:var(--faint); }
.search input{
  width:100%; padding:9px 12px 9px 34px; border:1px solid var(--border);
  border-radius:9px; background:var(--surface); font:inherit; font-size:13.5px;
}
.search input:focus{ outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.topbar-spacer{ flex:1; }
.icon-btn{
  width:38px; height:38px; border:1px solid var(--border); border-radius:9px;
  background:var(--surface); display:grid; place-items:center; color:var(--muted); position:relative;
}
.icon-btn:hover{ color:var(--fg); border-color:var(--border-2); }
.icon-btn svg{ width:18px; height:18px; }
.icon-btn .dot{ position:absolute; top:8px; right:9px; width:7px; height:7px; border-radius:50%;
  background:var(--accent); border:2px solid var(--surface); }

.content{ padding:26px clamp(20px,3.2vw,52px) 64px; max-width:1720px; width:100%; margin:0 auto; }

/* page header */
.page-head{ display:flex; align-items:flex-start; justify-content:space-between; gap:18px; flex-wrap:wrap; margin-bottom:22px; }
.page-title{ font-size:26px; font-weight:800; letter-spacing:-0.03em; }
.page-sub{ color:var(--muted); margin-top:4px; font-size:14px; }
.page-actions{ display:flex; gap:10px; flex-wrap:wrap; }
.crumb{ font-size:12px; color:var(--faint); font-weight:600; margin-bottom:8px; display:flex; gap:7px; align-items:center; }
.crumb a:hover{ color:var(--fg); }

/* ── buttons ─────────────────────────────────────────────────── */
.btn{
  display:inline-flex; align-items:center; gap:8px; padding:9px 15px;
  border-radius:9px; border:1px solid transparent; font-weight:700; font-size:13.5px;
  letter-spacing:-0.01em; transition:background .12s,border-color .12s,transform .04s,box-shadow .12s; white-space:nowrap;
}
.btn svg{ width:16px; height:16px; }
.btn:active{ transform:translateY(1px); }
.btn-primary{ background:var(--accent); color:#fff;
  box-shadow:0 1px 2px color-mix(in oklch,var(--accent) 40%,transparent); }
.btn-primary:hover{ background:color-mix(in oklch,var(--accent) 90%,black); }
.btn-dark{ background:var(--fg); color:#fff; }
.btn-dark:hover{ background:#000; }
.btn-secondary{ background:var(--surface); color:var(--fg); border-color:var(--border-2); }
.btn-secondary:hover{ border-color:var(--faint); background:var(--surface-2); }
.btn-ghost{ background:transparent; color:var(--muted); }
.btn-ghost:hover{ color:var(--fg); background:var(--fg-soft,rgba(0,0,0,.04)); }
.btn-sm{ padding:6px 11px; font-size:12.5px; border-radius:8px; }
.btn-lg{ padding:12px 20px; font-size:15px; }

/* ── cards ───────────────────────────────────────────────────── */
.card{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); overflow:hidden; }
.card-pad{ padding:20px; }
.card-head{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 20px; border-bottom:1px solid var(--border); }
.card-head h3{ font-size:15px; font-weight:800; }
.card-body{ padding:20px; }

.grid{ display:grid; gap:18px; }
.g-4{ grid-template-columns:repeat(4,1fr); }
.g-3{ grid-template-columns:repeat(3,1fr); }
.g-2{ grid-template-columns:repeat(2,1fr); }
.g-2-1{ grid-template-columns:2fr 1fr; }
.g-1-2{ grid-template-columns:1fr 2fr; }

/* stat card */
.stat{ background:var(--surface); border:1px solid var(--border); border-radius:var(--radius-lg); padding:18px; }
.stat-top{ display:flex; align-items:center; justify-content:space-between; }
.stat-ico{ width:34px; height:34px; border-radius:9px; display:grid; place-items:center; }
.stat-ico svg{ width:18px; height:18px; }
.stat-label{ color:var(--muted); font-size:12.5px; font-weight:600; }
.stat-val{ font-size:28px; font-weight:800; letter-spacing:-0.03em; margin-top:10px; font-family:var(--mono); font-variant-numeric:tabular-nums; }
.stat-delta{ font-size:12px; font-weight:700; margin-top:6px; display:inline-flex; align-items:center; gap:4px; }
.delta-up{ color:var(--green); } .delta-down{ color:var(--red); }

/* ── badges / status pills ───────────────────────────────────── */
.badge{
  display:inline-flex; align-items:center; gap:5px; padding:3px 9px; border-radius:999px;
  font-size:11.5px; font-weight:700; letter-spacing:.01em; line-height:1.4;
  background:var(--surface-2); color:var(--muted); border:1px solid var(--border);
}
.badge .d{ width:6px; height:6px; border-radius:50%; background:currentColor; }
.badge-green{ color:var(--green); background:var(--green-soft); border-color:transparent; }
.badge-red{ color:var(--red); background:var(--red-soft); border-color:transparent; }
.badge-amber{ color:var(--amber); background:var(--amber-soft); border-color:transparent; }
.badge-blue{ color:var(--blue); background:var(--blue-soft); border-color:transparent; }
.badge-violet{ color:var(--violet); background:var(--violet-soft); border-color:transparent; }
.badge-accent{ color:var(--accent-ink); background:var(--accent-soft); border-color:transparent; }
.badge-ghost{ color:var(--side-fg); background:var(--side-2); border-color:transparent; }

/* ── table ───────────────────────────────────────────────────── */
.table-wrap{ overflow-x:auto; }
.tbl{ width:100%; border-collapse:collapse; font-size:13.5px; min-width:560px; }
.tbl th{ text-align:left; padding:11px 16px; color:var(--muted); font-weight:700; font-size:11.5px;
  text-transform:uppercase; letter-spacing:.05em; border-bottom:1px solid var(--border); background:var(--surface-2); white-space:nowrap; }
.tbl td{ padding:13px 16px; border-bottom:1px solid var(--border); vertical-align:middle; }
.tbl tbody tr{ transition:background .1s; }
.tbl tbody tr:hover{ background:var(--surface-2); }
.tbl .num-col{ font-family:var(--mono); font-variant-numeric:tabular-nums; text-align:right; }
.tbl .check{ width:36px; }
.tbl-row-title{ font-weight:700; }
.tbl-row-sub{ color:var(--muted); font-size:12px; margin-top:2px; }

/* avatar */
.avatar{ width:32px; height:32px; border-radius:50%; display:grid; place-items:center;
  font-weight:800; font-size:12px; background:var(--accent-soft); color:var(--accent-ink); flex:none; }
.avatar-sm{ width:26px; height:26px; font-size:11px; }
.avatar-lg{ width:48px; height:48px; font-size:17px; }
.av-stack{ display:flex; } .av-stack .avatar{ border:2px solid var(--surface); margin-left:-8px; }
.av-stack .avatar:first-child{ margin-left:0; }

/* ── form controls ───────────────────────────────────────────── */
.field{ display:flex; flex-direction:column; gap:6px; margin-bottom:16px; }
.field label{ font-size:13px; font-weight:700; }
.field .hint{ font-size:12px; color:var(--muted); }
.input,.textarea,.select{
  width:100%; padding:10px 13px; border:1px solid var(--border-2); border-radius:9px;
  background:var(--surface); font:inherit; font-size:14px; color:var(--fg);
}
.input:focus,.textarea:focus,.select:focus{ outline:none; border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.textarea{ min-height:90px; resize:vertical; }
.select{ appearance:none; background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat:no-repeat; background-position:right 12px center; padding-right:34px; }

/* toggle */
.toggle{ position:relative; width:40px; height:23px; flex:none; }
.toggle input{ position:absolute; opacity:0; }
.toggle .track{ position:absolute; inset:0; background:var(--border-2); border-radius:999px; transition:background .15s; }
.toggle .track::after{ content:""; position:absolute; top:2px; left:2px; width:19px; height:19px; border-radius:50%; background:#fff; box-shadow:var(--shadow-sm); transition:transform .15s; }
.toggle input:checked + .track{ background:var(--accent); }
.toggle input:checked + .track::after{ transform:translateX(17px); }

/* segmented control / tabs */
.seg{ display:inline-flex; background:var(--surface-2); border:1px solid var(--border); border-radius:9px; padding:3px; gap:2px; }
.seg button{ padding:6px 13px; border-radius:7px; font-size:13px; font-weight:700; color:var(--muted); background:transparent; border:none; }
.seg button.active{ background:var(--surface); color:var(--fg); box-shadow:var(--shadow-sm); }

.tabs{ display:flex; gap:4px; margin-bottom:22px; overflow-x:auto; padding-bottom:2px; }
.tab{ display:inline-flex; align-items:center; padding:9px 14px; font-weight:700; font-size:13.5px; color:var(--muted); white-space:nowrap; background:transparent; border:1px solid transparent; border-radius:10px; transition:background .12s, color .12s, border-color .12s; }
.tab:hover{ color:var(--fg); background:var(--surface-2); }
.tab.active{ color:var(--accent-ink); background:var(--surface); border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-soft); }
.tab-count{ font-family:var(--mono); font-size:11px; font-weight:700; color:var(--muted); background:var(--surface-2); border:1px solid var(--border); padding:1px 7px; border-radius:999px; margin-left:5px; }
.tab.active .tab-count{ color:var(--accent-ink); background:var(--accent-soft); border-color:transparent; }

/* progress */
.bar{ height:7px; border-radius:999px; background:var(--border); overflow:hidden; }
.bar > span{ display:block; height:100%; border-radius:999px; background:var(--accent); }

/* checkbox */
.chk{ width:18px; height:18px; border:1.5px solid var(--border-2); border-radius:6px; background:var(--surface); display:inline-grid; place-items:center; cursor:pointer; transition:border-color .12s, background .12s; position:relative; }
.chk:hover{ border-color:var(--accent); }
.chk::after{ content:""; width:9px; height:5px; border-left:2px solid #fff; border-bottom:2px solid #fff; transform:rotate(-45deg) translateY(-1px); opacity:0; }
.chk.on{ background:var(--accent); border-color:var(--accent); }
.chk.on::after{ opacity:1; }

/* empty state */
.empty{ text-align:center; padding:48px 20px; color:var(--muted); }
.empty svg{ width:40px; height:40px; margin:0 auto 14px; color:var(--faint); }

/* misc helpers */
.flex{ display:flex; } .between{ justify-content:space-between; } .center{ align-items:center; }
.gap-6{ gap:6px; } .gap-10{ gap:10px; } .gap-14{ gap:14px; }
.wrap{ flex-wrap:wrap; } .col{ flex-direction:column; }
.mt-8{ margin-top:8px; } .mt-16{ margin-top:16px; } .mt-24{ margin-top:24px; }
.section-title{ font-size:13px; font-weight:800; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); margin-bottom:14px; }

/* drawer scrim (mobile sidebar) */
.scrim{ display:none; position:fixed; inset:0; background:rgba(0,0,0,.45); z-index:39; }

/* ── responsive ──────────────────────────────────────────────── */
@media (max-width:1080px){
  .g-4{ grid-template-columns:repeat(2,1fr); }
  .g-3{ grid-template-columns:repeat(2,1fr); }
}
@media (max-width:860px){
  .app{ grid-template-columns:1fr; }
  .sidebar{ position:fixed; left:0; top:0; width:280px; transform:translateX(-100%); transition:transform .22s ease; }
  .app.nav-open .sidebar{ transform:translateX(0); }
  .app.nav-open .scrim{ display:block; }
  .hamburger{ display:flex; }
  .content{ padding:20px 16px 56px; }
  .g-4,.g-3,.g-2,.g-2-1,.g-1-2{ grid-template-columns:1fr; }
  .page-title{ font-size:22px; }
  .search{ max-width:none; }
}
@media (max-width:560px){
  .topbar{ padding:0 14px; gap:10px; }
  .hide-sm{ display:none !important; }
}
