/* ============================================================
   VeriTrust Access — Design Tokens
   A trust layer for luxury residences (resident app)
   Dark navy · soft gold · trust-green · honest status colors
   ============================================================ */

/* Self-hosted fonts (vendor/fonts) — no external font CDN at runtime; works offline / behind filters. */
@import url('../vendor/fonts/fonts.css');

:root {
  /* ---- NAVY FOUNDATION -------------------------------------- */
  --void:        #050F1C;   /* deepest backdrop / letterbox */
  --bg-top:      #0C2138;   /* dashboard gradient top */
  --bg:          #081729;   /* app background */
  --bg-bot:      #061320;   /* gradient bottom */
  --surface:     #0C1E33;   /* raised sheet */
  --card:        #102640;   /* card fill */
  --card-2:      #14304F;   /* elevated card / input fill */
  --card-3:      #18395D;   /* pressed / selected */

  --hairline:    rgba(214,224,238,0.09);
  --hairline-2:  rgba(214,224,238,0.16);
  --border:      #1E3C5C;
  --border-gold: rgba(201,162,77,0.34);

  /* ---- SOFT GOLD (luxury accent, status only) --------------- */
  --gold-100:    #F3E4BE;
  --gold-300:    #E3C77E;
  --gold:        #C9A24B;   /* primary gold */
  --gold-600:    #A9853A;
  --gold-line:   rgba(201,162,77,0.28);
  --gold-glow:   rgba(201,162,77,0.22);

  /* ---- TRUST GREEN (granted / healthy / active) ------------- */
  --green-300:   #6FD79A;
  --green:       #3DB873;   /* granted */
  --green-600:   #2E9A5E;
  --green-bg:    rgba(61,184,115,0.13);
  --green-line:  rgba(61,184,115,0.34);

  /* ---- ORANGE (review / warning) ---------------------------- */
  --orange:      #E0922F;
  --orange-bg:   rgba(224,146,47,0.14);
  --orange-line: rgba(224,146,47,0.36);

  /* ---- RED (revoked / denied) ------------------------------- */
  --red:         #DD5B57;
  --red-bg:      rgba(221,91,87,0.14);
  --red-line:    rgba(221,91,87,0.38);

  /* ---- BLUE (informational, restrained) --------------------- */
  --blue:        #5C97FF;
  --blue-bg:     rgba(92,151,255,0.13);

  /* ---- TEXT (warm-cool whites on navy) — raised contrast ---- */
  --text-hi:     #F4F8FC;
  --text-mid:    #C3D2E2;
  --text-lo:     #93A6BB;
  --text-faint:  #6E8298;

  /* ---- RADII ------------------------------------------------ */
  --r-pill: 999px;
  --r-xl:   26px;
  --r-lg:   20px;
  --r-md:   15px;
  --r-btn:  13px;
  --r-sm:   10px;
  --r-xs:   7px;

  /* ---- SHADOWS (soft, diffuse, luxury) ---------------------- */
  --sh-card:  0 1px 0 rgba(255,255,255,0.05) inset, 0 14px 40px rgba(0,0,0,0.30);
  --sh-soft:  0 1px 0 rgba(255,255,255,0.04) inset, 0 22px 60px rgba(3,9,18,0.45);
  --sh-pop:   0 32px 80px rgba(0,0,0,0.6), 0 1px 0 rgba(255,255,255,0.06) inset;
  --sh-gold:  0 14px 34px rgba(201,162,77,0.30), 0 1px 0 rgba(255,255,255,0.30) inset;
  --sh-green: 0 14px 34px rgba(61,184,115,0.32), 0 1px 0 rgba(255,255,255,0.28) inset;

  /* ---- FONTS ------------------------------------------------ */
  --serif: 'Cormorant Garamond', Georgia, 'Times New Roman', serif;
  --sans:  'Manrope', system-ui, -apple-system, sans-serif;
  --mono:  'JetBrains Mono', ui-monospace, monospace;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  font-family: var(--sans);
  background: var(--void);
  color: var(--text-hi);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* shared toggle — RTL-correct (logical inset), prettier; used across all panels */
.vt-tog { width: 46px; height: 27px; border-radius: 99px; padding: 3px; flex-shrink: 0; position: relative;
  background: var(--card-3); border: 1px solid var(--hairline-2); cursor: pointer; box-sizing: border-box;
  transition: background .22s, border-color .22s; box-shadow: inset 0 1px 2px rgba(0,0,0,0.28); }
.vt-tog > i { position: absolute; top: 2px; inset-inline-start: 2px; width: 19px; height: 19px; border-radius: 99px;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.4); display: grid; place-items: center;
  transition: inset-inline-start .24s cubic-bezier(.34,1.45,.5,1); }
.vt-tog.on { background: linear-gradient(180deg, var(--gold-300), var(--gold-600)); border-color: transparent; box-shadow: 0 2px 8px var(--gold-glow); }
.vt-tog.on > i { inset-inline-start: 23px; }
.vt-tog.ent.on { background: linear-gradient(180deg, #BBAFFF, #7C6FE6); box-shadow: 0 2px 8px rgba(155,140,255,0.32); }
.vt-tog.grn.on { background: linear-gradient(180deg, var(--green-300), var(--green-600)); box-shadow: 0 2px 8px var(--green-line); }

/* serif display helper */
.serif { font-family: var(--serif); }
.mono  { font-family: var(--mono); font-feature-settings: 'tnum' 1; direction: ltr; unicode-bidi: isolate; }
.tnum  { font-variant-numeric: tabular-nums; unicode-bidi: isolate; }

/* RTL: Persian/Arabic face for sans + display; numerals/codes stay LTR */
[dir='rtl'] { --sans: 'Vazirmatn', system-ui, sans-serif; --serif: 'Vazirmatn', Georgia, serif; }
[dir='rtl'] body { font-family: var(--sans); }

/* hide scrollbars inside the phone */
.no-sb::-webkit-scrollbar { width: 0; height: 0; }
.no-sb { scrollbar-width: none; }

/* gold gradient text (wordmark / accents) */
.gold-text {
  background: linear-gradient(180deg, var(--gold-100), var(--gold) 70%, var(--gold-600));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--gold);
}

/* ---- ANIMATIONS -------------------------------------------- */
@keyframes vt-pulse { 0%,100% { transform: scale(1); opacity: .9; } 50% { transform: scale(1.08); opacity: .55; } }
@keyframes vt-ring  { 0% { transform: scale(.55); opacity: .55; } 100% { transform: scale(1.9); opacity: 0; } }
@keyframes vt-spin  { to { transform: rotate(360deg); } }
@keyframes vt-fade-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes vt-rise  { from { transform: translateY(13px); } to { transform: translateY(0); } }
@keyframes vt-fade  { from { opacity: 0; } to { opacity: 1; } }
@keyframes vt-pop   { 0% { transform: scale(0); } 60% { transform: scale(1.16); } 100% { transform: scale(1); } }
@keyframes vt-draw  { to { stroke-dashoffset: 0; } }
@keyframes vt-sheen { to { background-position: 220% 0; } }
@keyframes vt-bob   { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes vt-slide-up { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }

.fade-up    { animation: vt-fade-up .5s cubic-bezier(.2,.8,.2,1) forwards; }
.fade-in    { animation: vt-fade .4s ease forwards; }
.spin       { animation: vt-spin 1s linear infinite; }
.screen-in  { animation: vt-rise .34s cubic-bezier(.2,.8,.2,1) forwards; }

/* ============================================================
   PREMIUM LAYER — additive depth, glass, motion (v2 elevation)
   ============================================================ */
:root {
  /* glass / frosted obsidian */
  --glass:       rgba(18, 38, 64, 0.55);
  --glass-2:     rgba(22, 46, 78, 0.62);
  --glass-line:  rgba(214, 224, 238, 0.12);
  --glass-hi:    rgba(255, 255, 255, 0.06);
  --blur:        18px;

  /* ambient backdrop stops */
  --mesh-1:      #0A1A30;
  --mesh-2:      #07131F;
  --mesh-3:      #0E2742;

  /* motion easings */
  --ease-out:    cubic-bezier(.16, 1, .3, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);

  /* elevated shadows */
  --sh-glass:  0 1px 0 var(--glass-hi) inset, 0 18px 50px rgba(2, 8, 16, 0.5), 0 2px 8px rgba(0,0,0,0.3);
  --sh-float:  0 30px 70px -20px rgba(2, 8, 16, 0.75);
  --sh-seal:   0 10px 30px rgba(201,162,77,0.4), 0 0 0 1px rgba(243,228,190,0.25) inset;
}

/* ambient gradient-mesh background */
.vt-mesh {
  background:
    radial-gradient(80% 60% at 18% 12%, rgba(201,162,77,0.10), transparent 60%),
    radial-gradient(70% 55% at 88% 8%,  rgba(61,184,115,0.07), transparent 55%),
    radial-gradient(90% 80% at 50% 110%, rgba(92,151,255,0.08), transparent 60%),
    linear-gradient(160deg, var(--mesh-1), var(--mesh-2) 55%, var(--mesh-3));
}

/* frosted glass card */
.vt-glass {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: var(--sh-glass);
  backdrop-filter: blur(var(--blur)) saturate(1.2);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.2);
}

/* gold hairline gradient border helper */
.vt-goldring { box-shadow: 0 0 0 1px var(--gold-line), 0 0 26px var(--gold-glow); }

/* ---- richer keyframes ---- */
@keyframes vt-seal      { 0% { transform: scale(2.4) rotate(-14deg); opacity: 0; } 55% { transform: scale(.85) rotate(2deg); opacity: 1; } 75% { transform: scale(1.06) rotate(-1deg); } 100% { transform: scale(1) rotate(0); opacity: 1; } }
@keyframes vt-ring-out  { 0% { transform: scale(.6); opacity: .6; } 100% { transform: scale(2.2); opacity: 0; } }
@keyframes vt-breathe   { 0%,100% { transform: scale(1); box-shadow: 0 0 0 0 var(--gold-glow); } 50% { transform: scale(1.015); box-shadow: 0 0 34px 4px var(--gold-glow); } }
@keyframes vt-wave      { 0%,100% { transform: scaleY(0.35); } 50% { transform: scaleY(1); } }
@keyframes vt-shimmer   { 0% { background-position: -180% 0; } 100% { background-position: 280% 0; } }
@keyframes vt-slide-in  { from { opacity: 0; transform: translateX(var(--slide-from, 18px)); } to { opacity: 1; transform: translateX(0); } }
@keyframes vt-pop-in    { 0% { opacity: 0; transform: scale(.9) translateY(8px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes vt-grow-bar  { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes vt-float     { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-14px) rotate(2deg); } }
@keyframes vt-dot-typing{ 0%,60%,100% { transform: translateY(0); opacity:.45;} 30% { transform: translateY(-4px); opacity:1; } }

.vt-shimmer {
  background: linear-gradient(100deg, transparent 20%, var(--glass-hi) 45%, rgba(243,228,190,0.18) 50%, var(--glass-hi) 55%, transparent 80%);
  background-size: 220% 100%;
  animation: vt-shimmer 2.6s var(--ease-in-out) infinite;
}
.pop-in   { animation: vt-pop-in .42s var(--ease-out) both; }
.slide-in { animation: vt-slide-in .42s var(--ease-out) both; }
.breathe  { animation: vt-breathe 3.4s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ============================================================
   RESPONSIVE PHONE FRAME (resident / owner / tenant)
   Desktop/tablet: a centered device mock. Real phone (<=480px):
   full-bleed, no bezel — a real app, not a mockup in a frame.
   ============================================================ */
.vt-phone {
  width: 390px; height: 844px; border-radius: 54px; padding: 11px;
  position: relative; flex-shrink: 0;
  background: linear-gradient(145deg,#2B2E33,#0E1013);
  box-shadow: 0 50px 100px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.06), inset 0 0 0 2px rgba(255,255,255,0.04);
}
.vt-phone-bezel { position: absolute; inset: 0; border-radius: 54px; box-shadow: inset 0 0 0 1.5px rgba(201,162,77,0.18); pointer-events: none; z-index: 60; }
.vt-phone-screen {
  width: 100%; height: 100%; border-radius: 44px; overflow: hidden; position: relative;
  background: radial-gradient(130% 90% at 50% -6%, var(--bg-top), var(--bg) 46%, var(--bg-bot));
}
@media (max-width: 480px) {
  .vt-phone { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; padding: 0; box-shadow: none; background: transparent; }
  .vt-phone-screen { border-radius: 0; }
  .vt-phone-bezel, .vt-phone-island, .vt-phone-home, .vt-phone-status { display: none !important; }
}

/* ============================================================
   RESPONSIVE DESKTOP CONSOLE (accounting / operator / partner / legal)
   Phone (<=820px): the fixed rail becomes an off-canvas drawer behind a
   burger; the main content area scrolls both axes so nothing is unreachable.
   ============================================================ */
.vtc-burger { display: none; }
@media (max-width: 820px) {
  .vtc-rail {
    position: fixed !important; top: 0; bottom: 0; inset-inline-start: 0; z-index: 120;
    width: 252px !important;
    transform: translateX(-104%); transition: transform .28s cubic-bezier(.16,1,.3,1);
    box-shadow: 0 24px 70px rgba(0,0,0,0.55); overflow-y: auto;
  }
  [dir="rtl"] .vtc-rail { transform: translateX(104%); }
  .vtc-open .vtc-rail { transform: translateX(0) !important; }
  .vtc-scrim { display: none; position: fixed; inset: 0; z-index: 110; background: rgba(2,6,12,0.62); -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px); }
  .vtc-open .vtc-scrim { display: block; }
  .vtc-burger { display: grid !important; place-items: center; width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
    background: var(--card-2, rgba(255,255,255,0.05)); border: 1px solid var(--hairline-2); cursor: pointer; }
  /* let clipped content (wide KPI strips, drilldown grids) be reached by scroll */
  .vtc-scroll { overflow: auto !important; }
  /* stack obvious multi-column grids to one column on phones */
  .vtc-main [style*="grid-template-columns"] { grid-template-columns: 1fr !important; }
  .vtc-main { padding-inline: 0 !important; }
  /* KPI strips: keep one swipeable row, clear of the burger */
  .vtc-main .vtc-kpi { display: flex !important; overflow-x: auto; gap: 18px !important; padding-inline-start: 60px !important; scrollbar-width: none; }
  .vtc-main .vtc-kpi::-webkit-scrollbar { display: none; }
  .vtc-main .vtc-kpi > * { flex: 0 0 auto; min-width: 92px; }
}

/* ===== Manager Internal Chat — responsive single-pane on phones ===== */
@media (max-width: 720px) {
  .mchat-grid { grid-template-columns: 1fr !important; height: 70vh !important; min-height: 420px; }
  .mchat-grid .mchat-thread { display: none !important; }
  .mchat-grid.mchat-show-thread .mchat-list { display: none !important; }
  .mchat-grid.mchat-show-thread .mchat-thread { display: flex !important; }
  .mchat-grid.mchat-show-thread .mchat-back { display: grid !important; }
}

/* ===== Console multi-column form/card grids — shrinkable + collapse on narrow desktops
   (fixes past-viewport overflow at ~1280px: repeat(N,1fr) defaults to minmax(auto,1fr)
   which cannot shrink below content). ===== */
/* card grids (e.g. Demand Center) tolerate narrow columns — collapse late */
.mgr-cards3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
@media (max-width: 1240px) { .mgr-cards3 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
@media (max-width: 760px)  { .mgr-cards3 { grid-template-columns: 1fr !important; } }

/* DENSE input forms (Contractor, Reservation) only fit 3–4 cols on large monitors;
   collapse early so 1366/1440/1536 laptops never overflow, single col on small. */
.mgr-form3 { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
.mgr-form4 { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
@media (max-width: 1600px) { .mgr-form3, .mgr-form4 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; } }
@media (max-width: 1080px) { .mgr-form3, .mgr-form4 { grid-template-columns: 1fr !important; } }
/* asymmetric split (form + side panel) — collapse so inputs never overflow on narrow */
.mgr-split { grid-template-columns: 1.2fr 1fr 1.1fr; }
@media (max-width: 1240px) { .mgr-split { grid-template-columns: 1fr 1fr !important; } }
@media (max-width: 1080px) { .mgr-split { grid-template-columns: 1fr !important; } }
/* nested grids AND their inputs must shrink too, never push the form past the card */
.mgr-cards3 [style*="grid"], .mgr-form3 [style*="grid"], .mgr-form4 [style*="grid"], .mgr-split [style*="grid"] { min-width: 0; }
.mgr-form3 input, .mgr-form4 input, .mgr-form3 select, .mgr-form4 select, .mgr-split input, .mgr-split select { min-width: 0; }

/* ===== GENERIC responsive grid utilities (any panel) — apply a class to a multi-col
   grid so it collapses on narrow screens instead of overflowing. Use .vt-grid* for
   card grids (collapse late) and .vt-form* for dense input forms (collapse early). ===== */
.vt-grid2 { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
.vt-grid3 { grid-template-columns: repeat(3, minmax(0,1fr)) !important; }
.vt-grid4 { grid-template-columns: repeat(4, minmax(0,1fr)) !important; }
@media (max-width: 1100px){ .vt-grid3, .vt-grid4 { grid-template-columns: repeat(2, minmax(0,1fr)) !important; } }
@media (max-width: 680px){ .vt-grid2, .vt-grid3, .vt-grid4 { grid-template-columns: 1fr !important; } }
.vt-form2 { grid-template-columns: repeat(2, minmax(0,1fr)) !important; }
.vt-form3 { grid-template-columns: repeat(3, minmax(0,1fr)) !important; }
.vt-form4 { grid-template-columns: repeat(4, minmax(0,1fr)) !important; }
@media (max-width: 1600px){ .vt-form3, .vt-form4 { grid-template-columns: repeat(2, minmax(0,1fr)) !important; } }
@media (max-width: 1080px){ .vt-form2, .vt-form3, .vt-form4 { grid-template-columns: 1fr !important; } }
.vt-grid2 input,.vt-grid3 input,.vt-grid4 input,.vt-form2 input,.vt-form3 input,.vt-form4 input,
.vt-grid2 select,.vt-grid3 select,.vt-grid4 select,.vt-form2 select,.vt-form3 select,.vt-form4 select { min-width: 0; }
.vt-grid2 [style*="grid"],.vt-grid3 [style*="grid"],.vt-grid4 [style*="grid"],
.vt-form2 [style*="grid"],.vt-form3 [style*="grid"],.vt-form4 [style*="grid"] { min-width: 0; }
