/* ===================================================================
   Estate Manager — "Roost" design system (warm, soft, rounded)
   Light/dark via html[data-theme]. Accent pastels identical in both.
   =================================================================== */
:root{
  /* neutrals — LIGHT */
  --bg:#F4EEE4;
  --bg-2:#EDE5D8;
  --surface:#FFFFFF;
  --surface-2:#FBF7F0;
  --surface-inset:#F1EADD;
  --text:#242019;
  --muted:#7E7668;
  --muted-l:#B4AC9E;
  --border:rgba(36,32,25,0.09);
  --border-d:rgba(36,32,25,0.16);
  --shadow:0 1px 2px rgba(36,32,25,.04),0 12px 30px -14px rgba(36,32,25,.16);
  --shadow-lg:0 8px 20px rgba(36,32,25,.10),0 24px 50px -18px rgba(36,32,25,.28);
  --btn:#242019;
  --btn-ink:#F7F2E9;
  --grain:.42;

  /* accent pastels (same in both themes) */
  --lime:#DBE7A6;     --lime-ink:#525F1D;
  --peach:#F6D2B3;    --peach-ink:#8B5023;
  --pink:#F4C6D1;     --pink-ink:#8E3D57;
  --blue-a:#BDD4EC;   --blue-a-ink:#31577E;
  --lav:#D4CAEE;      --lav-ink:#554391;
  --yellow:#F2DC99;   --yellow-ink:#835F16;

  /* status colours mapped onto the pastels */
  --green:var(--lime-ink);   --green-bg:var(--lime);
  --amber:var(--yellow-ink); --amber-bg:var(--yellow);
  --red:var(--pink-ink);     --red-bg:var(--pink);
  --blue:var(--blue-a-ink);  --blue-bg:var(--blue-a);
  --grey-bg:var(--surface-inset);

  --primary:var(--lav-ink);
  --primary-d:#463579;
  --primary-l:var(--lav);
  --accent:var(--lime-ink);

  --radius:24px;
  --radius-sm:16px;
  --sidebar-w:262px;
  --font:'Dirham','Plus Jakarta Sans','Segoe UI',Roboto,-apple-system,BlinkMacSystemFont,Helvetica,Arial,sans-serif;
  --font-display:'Dirham','Bricolage Grotesque','Plus Jakarta Sans','Segoe UI',Roboto,sans-serif;
}
html[data-theme="dark"]{
  --bg:#161309;
  --bg-2:#1E1A12;
  --surface:#232019;
  --surface-2:#2A261E;
  --surface-inset:#1C1912;
  --text:#F3EEE3;
  --muted:#A79E8D;
  --muted-l:#6E6655;
  --border:rgba(255,255,255,0.09);
  --border-d:rgba(255,255,255,0.17);
  --shadow:0 1px 2px rgba(0,0,0,.35),0 16px 36px -16px rgba(0,0,0,.7);
  --shadow-lg:0 10px 26px rgba(0,0,0,.5),0 30px 60px -20px rgba(0,0,0,.8);
  --btn:#F3EEE3;
  --btn-ink:#232019;
  --grain:.5;
  --primary:var(--lav);
  --primary-d:#E2DAF7;
  --primary-l:var(--lav-ink);
  --accent:var(--lime);
}

/* UAE Dirham symbol (U+20C3) — bundled webfont, only that glyph; every other
   character falls through to the regular font stack. (dirham.js.org) */
@font-face{
  font-family:"Dirham";
  src:url("../fonts/dirham.woff2") format("woff2");
  font-weight:normal;font-style:normal;font-display:swap;
  unicode-range:U+20C3;
}

*{box-sizing:border-box}
html,body{margin:0;height:100%}
body{font-family:var(--font);color:var(--text);font-size:14px;line-height:1.45;
  background:
    radial-gradient(1100px 700px at 88% -10%, color-mix(in srgb, var(--lav) 20%, transparent), transparent 60%),
    radial-gradient(1000px 700px at -10% 100%, color-mix(in srgb, var(--lime) 16%, transparent), transparent 60%),
    var(--bg);
  background-attachment:fixed}
button{font-family:inherit;cursor:pointer;color:inherit}
a{color:var(--primary);text-decoration:none}
svg{width:20px;height:20px}
svg.sprite{display:none}
h1,h2,h3,h4{font-family:var(--font-display);letter-spacing:-.02em}

/* ---------- Grain overlay ---------- */
#grain{position:fixed;inset:0;z-index:600;pointer-events:none;mix-blend-mode:soft-light;opacity:var(--grain);
  background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='170' height='170'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  background-size:170px 170px}

/* ---------- Layout (floating shell) ---------- */
#app{display:flex;gap:16px;padding:16px;height:100vh;overflow:hidden}
#sidebar{width:var(--sidebar-w);flex:none;background:var(--surface);border:1px solid var(--border);border-radius:30px;
  box-shadow:var(--shadow);padding:22px 16px 16px;display:flex;flex-direction:column;min-height:0}
#main{flex:1;display:flex;flex-direction:column;min-width:0;gap:16px}

.brand{display:flex;align-items:center;gap:12px;padding:0 6px 18px}
.brand-logo{width:40px;height:40px;flex:none;color:var(--btn-ink);background:var(--btn);padding:9px;border-radius:14px}
.brand-text{display:flex;flex-direction:column;line-height:1.15}
.brand-name{font-family:var(--font-display);font-weight:800;font-size:19px;letter-spacing:-.02em}
.brand-sub{font-size:10.5px;color:var(--muted);font-weight:600;letter-spacing:.05em;text-transform:uppercase}

#main-nav{flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:3px;padding:2px}
.nav-item{display:flex;align-items:center;gap:13px;width:100%;border:0;background:transparent;
  color:var(--muted);padding:11px 14px;border-radius:15px;font-size:14px;font-weight:600;text-align:left;transition:.15s}
.nav-item svg{width:19px;height:19px;flex:none}
.nav-item:hover{background:color-mix(in srgb, var(--surface-inset) 55%, transparent);color:var(--text)}
.nav-item.active{background:var(--surface-inset);color:var(--text)}
.nav-section{font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.09em;color:var(--muted-l);padding:14px 14px 5px}
.sidebar-foot{padding-top:10px;border-top:1px solid var(--border);margin-top:10px}

/* ---------- Topbar ---------- */
#topbar{height:56px;flex:none;display:flex;align-items:center;gap:12px;padding:0 4px}
#menu-toggle{display:none;border:0;background:var(--surface);color:var(--text);width:44px;height:44px;border-radius:50%;
  align-items:center;justify-content:center;border:1px solid var(--border);box-shadow:var(--shadow)}
#breadcrumb{display:flex;align-items:center;gap:7px;font-size:13.5px;color:var(--muted);flex:1;min-width:0;flex-wrap:wrap;font-weight:500}
#breadcrumb .crumb{color:var(--muted);cursor:pointer}
#breadcrumb .crumb:hover{color:var(--text)}
#breadcrumb .crumb.current{color:var(--text);font-weight:700;cursor:default}
#breadcrumb .sep{color:var(--muted-l)}
.topbar-right{display:flex;align-items:center;gap:10px}
.company-pill{font-size:12.5px;color:var(--text);background:var(--surface);border:1px solid var(--border);
  padding:8px 16px;border-radius:999px;font-weight:700;box-shadow:var(--shadow);white-space:nowrap}
.sync-status{display:none;align-items:center;gap:5px;font-size:11.5px;font-weight:700;padding:4px 12px;border-radius:999px}
.sync-status.show{display:inline-flex}
.sync-status::before{content:"";width:7px;height:7px;border-radius:50%;background:currentColor}
.sync-status.green{color:var(--green);background:var(--green-bg)}
.sync-status.amber{color:var(--amber);background:var(--amber-bg)}
.sync-status.red{color:var(--red);background:var(--red-bg)}
#bell,#quick-create{cursor:pointer;color:var(--text);width:48px;height:48px;border-radius:50%!important;background:var(--surface)!important;
  border:1px solid var(--border)!important;box-shadow:var(--shadow);display:inline-flex;align-items:center;justify-content:center}
#bell:hover,#quick-create:hover{background:var(--surface-2)!important}
#bell svg,#quick-create svg{width:20px;height:20px}
#bell-count{position:absolute;top:4px;right:4px;min-width:17px;height:17px;padding:0 4px;border-radius:9px;background:var(--pink);
  color:var(--pink-ink);font-size:10px;font-weight:800;display:none;align-items:center;justify-content:center;line-height:17px}
#bell-count.show{display:flex}
#bell{position:relative}

/* global search */
.gsearch{position:relative;display:flex;align-items:center;gap:8px;background:var(--surface);border:1px solid var(--border);
  border-radius:999px;box-shadow:var(--shadow);height:48px;padding:0 8px 0 18px;width:min(380px,34vw)}
.gsearch>svg{width:18px;height:18px;color:var(--muted);flex:none}
.gsearch input{border:0;outline:0;flex:1;min-width:0;font-size:13.5px;background:transparent;color:var(--text);font-family:inherit}
.gsearch input::placeholder{color:var(--muted-l)}
.gsearch .gs-menu{display:none;position:absolute;z-index:50;top:calc(100% + 8px);left:0;right:0;background:var(--surface);
  border:1px solid var(--border);border-radius:18px;box-shadow:var(--shadow-lg);max-height:330px;overflow-y:auto;padding:6px}
.gsearch .gs-menu.open{display:block}
.gs-item{display:flex;align-items:center;gap:10px;padding:9px 12px;border-radius:12px;cursor:pointer;font-size:13.5px}
.gs-item:hover{background:var(--surface-inset)}
.gs-item .gs-kind{margin-left:auto;font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--muted-l)}
.gs-item .gs-sub{color:var(--muted);font-size:12px}
.gs-empty{padding:12px;text-align:center;color:var(--muted);font-size:13px}

/* theme toggle */
.theme-toggle{position:relative;width:78px;height:48px;flex:none;border-radius:999px;background:var(--surface);
  border:1px solid var(--border);box-shadow:var(--shadow);display:inline-flex;align-items:center;justify-content:space-between;padding:0 8px}
.theme-toggle .knob{position:absolute;top:4px;left:4px;width:36px;height:38px;border-radius:999px;background:var(--surface-inset);
  transition:left .28s cubic-bezier(.4,0,.2,1)}
html[data-theme="dark"] .theme-toggle .knob{left:38px}
.theme-toggle svg{width:18px;height:18px;position:relative;z-index:1;color:var(--muted-l)}
.theme-toggle svg.lit{color:var(--text)}

#view{flex:1;overflow-y:auto;padding:6px 6px 60px;min-height:0}
#view>*{max-width:1400px;margin-left:auto;margin-right:auto}

/* ---------- Page header ---------- */
.page-head{display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:18px;flex-wrap:wrap}
.page-title{font-size:30px;font-weight:800;margin:0;display:flex;align-items:center;gap:10px;letter-spacing:-.02em}
.page-title .sub{font-size:13.5px;font-weight:500;color:var(--muted);font-family:var(--font);letter-spacing:0}
.page-actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}

/* ---------- Buttons ---------- */
.btn{display:inline-flex;align-items:center;gap:7px;border:1px solid var(--border);background:var(--surface);
  color:var(--text);padding:9px 18px;border-radius:999px;font-size:13.5px;font-weight:600;transition:.15s;white-space:nowrap;box-shadow:var(--shadow)}
.btn svg{width:16px;height:16px}
.btn:hover{background:var(--surface-2);transform:translateY(-1px)}
.btn-primary{background:var(--btn);border-color:var(--btn);color:var(--btn-ink)}
.btn-primary:hover{background:var(--btn);opacity:.9}
.btn-accent{background:var(--lime);border-color:var(--lime);color:var(--lime-ink)}
.btn-accent:hover{background:var(--lime);filter:brightness(.97)}
.btn-danger{background:var(--pink);border-color:var(--pink);color:var(--pink-ink)}
.btn-danger:hover{background:var(--pink);filter:brightness(.97)}
.btn-ghost{border-color:transparent;background:transparent;box-shadow:none}
.btn-ghost:hover{background:var(--surface-inset)}
.btn-sm{padding:5px 12px;font-size:12.5px}
.btn-icon{padding:8px;border-radius:50%}
.btn[disabled]{opacity:.5;cursor:not-allowed}

/* ---------- Stat cards (dashboard KPIs — pastel accent cards) ---------- */
.stat-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(225px,1fr));gap:16px;margin-bottom:16px}
.stat-card{border-radius:26px;padding:20px 22px;position:relative;overflow:hidden;cursor:pointer;transition:.18s;
  background:var(--surface);border:1px solid var(--border);box-shadow:var(--shadow)}
.stat-card:hover{transform:translateY(-2px);box-shadow:var(--shadow-lg)}
.stat-card .ico{position:absolute;right:14px;top:14px;width:36px;height:36px;border-radius:12px;display:flex;align-items:center;justify-content:center;
  background:color-mix(in srgb, currentColor 14%, transparent)}
.stat-card .ico svg{width:19px;height:19px}
.stat-label{font-size:12px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;opacity:.75;padding-right:44px}
.stat-value{font-family:var(--font-display);font-size:30px;font-weight:800;margin-top:8px;letter-spacing:-.03em}
.stat-foot{font-size:12px;margin-top:4px;opacity:.75;font-weight:500}
.stat-card.accent-green{background:var(--lime);color:var(--lime-ink);border-color:transparent}
.stat-card.accent-amber{background:var(--yellow);color:var(--yellow-ink);border-color:transparent}
.stat-card.accent-red{background:var(--pink);color:var(--pink-ink);border-color:transparent}
.stat-card.accent-blue{background:var(--blue-a);color:var(--blue-a-ink);border-color:transparent}
.stat-card.accent-primary{background:var(--lav);color:var(--lav-ink);border-color:transparent}

/* ---------- Accent helpers (Roost pastels) ---------- */
.accent-lime{--ac:var(--lime);--ac-ink:var(--lime-ink)}
.accent-peach{--ac:var(--peach);--ac-ink:var(--peach-ink)}
.accent-pink{--ac:var(--pink);--ac-ink:var(--pink-ink)}
.accent-blue2{--ac:var(--blue-a);--ac-ink:var(--blue-a-ink)}
.accent-lav{--ac:var(--lav);--ac-ink:var(--lav-ink)}
.accent-yellow{--ac:var(--yellow);--ac-ink:var(--yellow-ink)}

/* ---------- Cards / panels ---------- */
.card{background:var(--surface);border:1px solid var(--border);border-radius:var(--radius);box-shadow:var(--shadow);margin-bottom:16px}
.card-head{display:flex;align-items:center;justify-content:space-between;padding:16px 22px;border-bottom:1px solid var(--border);gap:10px}
.card-head h3{margin:0;font-size:17px;font-weight:700;display:flex;align-items:center;gap:8px}
.card-head h3 svg{width:18px;height:18px;color:var(--muted)}
.card-body{padding:18px 22px}
.card-body.flush{padding:0}
.grid-2{display:grid;grid-template-columns:1.6fr 1fr;gap:16px;align-items:start}
@media(max-width:980px){.grid-2{grid-template-columns:1fr}}

/* ---------- Tables ---------- */
.table-wrap{overflow-x:auto;border-radius:0 0 var(--radius) var(--radius)}
table.data{width:100%;border-collapse:collapse;font-size:13.5px}
table.data th{text-align:left;padding:12px 16px;background:var(--surface-2);color:var(--muted-l);font-weight:700;
  font-size:11.5px;text-transform:uppercase;letter-spacing:.05em;border-bottom:1px solid var(--border);white-space:nowrap;position:sticky;top:0;z-index:1}
table.data td{padding:11px 16px;border-bottom:1px solid var(--border);vertical-align:middle}
table.data tbody tr{transition:.1s}
table.data tbody tr:hover{background:color-mix(in srgb, var(--surface-inset) 55%, transparent)}
table.data tbody tr.clickable{cursor:pointer}
table.data td.num,table.data th.num{text-align:right;font-variant-numeric:tabular-nums}
table.data tr:last-child td{border-bottom:0}
.table-foot td{font-weight:700;background:var(--surface-2);border-top:2px solid var(--border-d)}
.empty{padding:48px 20px;text-align:center;color:var(--muted)}
.empty svg{width:46px;height:46px;opacity:.3;margin-bottom:8px}

/* ---------- Toolbar (search/filter) ---------- */
.toolbar{display:flex;align-items:flex-end;gap:10px;margin-bottom:16px;flex-wrap:wrap}
.search-box{display:flex;align-items:center;gap:8px;background:var(--surface);border:1px solid var(--border);
  border-radius:999px;padding:9px 16px;min-width:240px;flex:1;max-width:380px;box-shadow:var(--shadow)}
.search-box svg{width:16px;height:16px;color:var(--muted)}
.search-box input{border:0;outline:0;width:100%;font-size:13.5px;background:transparent;color:var(--text);font-family:inherit}
.filter-chip{display:inline-flex;align-items:center;gap:6px;padding:7px 14px;border-radius:999px;
  border:1px solid var(--border);background:var(--surface);font-size:12.5px;color:var(--muted);font-weight:600}
.filter-chip.active{background:var(--btn);border-color:var(--btn);color:var(--btn-ink);font-weight:700}
.seg{display:inline-flex;border:1px solid var(--border);border-radius:999px;overflow:hidden;background:var(--surface);box-shadow:var(--shadow)}
.seg button{border:0;background:transparent;padding:7px 14px;color:var(--muted);font-weight:600;font-size:12.5px}
.seg button.active{background:var(--btn);color:var(--btn-ink)}
select.filter-select{border:1px solid var(--border);border-radius:999px;padding:8px 14px;background:var(--surface);font-size:13px;color:var(--text);font-family:inherit;box-shadow:var(--shadow)}

/* ---------- Badges (status pills) ---------- */
.badge{display:inline-flex;align-items:center;gap:5px;padding:4px 12px;border-radius:999px;font-size:11.5px;font-weight:700;white-space:nowrap}
.badge.green{background:var(--lime);color:var(--lime-ink)}
.badge.amber{background:var(--yellow);color:var(--yellow-ink)}
.badge.red{background:var(--pink);color:var(--pink-ink)}
.badge.blue{background:var(--blue-a);color:var(--blue-a-ink)}
.badge.grey{background:var(--surface-inset);color:var(--muted)}
.badge.dot::before{content:"";width:6px;height:6px;border-radius:50%;background:currentColor;display:inline-block}

/* ---------- Property masterlist (buildings) ---------- */
.bld-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(330px,1fr));gap:16px}
.bld-card{background:var(--surface);border:1px solid var(--border);border-radius:26px;padding:14px;box-shadow:var(--shadow);
  cursor:pointer;transition:.18s;text-align:left;display:flex;flex-direction:column;gap:0;font-family:inherit}
.bld-card:hover{transform:translateY(-2px);box-shadow:var(--shadow-lg)}
.bld-banner{position:relative;border-radius:20px;padding:18px;min-height:150px;overflow:hidden;
  background:var(--ac);color:var(--ac-ink);display:flex;flex-direction:column;justify-content:space-between}
.bld-banner .glyph{position:absolute;right:-14px;bottom:-18px;width:120px;height:120px;opacity:.16}
.bld-banner-top{display:flex;align-items:center;justify-content:space-between;gap:8px}
.bld-go{width:32px;height:32px;border-radius:50%;border:0;background:color-mix(in srgb, currentColor 14%, transparent);
  color:inherit;display:flex;align-items:center;justify-content:center}
.bld-go svg{width:15px;height:15px}
.bld-occ{position:relative;z-index:1}
.bld-occ .big{font-family:var(--font-display);font-size:30px;font-weight:800;letter-spacing:-.03em;line-height:1.1}
.bld-occ .sub{font-size:12.5px;font-weight:600;opacity:.85}
.bld-body{padding:14px 8px 6px}
.bld-name{font-family:var(--font-display);font-size:18px;font-weight:700;letter-spacing:-.02em}
.bld-addr{font-size:12.5px;color:var(--muted);margin-top:2px}
.bld-meta{display:flex;justify-content:space-between;gap:10px;border-top:1px solid var(--border);margin-top:12px;padding-top:12px;font-size:12.5px;color:var(--muted)}
.bld-meta strong{color:var(--text);font-weight:700}
.pill{display:inline-flex;align-items:center;padding:4px 12px;border-radius:999px;font-size:11.5px;font-weight:700;
  background:color-mix(in srgb, currentColor 14%, transparent)}

/* property detail hero */
.hero{position:relative;border-radius:28px;padding:28px;overflow:hidden;background:var(--ac);color:var(--ac-ink);margin-bottom:16px}
.hero .glyph{position:absolute;right:20px;top:16px;width:110px;height:110px;opacity:.14}
.hero-top{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;flex-wrap:wrap;position:relative;z-index:1}
.hero h1{font-size:32px;font-weight:800;margin:10px 0 4px;letter-spacing:-.03em}
.hero .addr{font-size:13.5px;font-weight:600;opacity:.85}
.hero-actions{display:flex;gap:8px;flex-wrap:wrap}
.hero-btn{border:0;border-radius:999px;padding:10px 18px;font-size:13.5px;font-weight:700;display:inline-flex;align-items:center;gap:7px;
  background:color-mix(in srgb, currentColor 13%, transparent);color:inherit;transition:.15s;font-family:inherit}
.hero-btn:hover{background:color-mix(in srgb, currentColor 20%, transparent)}
.hero-btn.solid{background:var(--ac-ink);color:var(--ac)}
.hero-btn.solid:hover{opacity:.92}
.hero-btn svg{width:15px;height:15px}
.hero-stats{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin-top:22px;position:relative;z-index:1}
@media(max-width:900px){.hero-stats{grid-template-columns:repeat(2,1fr)}}
.hero-stat{background:color-mix(in srgb, currentColor 10%, transparent);border-radius:18px;padding:14px 16px}
.hero-stat .hl{font-size:11px;font-weight:700;text-transform:uppercase;letter-spacing:.06em;opacity:.75}
.hero-stat .hv{font-family:var(--font-display);font-size:24px;font-weight:800;margin-top:4px;letter-spacing:-.02em}

/* unit rows inside a building */
.unit-row{display:flex;align-items:center;gap:14px;padding:13px 22px;border-top:1px solid var(--border);cursor:pointer;transition:.12s}
.unit-row:hover{background:color-mix(in srgb, var(--surface-inset) 55%, transparent)}
.unit-chip{width:46px;height:46px;flex:none;border-radius:15px;background:var(--ac);color:var(--ac-ink);
  display:flex;align-items:center;justify-content:center;font-family:var(--font-display);font-weight:800;font-size:13px}
.unit-main{flex:1;min-width:0}
.unit-name{font-weight:700;font-size:14px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.unit-sub{font-size:12.5px;color:var(--muted)}
.unit-rent{font-weight:700;font-size:14px;white-space:nowrap;font-variant-numeric:tabular-nums}

/* conic donut (occupancy) */
.donut-conic{width:132px;height:132px;border-radius:50%;position:relative;flex:none;
  background:conic-gradient(var(--lime) 0 var(--p,0%), var(--surface-inset) var(--p,0%) 100%)}
.donut-conic::after{content:"";position:absolute;inset:22px;border-radius:50%;background:var(--surface)}
.donut-conic .dc-center{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:1}
.donut-conic .dc-center b{font-family:var(--font-display);font-size:24px;font-weight:800;letter-spacing:-.02em}
.donut-conic .dc-center span{font-size:11px;color:var(--muted);font-weight:600}

/* ---------- Kanban ---------- */
.kanban{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:16px}
.kcard{background:var(--surface);border:1px solid var(--border);border-radius:22px;box-shadow:var(--shadow);
  overflow:hidden;cursor:pointer;transition:.18s;border-left:4px solid var(--lav)}
.kcard:hover{transform:translateY(-2px);box-shadow:var(--shadow-lg)}
.kcard-top{padding:16px 18px 10px}
.kcard-title{font-weight:700;font-size:15.5px;margin:0 0 2px;font-family:var(--font-display)}
.kcard-sub{font-size:12.5px;color:var(--muted)}
.kcard-body{padding:0 18px 14px;font-size:13px;color:var(--text)}
.krow{display:flex;justify-content:space-between;padding:3px 0;border-top:1px dashed var(--border)}
.krow .k{color:var(--muted)}
.kcard-foot{display:flex;justify-content:space-between;align-items:center;padding:11px 18px;background:var(--surface-2);border-top:1px solid var(--border)}

/* ---------- Form / Detail ---------- */
.statusbar{display:flex;align-items:center;gap:0;margin-bottom:16px;flex-wrap:wrap;background:var(--surface);
  border:1px solid var(--border);border-radius:999px;padding:5px;box-shadow:var(--shadow)}
.statusbar .stage{position:relative;padding:8px 22px;font-size:12.5px;font-weight:700;color:var(--muted);border-radius:999px}
.statusbar .stage.done{color:var(--text)}
.statusbar .stage.active{background:var(--btn);color:var(--btn-ink)}

.smart-buttons{display:flex;gap:0;flex-wrap:wrap;border:1px solid var(--border);border-radius:var(--radius);overflow:hidden;margin-bottom:16px;background:var(--surface);box-shadow:var(--shadow)}
.smart-btn{display:flex;align-items:center;gap:10px;padding:14px 20px;border:0;border-right:1px solid var(--border);background:transparent;text-align:left;transition:.12s;color:inherit}
.smart-btn:hover{background:var(--surface-inset)}
.smart-btn svg{width:22px;height:22px;color:var(--muted)}
.smart-btn .sv{font-family:var(--font-display);font-size:16px;font-weight:800;line-height:1.15;letter-spacing:-.01em}
.smart-btn .sl{font-size:11.5px;color:var(--muted);font-weight:600}

.form-grid{display:grid;grid-template-columns:1fr 1fr;gap:2px 30px}
@media(max-width:760px){.form-grid{grid-template-columns:1fr}}
.fld{display:flex;flex-direction:column;padding:9px 0;border-bottom:1px solid var(--border)}
.fld.full{grid-column:1/-1}
.fld label{font-size:11.5px;color:var(--muted);font-weight:700;margin-bottom:4px;text-transform:uppercase;letter-spacing:.04em}
.fld .val{font-size:14px;min-height:20px}
.fld .val.big{font-size:16px;font-weight:700}
.fld input,.fld select,.fld textarea{border:1px solid var(--border-d);border-radius:14px;padding:9px 13px;font-size:14px;
  font-family:inherit;width:100%;background:var(--surface);color:var(--text)}
.fld input:focus,.fld select:focus,.fld textarea:focus{outline:0;border-color:var(--text);box-shadow:0 0 0 3px color-mix(in srgb, var(--text) 10%, transparent)}
.fld textarea{resize:vertical;min-height:70px}
.fld .hint{font-size:11.5px;color:var(--muted-l);margin-top:3px;text-transform:none;letter-spacing:0}
.fld input.is-readonly,.fld select.is-readonly,input.is-readonly{background:var(--surface-inset);color:var(--muted);cursor:not-allowed}
.section-label{grid-column:1/-1;font-size:11.5px;font-weight:800;text-transform:uppercase;letter-spacing:.07em;
  color:var(--muted);margin:16px 0 4px;padding-bottom:6px;border-bottom:2px solid var(--border-d)}

/* ---------- Modal ---------- */
#modal-root{position:fixed;inset:0;z-index:60;display:none}
#modal-root.open{display:block}
.modal-backdrop{position:absolute;inset:0;background:rgba(22,19,9,.5);backdrop-filter:blur(3px)}
.modal{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);background:var(--surface);
  border-radius:26px;box-shadow:var(--shadow-lg);width:min(820px,94vw);max-height:92vh;display:flex;flex-direction:column;animation:pop .16s ease;border:1px solid var(--border)}
@keyframes pop{from{opacity:0;transform:translate(-50%,-46%)}to{opacity:1;transform:translate(-50%,-50%)}}
.modal-head{display:flex;align-items:center;justify-content:space-between;padding:18px 24px;border-bottom:1px solid var(--border)}
.modal-head h2{margin:0;font-size:18px;font-weight:700}
.modal-body{padding:18px 24px;overflow-y:auto}
.modal-foot{display:flex;justify-content:flex-end;gap:10px;padding:14px 24px;border-top:1px solid var(--border);background:var(--surface-2);border-radius:0 0 26px 26px}
.modal .close{border:0;background:transparent;color:var(--muted);padding:6px;border-radius:50%}
.modal .close:hover{background:var(--surface-inset);color:var(--text)}

/* ---------- Login gate ---------- */
#login-overlay{position:fixed;inset:0;z-index:200;background:var(--bg);
  display:flex;align-items:center;justify-content:center;padding:20px}
.login-card{background:var(--surface);border-radius:28px;border:1px solid var(--border);box-shadow:var(--shadow-lg);width:min(400px,94vw);padding:28px 26px}
.login-brand{display:flex;align-items:center;gap:12px;margin-bottom:20px}
.login-brand svg{width:40px;height:40px;color:var(--btn-ink);background:var(--btn);padding:9px;border-radius:14px}
.login-title{font-size:18px;font-weight:800;font-family:var(--font-display)}
.login-sub{font-size:13px;color:var(--muted)}
.login-lbl{display:block;font-size:11.5px;font-weight:700;color:var(--muted);margin:12px 0 5px;text-transform:uppercase;letter-spacing:.05em}
#login-overlay input{width:100%;border:1px solid var(--border-d);border-radius:14px;padding:11px 14px;font-size:14px;font-family:inherit;background:var(--surface);color:var(--text)}
#login-overlay input:focus{outline:0;border-color:var(--text);box-shadow:0 0 0 3px color-mix(in srgb, var(--text) 10%, transparent)}
#login-overlay .btn{margin-top:18px;padding:11px}
.login-err{color:var(--red);font-size:13px;margin-top:12px;min-height:16px}
.login-foot{font-size:11.5px;color:var(--muted-l);text-align:center;margin-top:16px}

/* ---------- Image preview overlay (above modals) ---------- */
.imgprev{position:fixed;inset:0;z-index:120}
.imgprev-backdrop{position:absolute;inset:0;background:rgba(22,19,9,.55);backdrop-filter:blur(3px)}
.imgprev-card{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);background:var(--surface);
  border-radius:26px;border:1px solid var(--border);box-shadow:var(--shadow-lg);width:min(760px,94vw);max-height:92vh;display:flex;flex-direction:column;animation:pop .16s ease}
.imgprev-head{display:flex;align-items:center;justify-content:space-between;padding:16px 22px;border-bottom:1px solid var(--border)}
.imgprev-head h3{margin:0;font-size:16px}
.imgprev-head .close{border:0;background:transparent;color:var(--muted);padding:6px;border-radius:50%}
.imgprev-head .close:hover{background:var(--surface-inset)}
.imgprev-body{padding:16px 20px;overflow:auto;text-align:center}
.imgprev-body img{max-width:100%;max-height:62vh;border-radius:14px;border:1px solid var(--border)}
.imgprev-foot{display:flex;justify-content:flex-end;gap:10px;padding:12px 20px;border-top:1px solid var(--border);background:var(--surface-2);border-radius:0 0 26px 26px}

/* ---------- Toast ---------- */
#toast-root{position:fixed;bottom:22px;left:50%;transform:translateX(-50%);z-index:300;display:flex;flex-direction:column;gap:8px;align-items:center}
.toast{background:var(--btn);color:var(--btn-ink);padding:11px 20px;border-radius:999px;font-size:13.5px;font-weight:600;box-shadow:var(--shadow-lg);
  display:flex;align-items:center;gap:9px;animation:slideup .2s ease}
.toast.ok{background:var(--lime);color:var(--lime-ink)}
.toast.err{background:var(--pink);color:var(--pink-ink)}
.toast svg{width:18px;height:18px}
@keyframes slideup{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}

/* ---------- Mini bar chart ---------- */
.bars{display:flex;flex-direction:column;gap:9px}
.bar-row{display:grid;grid-template-columns:120px 1fr 64px;align-items:center;gap:10px;font-size:13px}
.bar-track{background:var(--surface-inset);border-radius:14px;height:18px;overflow:hidden}
.bar-fill{height:100%;background:var(--lime);border-radius:14px;min-width:2px}
.bar-row .bv{text-align:right;font-variant-numeric:tabular-nums;color:var(--muted);font-weight:600}

.donut-wrap{display:flex;align-items:center;gap:18px;flex-wrap:wrap}
.legend{display:flex;flex-direction:column;gap:7px;font-size:13px}
.legend .li{display:flex;align-items:center;gap:8px}
.legend .sw{width:12px;height:12px;border-radius:4px}

.kv-list{display:flex;flex-direction:column}
.kv{display:flex;justify-content:space-between;padding:9px 0;border-bottom:1px solid var(--border);font-size:13.5px}
.kv:last-child{border-bottom:0}
.kv .k{color:var(--muted)}
.kv .v{font-weight:700}

.muted{color:var(--muted)}
.nowrap{white-space:nowrap}
.right{text-align:right}
.tag-list{display:flex;gap:6px;flex-wrap:wrap}
.linklike{color:var(--primary);cursor:pointer;font-weight:700}
.linklike:hover{text-decoration:underline}
hr.soft{border:0;border-top:1px solid var(--border);margin:14px 0}

/* ---------- Tabs ---------- */
.tabs{display:flex;gap:6px;margin-bottom:16px;flex-wrap:wrap;background:var(--surface);border:1px solid var(--border);
  border-radius:999px;padding:5px;width:fit-content;max-width:100%;box-shadow:var(--shadow)}
.tab{border:0;background:transparent;padding:8px 18px;font-size:13px;font-weight:700;color:var(--muted);border-radius:999px;transition:.15s}
.tab:hover{color:var(--text)}
.tab.active{color:var(--btn-ink);background:var(--btn)}

/* ---------- Inline add/remove rows (deductions, readings) ---------- */
.line-rows{display:flex;flex-direction:column;gap:8px}
.line-row{display:grid;grid-template-columns:1fr 140px 36px;gap:8px;align-items:center}
.line-row input,.line-row textarea{border:1px solid var(--border-d);border-radius:14px;padding:8px 12px;font-size:13.5px;width:100%;background:var(--surface);color:var(--text);font-family:inherit}
.mini-add{display:inline-flex;align-items:center;gap:6px;color:var(--text);font-weight:700;font-size:13px;background:transparent;border:1px dashed var(--border-d);padding:8px 16px;border-radius:999px;width:fit-content}
.mini-add:hover{background:var(--surface-inset)}

/* ---------- Labelled toolbar filter ---------- */
.field-filter{display:inline-flex;flex-direction:column;gap:3px}
.field-filter .ff-label{font-size:10.5px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;color:var(--muted-l)}
.field-filter .ss{min-width:170px}

/* ---------- Smart date filter ---------- */
.datefilter{position:relative;display:inline-block}
.df-toggle{display:inline-flex;align-items:center;gap:7px}
.df-toggle .df-caret{color:var(--muted);font-size:11px}
.df-toggle.df-on{background:var(--btn);border-color:var(--btn);color:var(--btn-ink)}
.df-toggle.df-on .df-caret{color:var(--btn-ink)}
.df-pop{display:none;position:absolute;z-index:15;top:calc(100% + 6px);left:0;min-width:300px;background:var(--surface);
  border:1px solid var(--border);border-radius:20px;box-shadow:var(--shadow-lg);padding:14px}
.df-pop.open{display:block}
.df-modes{display:inline-flex;border:1px solid var(--border);border-radius:999px;overflow:hidden;margin-bottom:12px}
.df-mode{border:0;background:var(--surface);padding:6px 16px;font-size:12.5px;color:var(--muted);font-weight:700}
.df-mode.active{background:var(--btn);color:var(--btn-ink)}
.df-row{display:flex;gap:10px;flex-wrap:wrap}
.df-field{display:flex;flex-direction:column;gap:4px;font-size:11px;color:var(--muted);font-weight:700}
.df-field select,.df-field input{min-width:96px;border:1px solid var(--border-d);border-radius:12px;padding:6px 10px;background:var(--surface);color:var(--text);font-family:inherit}
.df-actions{display:flex;justify-content:space-between;gap:8px;margin-top:12px;border-top:1px solid var(--border);padding-top:10px}

/* ---------- Searchable select ---------- */
.ss{position:relative}
.ss-text{border:1px solid var(--border-d);border-radius:14px;padding:9px 13px;font-size:14px;font-family:inherit;width:100%;background:var(--surface);color:var(--text)}
.ss-text:focus{outline:0;border-color:var(--text);box-shadow:0 0 0 3px color-mix(in srgb, var(--text) 10%, transparent)}
.ss-menu{display:none;position:absolute;z-index:5;top:calc(100% + 4px);left:0;right:0;background:var(--surface);
  border:1px solid var(--border);border-radius:16px;box-shadow:var(--shadow-lg);max-height:240px;overflow-y:auto;padding:4px}
.ss-menu.open{display:block}
.ss-item{padding:8px 12px;cursor:pointer;font-size:13.5px;border-radius:10px}
.ss-item:hover,.ss-item.sel{background:var(--surface-inset)}
.ss-sub{font-size:11.5px;color:var(--muted)}
.ss-empty{padding:10px;color:var(--muted);font-size:13px;text-align:center}

/* ---------- Info banner ---------- */
.banner{display:flex;gap:10px;align-items:flex-start;padding:13px 16px;border-radius:18px;font-size:13px;margin-bottom:16px;font-weight:500}
.banner svg{flex:none;width:18px;height:18px;margin-top:1px}
.banner.info{background:var(--blue-a);color:var(--blue-a-ink)}
.banner.warn{background:var(--yellow);color:var(--yellow-ink)}

.section-title{font-size:16px;font-weight:700;margin:22px 0 12px;display:flex;align-items:center;gap:8px}
.section-title svg{width:18px;height:18px;color:var(--muted)}

/* ---------- Reminders popover items ---------- */
.rem-group{margin-bottom:16px}
.rem-group h4{margin:0 0 8px;font-size:13.5px;display:flex;align-items:center;gap:7px}
.rem-group h4 svg{width:16px;height:16px;color:var(--muted)}
.rem-item{display:flex;justify-content:space-between;gap:10px;padding:9px 12px;border:1px solid var(--border);border-radius:14px;margin-bottom:6px;cursor:pointer;font-size:13px}
.rem-item:hover{background:var(--surface-inset)}

/* ---------- RTL (Arabic) ---------- */
[dir="rtl"] .nav-item,[dir="rtl"] .smart-btn{text-align:right}
[dir="rtl"] table.data th,[dir="rtl"] table.data td{text-align:right}
[dir="rtl"] table.data td.num,[dir="rtl"] table.data th.num{text-align:left}
[dir="rtl"] .line-row{grid-template-columns:36px 140px 1fr}
[dir="rtl"] body{font-family:'Segoe UI','Tahoma',var(--font)}

/* ---------- Lease agreement: term picker ---------- */
.term-row{display:flex;gap:12px;padding:12px 18px;border-bottom:1px solid var(--border);cursor:pointer;transition:.1s}
.term-row:hover{background:color-mix(in srgb, var(--surface-inset) 55%, transparent)}
.term-row:last-child{border-bottom:0}
.term-row input[type=checkbox]{width:18px;height:18px;margin-top:2px;accent-color:var(--text);flex:none;cursor:pointer}
.term-row.off{opacity:.5}
.term-title{font-weight:700;font-size:13.5px}
.term-text{font-size:13px;color:var(--text);margin-top:3px;line-height:1.55}

/* ---------- Lease agreement: A4 document preview (print styling — unchanged palette) ---------- */
.agree-overlay{position:fixed;inset:0;z-index:140;background:rgba(22,19,9,.62);overflow:auto;padding:20px 10px 60px}
.agree-wrap{max-width:880px;margin:0 auto}
.agree-toolbar{display:flex;justify-content:space-between;align-items:center;background:var(--surface);
  border-radius:999px;padding:10px 16px;margin-bottom:14px;box-shadow:var(--shadow-lg);position:sticky;top:0;z-index:2}
.agree-doc{background:#fff;color:#111;padding:14mm 16mm;margin-bottom:18px;box-shadow:0 6px 24px rgba(0,0,0,.35);
  font-size:13px;line-height:1.6;border-radius:3px;direction:ltr;box-sizing:border-box;
  min-height:270mm;display:flex;flex-direction:column;font-family:'Dirham','Segoe UI',Roboto,Arial,sans-serif}
.ag-body{flex:1;display:flex;flex-direction:column}
.ag-body>.ag-sign{margin-top:auto}
.ag-lh-toggle{display:inline-flex;align-items:center;gap:6px;font-size:12.5px;color:var(--text);cursor:pointer}
.ag-lh-toggle input{width:16px;height:16px;accent-color:var(--text)}
.no-letterhead .ag-head,.no-letterhead .ag-foot{visibility:hidden}
.ag-head{display:flex;justify-content:space-between;gap:14px;align-items:flex-start;border-bottom:3px double #8a2f3c;padding-bottom:10px}
.ag-name-en{font-size:19px;font-weight:800;color:#8a2f3c;letter-spacing:.5px}
.ag-legal{font-size:13px;font-weight:700;font-style:italic;margin-top:3px;color:#222}
.ag-name-ar{font-size:14px;direction:rtl;text-align:right;color:#333;font-weight:600;max-width:40%}
.ag-date{text-align:right;font-weight:700;margin:14px 0 4px}
.ag-title{text-align:center;font-size:16px;letter-spacing:1.5px;margin:8px 0 18px;font-weight:800;text-decoration:underline;font-family:inherit}
.ag-field{margin:10px 0}
.ag-field .k{font-weight:700}
.ag-rent{margin:14px 0;padding:10px 0;border-top:1px solid #999;border-bottom:1px solid #999}
.ag-rent .k{font-weight:700}
.ag-pay{margin:6px 0 0 22px;padding:0}
.ag-pay li{margin-bottom:4px}
.ag-sec-t{font-weight:700;margin:16px 0 4px}
.ag-article{text-align:center;font-weight:800;margin:18px 0 10px}
.ag-term{margin:0 0 12px}
.ag-term .no{font-weight:700}
.ag-sign{display:grid;grid-template-columns:1fr 1fr;gap:34px;margin-top:28px}
.ag-sign .sig{font-size:12.5px;line-height:1.7}
.ag-sign .sig .t{font-weight:700;text-decoration:underline;margin-bottom:6px}
.ag-sign .line{margin-top:38px;border-top:1px solid #333;padding-top:4px;color:#444;font-size:11.5px;text-align:center}
.ag-foot{margin-top:14px;border-top:2px solid #8a2f3c;padding-top:8px;font-size:10.5px;text-align:center;color:#333}
.agree-doc.rtl{direction:rtl;text-align:right;font-family:'Segoe UI','Tahoma',Arial,sans-serif}
.agree-doc.rtl .ag-term{line-height:1.9}
.agree-doc.rtl .ag-sign .line{text-align:center}

/* ---------- Agreement action chooser ---------- */
.agree-choices{display:flex;flex-direction:column;gap:10px}
.agree-choice{display:flex;gap:12px;align-items:center;padding:15px 18px;border:1px solid var(--border-d);
  border-radius:18px;cursor:pointer;transition:.12s}
.agree-choice:hover{border-color:var(--text);background:var(--surface-2);transform:translateY(-1px)}
.agree-choice svg{width:26px;height:26px;color:var(--muted);flex:none}
.agree-choice .ac-title{font-weight:700;font-size:14px}
.agree-choice .ac-desc{font-size:12.5px;color:var(--muted)}

/* ---------- Print: only the agreement document, fitted to A4 ---------- */
@media print{
  body.ag-print-mode #app,body.ag-print-mode #toast-root,body.ag-print-mode #modal-root{display:none!important}
  #grain{display:none!important}
  body{background:#fff!important}
  body.ag-print-mode .agree-overlay{position:static;background:none;padding:0;overflow:visible}
  body.ag-print-mode .agree-wrap{max-width:none;margin:0}
  body.ag-print-mode .agree-toolbar{display:none!important}
  /* each page fills the A4 printable area (297mm − 2×11mm margins ≈ 275mm),
     footer pinned at the bottom, next page after — no trailing blank space */
  body.ag-print-mode .agree-doc{box-shadow:none;margin:0;border-radius:0;padding:0;min-height:274mm;page-break-after:always}
  body.ag-print-mode .agree-doc:last-child{page-break-after:auto}
}
@page{size:A4;margin:11mm}

/* ---------- Amount privacy (masked until hover) ---------- */
.pmask{position:relative;cursor:default}
.pmask .pm-real{display:none}
.pmask .pm-hide{letter-spacing:2px;opacity:.75}
.pmask:hover .pm-real,.pmask:focus .pm-real{display:inline}
.pmask:hover .pm-hide,.pmask:focus .pm-hide{display:none}
body.privacy-off .pmask .pm-real{display:inline}
body.privacy-off .pmask .pm-hide{display:none}
.privacy-toggle.on{background:var(--btn);border-color:var(--btn);color:var(--btn-ink)}

/* ---------- Single-click select / double-click open ---------- */
table.data tbody tr.selected,table.data tbody tr.selected:hover{background:color-mix(in srgb, var(--lav) 40%, transparent);
  box-shadow:inset 3px 0 0 var(--lav-ink)}
.bld-card.selected,.kcard.selected{outline:2px solid var(--text);outline-offset:2px}
.unit-row.selected{background:color-mix(in srgb, var(--lav) 35%, transparent);box-shadow:inset 3px 0 0 var(--lav-ink)}
.ucell.selected{outline:2.5px solid var(--text);outline-offset:1px}

/* ---------- Unit Occupancy Grid ---------- */
.ugrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(92px,1fr));gap:10px}
.ucell{border:1.5px dashed var(--border-d);border-radius:14px;min-height:64px;padding:8px 10px;cursor:pointer;
  display:flex;flex-direction:column;justify-content:space-between;background:var(--surface-inset);color:var(--muted);
  transition:.15s;font-family:inherit;text-align:left}
.ucell:hover{transform:translateY(-1px);box-shadow:var(--shadow)}
.ucell .uc-no{font-family:var(--font-display);font-weight:800;font-size:13px;letter-spacing:-.01em;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ucell .uc-cat{font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:.05em;opacity:.8;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.ucell.occ{border-style:solid;border-color:transparent;background:var(--uc,var(--lime));color:var(--uc-ink,var(--lime-ink))}
.ucat-commercial{--uc:var(--lime);--uc-ink:var(--lime-ink)}
.ucat-retail{--uc:var(--pink);--uc-ink:var(--pink-ink)}
.ucat-office{--uc:var(--blue-a);--uc-ink:var(--blue-a-ink)}
.ucat-workshop{--uc:var(--peach);--uc-ink:var(--peach-ink)}
.ucat-warehouse{--uc:var(--yellow);--uc-ink:var(--yellow-ink)}
.ucat-residential{--uc:var(--lav);--uc-ink:var(--lav-ink)}
.ucat-industrial{--uc:#C6E3DA;--uc-ink:#2E5D4E}
.ucat-land{--uc:#E6DAC3;--uc-ink:#6B5530}
.ucat-storage{--uc:#D7E0EA;--uc-ink:#3F566B}
.ucat-other{--uc:var(--grey-bg);--uc-ink:var(--muted)}
.ucell .uc-meta{display:flex;align-items:center;justify-content:space-between;gap:4px;font-size:10px;font-weight:700;opacity:.85;margin-top:2px;white-space:nowrap;overflow:hidden}
.ucell .uc-flags{display:inline-flex;gap:3px;flex:none}
.ucell .uc-dot{width:8px;height:8px;border-radius:50%;flex:none;display:inline-block;border:1px solid rgba(0,0,0,.18)}
.uc-dot.red{background:#d9534f}.uc-dot.amber{background:#e0a83c}.uc-dot.blue{background:#5b87b8}
.ugrid-legend{display:flex;gap:12px;flex-wrap:wrap;margin-top:14px;font-size:11.5px;font-weight:600;color:var(--muted)}
.ugrid-legend .li{display:inline-flex;align-items:center;gap:6px}
.ugrid-legend .sw{width:12px;height:12px;border-radius:4px;background:var(--uc);border:1px solid var(--border)}
.ugrid-legend .sw.vac{background:var(--surface-inset);border:1.5px dashed var(--border-d)}

/* ---------- Collapsible cards & form sections ---------- */
.card-head{cursor:pointer;user-select:none}
.card-head h3::after{content:"▾";font-size:11px;color:var(--muted-l);margin-left:8px;transition:transform .18s;display:inline-block}
.card.collapsed .card-head h3::after{transform:rotate(-90deg)}
.card.collapsed .card-head{border-bottom-color:transparent}
.card.collapsed .card-body,.card.collapsed .table-wrap{display:none!important}
.section-label{cursor:pointer;user-select:none}
.section-label::after{content:"▾";font-size:10px;color:var(--muted-l);margin-left:8px;transition:transform .18s;display:inline-block}
.section-label.sec-collapsed::after{transform:rotate(-90deg)}
.sec-hidden{display:none!important}

/* ---------- Shortcut recorder (settings) ---------- */
.sc-row{display:flex;align-items:center;gap:12px;padding:9px 0;border-bottom:1px solid var(--border)}
.sc-row:last-child{border-bottom:0}
.sc-name{flex:1;font-size:13.5px;font-weight:600}
.sc-combo{min-width:170px;text-align:center;border:1px solid var(--border-d);border-radius:999px;padding:7px 14px;
  font-size:12.5px;font-weight:700;background:var(--surface);color:var(--text);cursor:pointer;font-family:inherit}
.sc-combo.recording{border-color:var(--pink-ink);background:var(--pink);color:var(--pink-ink);animation:pulse 1s infinite}
@keyframes pulse{50%{opacity:.7}}
kbd.sc-hint{background:var(--surface-inset);border:1px solid var(--border);border-radius:6px;padding:1px 6px;
  font-size:10.5px;font-weight:700;font-family:inherit;color:var(--muted)}

/* ---------- Responsive ---------- */
@media(max-width:860px){
  #app{padding:10px;gap:10px;height:auto;min-height:100vh;overflow:visible}
  #sidebar{position:fixed;inset:10px auto 10px 10px;z-index:40;transform:translateX(-110%);transition:.2s;box-shadow:var(--shadow-lg)}
  #sidebar.open{transform:none}
  [dir="rtl"] #sidebar{inset:10px 10px 10px auto;transform:translateX(110%)}
  [dir="rtl"] #sidebar.open{transform:none}
  #main{width:100%}
  #menu-toggle{display:inline-flex}
  .gsearch{display:none}
  #view{padding:4px 2px 60px;overflow:visible}
}

/* ---- 2FA / sync status ---- */
body.auth-pending #app{visibility:hidden}
.sync-status.grey{color:var(--muted);background:var(--surface-inset)}
.login-btn{width:100%;justify-content:center}
.mfa-setup .login-sub{margin:0 0 10px}
.mfa-qr{display:block;width:180px;height:180px;margin:6px auto 4px;background:#fff;border-radius:12px;padding:8px}
.mfa-secret{display:block;user-select:all;word-break:break-all;font-size:13px;padding:9px 12px;border-radius:12px;background:var(--surface-inset);color:var(--text)}
.mfa-out{border:0;background:none;font:inherit;padding:0}
