/* ============================================================
   Sati — Design System
   A refined proptech OS for Gulf landlords.
   ============================================================ */

:root {
  /* Canvas & surfaces */
  --bg:            #F6F5F1;
  --bg-2:          #FBFAF7;
  --surface:       #FFFFFF;
  --surface-2:     #F4F3EE;
  --surface-3:     #ECEBE4;

  /* Ink */
  --ink:           #14181C;
  --ink-2:         #3E454C;
  --ink-3:         #6B7178;
  --ink-4:         #9BA0A6;
  --line:          #E7E5DD;
  --line-2:        #DEDCD2;

  /* Brand — jade */
  --jade:          #0E7C5B;
  --jade-600:      #0B6A4E;
  --jade-700:      #095940;
  --jade-050:      #E7F3EE;
  --jade-ink:      #08301F;

  /* Luxe brass accent */
  --brass:         #B98A34;
  --brass-2:       #C8A24B;
  --brass-050:     #F6EFDF;

  /* Sidebar (deep forest) */
  --nav-bg:        #0C1712;
  --nav-bg-2:      #0F1D16;
  --nav-ink:       #C7D2CB;
  --nav-ink-dim:   #7F8F86;
  --nav-active:    #17352A;

  /* Semantic */
  --red:           #C4443B;
  --red-050:       #FBECEA;
  --amber:         #C7912B;
  --amber-050:     #FAF1DD;
  --green:         #178A5A;
  --green-050:     #E6F4EC;
  --blue:          #2F6DB3;
  --blue-050:      #E9F1FA;

  /* Shadows */
  --sh-xs: 0 1px 2px rgba(20,24,28,.04);
  --sh-sm: 0 1px 3px rgba(20,24,28,.06), 0 1px 2px rgba(20,24,28,.04);
  --sh-md: 0 6px 16px -6px rgba(20,24,28,.12), 0 2px 6px -2px rgba(20,24,28,.06);
  --sh-lg: 0 24px 48px -16px rgba(20,24,28,.18), 0 8px 20px -8px rgba(20,24,28,.10);
  --sh-glow: 0 0 0 4px rgba(14,124,91,.10);

  /* Radii */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;

  --ease: cubic-bezier(.22,.61,.36,1);
  --ease-out: cubic-bezier(.16,1,.3,1);

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --serif: "Fraunces", "Playfair Display", Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}

::selection { background: var(--jade-050); color: var(--jade-700); }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

h1,h2,h3,h4 { font-weight: 600; letter-spacing: -.01em; color: var(--ink); }

.serif { font-family: var(--serif); font-weight: 500; letter-spacing: -.02em; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; font-size: inherit; color: inherit; }

/* ============================================================
   Layout
   ============================================================ */
.app { display: grid; grid-template-columns: 264px 1fr; height: 100vh; overflow: hidden; }

/* ---- Sidebar ---- */
.nav {
  background: linear-gradient(180deg, var(--nav-bg-2), var(--nav-bg));
  color: var(--nav-ink);
  display: flex; flex-direction: column;
  padding: 22px 16px;
  position: relative;
  overflow: hidden;
}
.nav::after {
  content:""; position:absolute; inset:0; pointer-events:none;
  background: radial-gradient(120% 60% at 0% 0%, rgba(20,124,91,.16), transparent 60%);
}
.brand { display: flex; align-items: center; gap: 11px; padding: 6px 10px 22px; position: relative; z-index: 1; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px; flex: none;
  background: linear-gradient(145deg, #16b382, var(--jade));
  display: grid; place-items: center;
  box-shadow: 0 6px 16px -4px rgba(14,124,91,.6), inset 0 1px 0 rgba(255,255,255,.25);
}
.brand-mark svg { width: 19px; height: 19px; }
.brand-name { font-family: var(--serif); font-size: 21px; font-weight: 600; color: #fff; letter-spacing: -.01em; }
.brand-name sup { font-size: 9px; color: var(--brass-2); font-family: var(--sans); font-weight: 600; letter-spacing: .04em; margin-left: 2px; }

.nav-section { position: relative; z-index: 1; }
.nav-label { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--nav-ink-dim); padding: 18px 12px 8px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: 11px; color: var(--nav-ink);
  font-size: 13.5px; font-weight: 500; width: 100%; text-align: left;
  transition: background .18s var(--ease), color .18s var(--ease);
  position: relative;
}
.nav-item svg { width: 17px; height: 17px; opacity: .78; flex: none; }
.nav-item:hover { background: rgba(255,255,255,.05); color: #fff; }
.nav-item.active { background: var(--nav-active); color: #fff; }
.nav-item.active svg { opacity: 1; color: #34d29c; }
.nav-item .count { margin-left: auto; font-size: 11px; color: var(--nav-ink-dim); font-variant-numeric: tabular-nums; }
.nav-item.active .count { color: #7fe3bf; }
.nav-item .dot { margin-left: auto; width: 6px; height: 6px; border-radius: 50%; background: var(--brass-2); }

.nav-foot { margin-top: auto; position: relative; z-index: 1; }
.nav-upsell {
  background: linear-gradient(150deg, rgba(23,53,42,.9), rgba(12,23,18,.6));
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px; padding: 14px; margin-bottom: 12px;
}
.nav-upsell h4 { color: #fff; font-size: 13px; margin-bottom: 3px; }
.nav-upsell p { color: var(--nav-ink-dim); font-size: 11.5px; line-height: 1.45; margin-bottom: 10px; }
.nav-upsell .bar { height: 5px; border-radius: 5px; background: rgba(255,255,255,.1); overflow: hidden; margin-bottom: 8px; }
.nav-upsell .bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--brass-2), #e6c778); border-radius: 5px; }
.nav-user { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; }
.nav-user:hover { background: rgba(255,255,255,.05); }
.nav-user .av { width: 30px; height: 30px; border-radius: 9px; background: linear-gradient(145deg,var(--brass-2),var(--brass)); display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 12px; flex: none; }
.nav-user .meta { line-height: 1.25; overflow: hidden; }
.nav-user .meta b { color: #fff; font-size: 12.5px; font-weight: 600; display: block; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
.nav-user .meta span { color: var(--nav-ink-dim); font-size: 11px; }

/* ---- Main ---- */
.main { overflow-y: auto; position: relative; background:
  radial-gradient(140% 80% at 100% 0%, rgba(185,138,52,.05), transparent 55%),
  radial-gradient(120% 70% at 0% 0%, rgba(14,124,91,.05), transparent 50%),
  var(--bg);
}
.topbar {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(1.4) blur(12px);
  background: rgba(246,245,241,.82);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 16px;
  padding: 14px 34px;
}
.search {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px 13px; width: 340px;
  color: var(--ink-4); font-size: 13px; box-shadow: var(--sh-xs);
  transition: box-shadow .2s, border-color .2s;
}
.search:focus-within { border-color: var(--jade); box-shadow: var(--sh-glow); }
.search svg { width: 16px; height: 16px; }
.search input { border: none; outline: none; background: none; flex: 1; color: var(--ink); }
.search .kbd { font-size: 10px; color: var(--ink-4); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 5px; background: var(--surface-2); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2);
  position: relative; box-shadow: var(--sh-xs); transition: .18s var(--ease);
}
.icon-btn:hover { border-color: var(--line-2); color: var(--ink); transform: translateY(-1px); box-shadow: var(--sh-sm); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .badge { position: absolute; top: -4px; right: -4px; background: var(--red); color: #fff; font-size: 9px; font-weight: 700; min-width: 16px; height: 16px; border-radius: 8px; display: grid; place-items: center; padding: 0 3px; border: 2px solid var(--bg); }
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(145deg, var(--jade), var(--jade-600));
  color: #fff; font-weight: 600; font-size: 13px;
  padding: 10px 16px; border-radius: 11px;
  box-shadow: 0 6px 16px -6px rgba(11,106,78,.6), inset 0 1px 0 rgba(255,255,255,.18);
  transition: .18s var(--ease);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px -8px rgba(11,106,78,.7), inset 0 1px 0 rgba(255,255,255,.18); }
.btn-primary:active { transform: translateY(0); }
.btn-primary svg { width: 16px; height: 16px; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2);
  font-weight: 600; font-size: 13px; padding: 9px 14px; border-radius: 11px;
  box-shadow: var(--sh-xs); transition: .18s var(--ease);
}
.btn-ghost:hover { border-color: var(--line-2); color: var(--ink); box-shadow: var(--sh-sm); }
.btn-ghost svg { width: 15px; height: 15px; }

/* ---- Page ---- */
.page { padding: 30px 34px 56px; max-width: 1240px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; margin-bottom: 26px; gap: 20px; }
.eyebrow { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; margin-bottom: 9px; display: flex; align-items: center; gap: 8px; }
.eyebrow .live { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(23,138,90,.5); animation: pulse 2.4s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 rgba(23,138,90,.5)} 70%{box-shadow:0 0 0 7px rgba(23,138,90,0)} 100%{box-shadow:0 0 0 0 rgba(23,138,90,0)} }
h1.title { font-family: var(--serif); font-size: 34px; font-weight: 600; letter-spacing: -.025em; line-height: 1.05; }
h1.title em { font-style: italic; color: var(--jade); }
.page-head .sub { color: var(--ink-3); font-size: 13.5px; margin-top: 6px; }

/* ---- Cards / grid ---- */
.grid { display: grid; gap: 18px; }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-sm);
}
.card-pad { padding: 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.card-head h3 { font-family: var(--serif); font-size: 18px; font-weight: 600; }
.card-head .link { font-size: 12.5px; color: var(--jade); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.card-head .link svg { width: 14px; height: 14px; }

/* KPI */
.kpis { grid-template-columns: repeat(4, 1fr); }
.kpi { padding: 20px; position: relative; overflow: hidden; }
.kpi .k-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.kpi .k-ic { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; }
.kpi .k-ic svg { width: 18px; height: 18px; }
.kpi .k-label { font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; }
.kpi .k-val { font-family: var(--serif); font-size: 34px; font-weight: 600; line-height: 1; letter-spacing: -.02em; }
.kpi .k-val .cur { font-size: 15px; color: var(--ink-3); font-family: var(--sans); font-weight: 600; margin-right: 3px; letter-spacing: 0; }
.kpi .k-val .suf { font-size: 16px; color: var(--ink-3); }
.kpi .k-foot { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 12px; color: var(--ink-3); }
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 600; font-size: 11.5px; padding: 2px 7px; border-radius: 20px; }
.trend svg { width: 12px; height: 12px; }
.trend.up { color: var(--green); background: var(--green-050); }
.trend.down { color: var(--red); background: var(--red-050); }
.trend.flat { color: var(--ink-3); background: var(--surface-2); }

.ic-jade { background: var(--jade-050); color: var(--jade); }
.ic-brass { background: var(--brass-050); color: var(--brass); }
.ic-blue { background: var(--blue-050); color: var(--blue); }
.ic-red { background: var(--red-050); color: var(--red); }
.ic-amber { background: var(--amber-050); color: var(--amber); }

/* Donut */
.donut-wrap { display: flex; align-items: center; gap: 26px; }
.donut { position: relative; width: 148px; height: 148px; flex: none; }
.donut svg { transform: rotate(-90deg); }
.donut .center { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.donut .center b { font-family: var(--serif); font-size: 30px; font-weight: 600; line-height: 1; }
.donut .center span { font-size: 11px; color: var(--ink-4); text-transform: uppercase; letter-spacing: .08em; }
.legend { display: flex; flex-direction: column; gap: 12px; }
.legend .row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.legend .sw { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend .row b { margin-left: auto; font-variant-numeric: tabular-nums; }

/* Bars (cash flow) */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.bars .b .col { width: 100%; max-width: 34px; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, var(--jade), var(--jade-600)); transition: height 1s var(--ease-out); position: relative; }
.bars .b .col.ghost { background: repeating-linear-gradient(135deg, var(--surface-2), var(--surface-2) 5px, var(--surface-3) 5px, var(--surface-3) 10px); border: 1px dashed var(--line-2); }
.bars .b .lab { font-size: 11px; color: var(--ink-4); font-weight: 500; }
.bars .b .val { font-size: 10.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* Portfolio rows */
.plist { display: flex; flex-direction: column; }
.prow { display: flex; align-items: center; gap: 16px; padding: 15px 6px; border-bottom: 1px solid var(--line); transition: .16s; border-radius: 10px; }
.prow:last-child { border-bottom: none; }
.prow:hover { background: var(--surface-2); padding-left: 12px; padding-right: 12px; }
.prow .pav { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; font-weight: 600; color: #fff; font-size: 13px; flex: none; box-shadow: var(--sh-xs); }
.prow .pinfo { flex: 1; min-width: 0; }
.prow .pinfo b { font-size: 14px; font-weight: 600; display: block; }
.prow .pinfo span { font-size: 12px; color: var(--ink-4); }
.prow .pbar { width: 120px; flex: none; }
.prow .pbar .track { height: 7px; background: var(--surface-3); border-radius: 6px; overflow: hidden; }
.prow .pbar .track i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--jade), #16b382); transition: width 1s var(--ease-out); }
.prow .pbar .pct { font-size: 11px; color: var(--ink-3); margin-top: 5px; text-align: right; font-variant-numeric: tabular-nums; }
.prow .pmeta { text-align: right; flex: none; width: 92px; }
.prow .pmeta b { font-size: 13.5px; font-variant-numeric: tabular-nums; }
.prow .pmeta span { font-size: 11px; color: var(--ink-4); display: block; }

/* Chips / badges */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 20px; }
.chip svg { width: 12px; height: 12px; }
.chip.green { color: var(--green); background: var(--green-050); }
.chip.red { color: var(--red); background: var(--red-050); }
.chip.amber { color: var(--amber); background: var(--amber-050); }
.chip.jade { color: var(--jade); background: var(--jade-050); }
.chip.blue { color: var(--blue); background: var(--blue-050); }
.chip.brass { color: var(--brass); background: var(--brass-050); }
.chip.gray { color: var(--ink-3); background: var(--surface-2); }
.chip.dot::before { content:""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; padding: 0 14px 12px; }
.tbl td { padding: 14px; border-top: 1px solid var(--line); font-size: 13.5px; }
.tbl tr { transition: .14s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl .who { display: flex; align-items: center; gap: 11px; }
.tbl .who .av { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 600; font-size: 12px; flex: none; }
.tbl .who b { font-weight: 600; display: block; }
.tbl .who span { font-size: 11.5px; color: var(--ink-4); }
.mut { color: var(--ink-4); }

/* Action items */
.acts { display: flex; flex-direction: column; gap: 10px; }
.act { display: flex; align-items: center; gap: 14px; padding: 15px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); transition: .16s var(--ease); }
.act:hover { box-shadow: var(--sh-md); transform: translateY(-1px); border-color: var(--line-2); }
.act .aic { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; }
.act .aic svg { width: 18px; height: 18px; }
.act .abody { flex: 1; min-width: 0; }
.act .abody b { font-size: 13.5px; font-weight: 600; }
.act .abody p { font-size: 12px; color: var(--ink-4); margin-top: 2px; }
.act .abtn { font-size: 12.5px; font-weight: 600; color: var(--jade); padding: 8px 13px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); transition: .15s; flex: none; }
.act .abtn:hover { background: var(--jade-050); border-color: var(--jade-050); }

.two-col { grid-template-columns: 1.55fr 1fr; align-items: start; }
.three-col { grid-template-columns: repeat(3,1fr); }

/* ============================================================
   AI Contract Studio
   ============================================================ */
.studio-hero {
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(185,138,52,.10), transparent 55%),
    radial-gradient(100% 120% at 0% 100%, rgba(14,124,91,.12), transparent 50%),
    linear-gradient(180deg, #0F1D16, #0C1712);
  border-radius: var(--r-xl); padding: 30px; color: #fff; position: relative; overflow: hidden;
  box-shadow: var(--sh-lg);
}
.studio-hero::before {
  content:""; position:absolute; inset:0; opacity:.5;
  background-image: radial-gradient(circle at 1px 1px, rgba(255,255,255,.06) 1px, transparent 0);
  background-size: 22px 22px; pointer-events: none;
}
.studio-hero .sh-head { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.studio-hero .sh-ai { display: inline-flex; align-items: center; gap: 8px; background: rgba(52,210,156,.14); border: 1px solid rgba(52,210,156,.3); color: #6fe6bd; font-size: 11.5px; font-weight: 600; padding: 5px 11px; border-radius: 20px; }
.studio-hero .sh-ai svg { width: 13px; height: 13px; }
.studio-hero h2 { font-family: var(--serif); font-size: 25px; color: #fff; font-weight: 600; position: relative; z-index: 1; margin-bottom: 6px; }
.studio-hero h2 em { font-style: italic; color: var(--brass-2); }
.studio-hero .sh-sub { color: #93a69c; font-size: 13.5px; position: relative; z-index: 1; margin-bottom: 18px; max-width: 560px; }
.prompt-box { position: relative; z-index: 1; }
.prompt-box textarea {
  width: 100%; min-height: 92px; resize: vertical;
  background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.14);
  border-radius: 16px; padding: 16px 18px; color: #fff; font-size: 14.5px; line-height: 1.55;
  transition: .2s; outline: none;
}
.prompt-box textarea::placeholder { color: #6f8177; }
.prompt-box textarea:focus { border-color: rgba(52,210,156,.5); background: rgba(255,255,255,.09); box-shadow: 0 0 0 4px rgba(52,210,156,.12); }
.prompt-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; position: relative; z-index: 1; }
.chips-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; position: relative; z-index: 1; }
.ex-chip { font-size: 12px; color: #a9bab1; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); padding: 6px 12px; border-radius: 20px; transition: .15s; }
.ex-chip:hover { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.2); }
.btn-ai {
  display: inline-flex; align-items: center; gap: 8px; margin-left: auto;
  background: linear-gradient(145deg, #17b384, #0E7C5B); color: #fff; font-weight: 600; font-size: 13.5px;
  padding: 11px 20px; border-radius: 12px; box-shadow: 0 8px 20px -6px rgba(23,179,132,.5), inset 0 1px 0 rgba(255,255,255,.2);
  transition: .18s var(--ease);
}
.btn-ai:hover { transform: translateY(-1px); box-shadow: 0 12px 26px -8px rgba(23,179,132,.6); }
.btn-ai:disabled { opacity: .7; cursor: default; transform: none; }
.btn-ai svg { width: 16px; height: 16px; }
.btn-clear { color: #93a69c; font-size: 13px; font-weight: 600; padding: 11px 14px; border-radius: 12px; transition: .15s; }
.btn-clear:hover { background: rgba(255,255,255,.06); color: #fff; }

/* AI pipeline */
.pipeline { display: flex; flex-direction: column; gap: 4px; margin-top: 20px; position: relative; z-index: 1; }
.pl-step { display: flex; align-items: center; gap: 12px; padding: 9px 4px; font-size: 13px; color: #6f8177; opacity: .4; transition: .3s var(--ease); }
.pl-step.active { opacity: 1; color: #c7d2cb; }
.pl-step.done { opacity: 1; color: #6fe6bd; }
.pl-step .plic { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: rgba(255,255,255,.06); flex: none; transition: .3s; }
.pl-step.done .plic { background: rgba(52,210,156,.16); }
.pl-step .plic svg { width: 13px; height: 13px; }
.spinner { width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.2); border-top-color: #6fe6bd; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Result split */
.studio-result { margin-top: 22px; display: grid; grid-template-columns: 1fr 1.1fr; gap: 18px; align-items: start; }
.field-group { display: flex; flex-direction: column; gap: 2px; }
.field {
  display: grid; grid-template-columns: 128px 1fr; gap: 12px; align-items: center;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.field:last-child { border-bottom: none; }
.field .flabel { font-size: 12px; color: var(--ink-4); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.field .fval { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ai-tag { font-size: 9.5px; font-weight: 700; letter-spacing: .04em; color: var(--jade); background: var(--jade-050); padding: 2px 6px; border-radius: 5px; text-transform: uppercase; display: inline-flex; align-items: center; gap: 3px; }
.ai-tag svg { width: 9px; height: 9px; }
.field-in { border: 1px solid transparent; background: transparent; border-radius: 7px; padding: 4px 6px; margin: -4px -6px; font-weight: 600; width: 100%; transition: .15s; }
.field-in:hover { background: var(--surface-2); }
.field-in:focus { background: var(--surface); border-color: var(--jade); outline: none; box-shadow: var(--sh-glow); }

/* Contract preview doc */
.doc {
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-md);
  box-shadow: var(--sh-md); overflow: hidden;
}
.doc-top { height: 5px; background: linear-gradient(90deg, var(--jade), var(--brass-2)); }
.doc-body { padding: 26px 28px; }
.doc-emblem { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.doc-emblem .dl { font-family: var(--serif); font-size: 17px; }
.doc-emblem .dr { text-align: right; font-size: 10.5px; color: var(--ink-4); line-height: 1.5; }
.doc h4.dtitle { font-family: var(--serif); font-size: 20px; text-align: center; margin: 6px 0 4px; }
.doc .dsubtitle { text-align: center; font-size: 11px; color: var(--ink-4); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 22px; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.doc-party { background: var(--surface-2); border-radius: 12px; padding: 14px; }
.doc-party .pl { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-4); font-weight: 600; margin-bottom: 5px; }
.doc-party b { font-size: 14px; }
.doc-party span { font-size: 11.5px; color: var(--ink-3); display: block; margin-top: 2px; }
.doc-terms { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-radius: 12px; overflow: hidden; margin-bottom: 18px; }
.doc-term { background: #fff; padding: 12px 14px; }
.doc-term .tl { font-size: 10.5px; color: var(--ink-4); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 3px; }
.doc-term b { font-size: 14.5px; font-variant-numeric: tabular-nums; }
.doc-clauses { font-size: 11.5px; color: var(--ink-3); line-height: 1.7; border-top: 1px dashed var(--line-2); padding-top: 14px; }
.doc-clauses p { margin-bottom: 4px; }
.doc-clauses b { color: var(--ink-2); }
.doc-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 24px; }
.doc-sign .sl { border-top: 1.5px solid var(--ink); padding-top: 6px; font-size: 11px; color: var(--ink-3); }
.doc-sign .sl .sig { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--jade); margin-bottom: 4px; height: 22px; }

/* Invoice schedule */
.sched-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 14px; }
.sched-head b { font-family: var(--serif); font-size: 17px; }
.sched-total { font-size: 12px; color: var(--ink-3); }
.sched-total b { font-family: var(--sans); color: var(--ink); font-variant-numeric: tabular-nums; }
.result-cta { display: flex; gap: 10px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }

/* Empty */
.empty { text-align: center; padding: 60px 20px; }
.empty .eic { width: 64px; height: 64px; border-radius: 18px; background: var(--jade-050); color: var(--jade); display: grid; place-items: center; margin: 0 auto 18px; }
.empty .eic svg { width: 30px; height: 30px; }
.empty h3 { font-family: var(--serif); font-size: 20px; margin-bottom: 6px; }
.empty p { color: var(--ink-3); max-width: 380px; margin: 0 auto; font-size: 13.5px; }

/* toast */
.toast-wrap { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.toast { display: flex; align-items: center; gap: 11px; background: var(--nav-bg); color: #fff; padding: 12px 18px; border-radius: 13px; box-shadow: var(--sh-lg); font-size: 13.5px; font-weight: 500; animation: toastin .4s var(--ease-out); border: 1px solid rgba(255,255,255,.08); }
.toast .tic { width: 22px; height: 22px; border-radius: 7px; background: rgba(52,210,156,.18); color: #6fe6bd; display: grid; place-items: center; }
.toast .tic svg { width: 13px; height: 13px; }
@keyframes toastin { from { opacity: 0; transform: translateY(14px); } }

/* Animations */
.fade-up { animation: fadeUp .5s var(--ease-out) both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(12px); } }
.stagger > * { animation: fadeUp .5s var(--ease-out) both; }
.stagger > *:nth-child(1){animation-delay:.03s}
.stagger > *:nth-child(2){animation-delay:.08s}
.stagger > *:nth-child(3){animation-delay:.13s}
.stagger > *:nth-child(4){animation-delay:.18s}
.stagger > *:nth-child(5){animation-delay:.23s}
.stagger > *:nth-child(6){animation-delay:.28s}

/* segmented */
.seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { font-size: 12.5px; font-weight: 600; color: var(--ink-3); padding: 6px 13px; border-radius: 8px; transition: .15s; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--sh-xs); }

.filters { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; flex-wrap: wrap; }
.fbtn { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); background: var(--surface); border: 1px solid var(--line); padding: 8px 13px; border-radius: 10px; box-shadow: var(--sh-xs); }
.fbtn svg { width: 14px; height: 14px; color: var(--ink-4); }

/* Mobile chrome (hidden on desktop) */
.hamburger { display: none; width: 40px; height: 40px; border-radius: 11px; place-items: center; background: var(--surface); border: 1px solid var(--line); color: var(--ink-2); box-shadow: var(--sh-xs); flex: none; }
.hamburger svg { width: 20px; height: 20px; }
.topbar-brand { display: none; font-family: var(--serif); font-size: 19px; font-weight: 600; color: var(--ink); }
.topbar-brand sup { font-size: 8px; color: var(--brass); font-family: var(--sans); font-weight: 700; letter-spacing: .04em; }
.nav-scrim { position: fixed; inset: 0; z-index: 55; background: rgba(10,20,15,.45); backdrop-filter: blur(2px); opacity: 0; pointer-events: none; transition: opacity .28s var(--ease); }
.nav-scrim.show { opacity: 1; pointer-events: auto; }
.tbl-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Bottom tab bar (mobile only) */
.bottom-nav { display: none; }
.bn-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  color: var(--ink-4); font-size: 10px; font-weight: 600; padding: 3px 0;
  position: relative; letter-spacing: .01em;
}
.bn-item svg { width: 22px; height: 22px; }
.bn-item.active { color: var(--jade); }
.bn-item.active svg { stroke-width: 2; }
.bn-badge {
  position: absolute; top: -1px; left: 50%; margin-left: 6px;
  background: var(--red); color: #fff; font-size: 9px; font-weight: 700;
  min-width: 15px; height: 15px; border-radius: 8px; display: grid; place-items: center;
  padding: 0 3px; border: 2px solid var(--bg);
}
.bn-fab { flex: 1; }
.bn-fab-btn {
  width: 50px; height: 50px; border-radius: 16px; margin-top: -24px; margin-bottom: 1px;
  background: linear-gradient(145deg, #17b384, var(--jade-600));
  display: grid; place-items: center; color: #fff;
  box-shadow: 0 10px 22px -6px rgba(11,106,78,.55), inset 0 1px 0 rgba(255,255,255,.22);
  border: 3px solid var(--bg);
}
.bn-fab-btn svg { width: 24px; height: 24px; }
.bn-fab.active { color: var(--jade); }

@media (max-width: 1240px) {
  .app { grid-template-columns: 220px 1fr; }
  .three-col { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 1040px) {
  .kpis { grid-template-columns: repeat(2,1fr) !important; }
  .two-col, .studio-result { grid-template-columns: 1fr; }
  .page { padding: 24px 22px 48px; }
  .topbar { padding: 12px 22px; }
  .search { width: 220px; }
}

/* ---- Phone / tablet-portrait ---- */
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }

  /* off-canvas drawer nav */
  .nav {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: 284px; max-width: 84vw; z-index: 60;
    transform: translateX(-102%);
    transition: transform .3s var(--ease-out);
    box-shadow: var(--sh-lg);
  }
  .nav.open { transform: translateX(0); }
  .hamburger { display: grid; }
  .topbar-brand { display: block; }

  .topbar { padding: 10px 14px; gap: 10px; }
  .search { display: none; }
  .topbar-actions { gap: 8px; }
  .btn-primary { padding: 10px 13px; }
  .btn-primary span { display: none; }         /* icon-only "New contract" */

  .page { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }

  /* bottom tab bar */
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    align-items: flex-start; justify-content: space-around;
    background: rgba(251,250,247,.94); backdrop-filter: saturate(1.5) blur(16px);
    border-top: 1px solid var(--line);
    padding: 9px 6px calc(9px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px -8px rgba(20,24,28,.10);
  }

  .page-head { flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
  .page-head .seg, .page-head > button, .page-head .btn-primary { align-self: stretch; }
  h1.title { font-size: 26px; }

  .kpis { grid-template-columns: 1fr 1fr !important; gap: 12px; }
  .grid { gap: 14px; }
  .two-col, .three-col, .studio-result { grid-template-columns: 1fr !important; }
  .card-pad { padding: 16px; }
  .kpi { padding: 16px; }
  .kpi .k-val { font-size: 27px; }
  .kpi .k-val .cur { font-size: 12px; }

  /* tables scroll horizontally inside their card */
  .tbl { min-width: 560px; }
  .card:has(> .tbl) { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .sched-head { flex-direction: column; align-items: flex-start; gap: 4px; }

  /* contract doc reflow */
  .doc-parties, .doc-sign { grid-template-columns: 1fr; gap: 12px; }
  .doc-body { padding: 20px; }
  .studio-hero { padding: 20px; }
  .studio-hero h2 { font-size: 21px; }
  .prompt-actions { flex-wrap: wrap; }
  .btn-ai { margin-left: 0; flex: 1; justify-content: center; }
  .result-cta { flex-direction: column; }
  .result-cta button { width: 100%; justify-content: center; }

  .donut-wrap { flex-direction: column; align-items: flex-start; }
  .prow { gap: 12px; }
  .prow .pbar { width: 84px; }
}

@media (max-width: 420px) {
  .kpis { grid-template-columns: 1fr !important; }
  h1.title { font-size: 23px; }
  .field { grid-template-columns: 104px 1fr; }
}
