:root {
  --navy: #0E1A33;
  --navy-2: #1B2B52;
  --navy-3: #243763;
  --saffron: #F2A93B;
  --saffron-hover: #E59A2A;
  --saffron-deep: #B8690B;
  --saffron-ink: #9A4508;
  --paper: #FAFAF7;
  --bg: #F4F5F8;
  --card: #FFFFFF;
  --border: #E3E6EC;
  --border-warm: #E6E4DC;
  --border-strong: #CBD1DB;
  --ink: #0E1A33;
  --ink-2: #334155;
  --muted: #5A6478;
  --blue: #1D4ED8;
  --blue-bg: #E8EEFD;
  --green: #166534;
  --green-bg: #E6F4EA;
  --red: #B91C1C;
  --red-bg: #FDECEC;
  --amber-bg: #FDF0E3;
  --amber-card: #FFF8EE;
  --amber-border: #F2C98A;
  --purple: #6D28D9;
  --purple-bg: #F1EAFE;
  --grey-bg: #EEF0F3;
  --grey-ink: #475569;
  --sidebar-w: 256px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 100vw;
  min-height: 100%;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, 'Noto Sans Devanagari', 'Noto Sans Gurmukhi', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { color: #1E3A8A; }
button, input, select, textarea { font: inherit; color: inherit; }

.hd { font-family: 'Space Grotesk', Inter, 'Noto Sans Devanagari', 'Noto Sans Gurmukhi', -apple-system, BlinkMacSystemFont, sans-serif; }
.serif { font-family: Tinos, 'Times New Roman', Georgia, serif; }
.muted { color: var(--muted); }
.ink2 { color: var(--ink-2); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 13px; }

/* Exact UXTeam Monochrome Stroke Icons */
.ic {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
  display: inline-block;
}
.sm { width: 16px; height: 16px; }
.lg { width: 26px; height: 26px; }

/* App Shell */
.shell { display: flex; min-height: 100vh; width: 100%; }

/* Desktop Sidebar (Only visible on Desktop >= 960px; Mobile uses UXTeam direct page headers + bottom tabbar with ZERO hamburger menu) */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--navy);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 40;
}
.sb-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 20px 18px 14px;
  color: #fff;
}
.sb-brand:hover { color: #fff; }
.sb-wordmark { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.sb-wordmark span { color: var(--saffron); font-weight: 500; }
.sb-sub { font-size: 11.5px; color: #C9D1E3; display: block; margin-top: 2px; }

.sb-tenant {
  margin: 0 12px 10px;
  padding: 9px 10px;
  border-radius: 12px;
  background: var(--navy-2);
  border: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: #fff;
  width: calc(100% - 24px);
  text-align: left;
}
.sb-tenant:hover { background: var(--navy-3); }
.sb-tenant-badge {
  width: 34px; height: 34px; border-radius: 10px;
  background: var(--saffron); color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; flex: none;
}

.sb-scroll { flex: 1; overflow-y: auto; padding: 4px 10px 12px; }
.sb-sec { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #8A9BBF; padding: 14px 10px 6px; }
.sb-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 12px;
  color: #D2DAEB; font-size: 14px; font-weight: 600;
  margin-bottom: 2px;
}
.sb-link:hover { background: rgba(255,255,255,0.08); color: #fff; }
.sb-link.on { background: var(--navy-2); color: #fff; box-shadow: inset 3px 0 0 var(--saffron); }
.sb-link .ic { width: 20px; height: 20px; opacity: 0.9; }
.sb-link .pill-ct {
  margin-left: auto; font-size: 11px; font-weight: 700;
  padding: 2px 7px; border-radius: 999px;
  background: rgba(255,255,255,0.12); color: #E2E7F1;
}
.sb-link .pill-ct.alert { background: #C2410C; color: #fff; }
.sb-link .pill-ct.live { background: rgba(239, 68, 68, 0.25); color: #FCA5A5; }

.sb-footer {
  padding: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.14);
}
.role-picker-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #8A9BBF; margin-bottom: 6px; display: flex; justify-content: space-between; }
.role-select {
  width: 100%; height: 38px; border-radius: 10px;
  background: var(--navy-2); color: #fff;
  border: 1px solid rgba(255,255,255,0.14);
  padding: 0 10px; font-size: 13.5px; font-weight: 600; cursor: pointer;
}

/* Main Workspace Area */
.main-col {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* UXTeam Signature Court Navy Page Header Band */
.hero-band {
  background: var(--navy);
  color: #FFFFFF;
  padding: 20px 28px 18px;
}
.hero-inner {
  max-width: 1180px;
  margin: 0 auto;
}
.page-body {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 16px 28px 40px;
  flex: 1;
}

/* Exact UXTeam Dark Search Input inside Navy Header */
.search-dark {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 14px;
  border-radius: 14px;
  background: var(--navy-2);
  color: #C9D1E3;
  text-decoration: none;
  font-size: 14.5px;
}
.search-dark:hover { color: #fff; background: var(--navy-3); }

/* Compact At-a-Glance Strip inside/under Hero (Replaces the 4 bulky KPI cards while staying 100% UXTeam!) */
.glance-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  margin-top: 12px;
  padding-bottom: 2px;
  scrollbar-width: none;
}
.glance-strip::-webkit-scrollbar { display: none; }
.g-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--navy-2);
  color: #E2E7F1;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s;
}
.g-chip:hover { background: var(--navy-3); color: #fff; }
.g-chip b { font-family: 'Space Grotesk', Inter, sans-serif; font-size: 14px; color: #fff; }
.g-chip.accent b { color: var(--saffron); }
.g-chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }

/* Exact UXTeam Cards, Chips, Buttons, Sections */
.card { background: #fff; border: 1px solid var(--border); border-radius: 16px; }
.card-pad { padding: 14px 16px; }
.plain { text-decoration: none; color: inherit; display: block; }
.plain:hover { color: inherit; border-color: #94A0B4; }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.c-today { background: var(--amber-bg); color: var(--saffron-ink); }
.c-up { background: var(--blue-bg); color: var(--blue); }
.c-ok { background: var(--green-bg); color: var(--green); }
.c-grey { background: var(--grey-bg); color: var(--grey-ink); }
.c-red { background: var(--red-bg); color: var(--red); }
.c-purple { background: var(--purple-bg); color: var(--purple); }
.c-navy { background: var(--navy); color: #fff; }
.c-saffron { background: var(--saffron); color: var(--navy); }
.c-navy2 { background: var(--navy-2); color: #fff; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px; border-radius: 12px; border: 0;
  font-size: 14px; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn-sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.btn-lg { min-height: 52px; padding: 0 20px; font-size: 16px; border-radius: 14px; }
.btn-p { background: var(--navy); color: #fff; }
.btn-p:hover { background: var(--navy-2); color: #fff; }
.btn-s { background: #fff; color: var(--ink); border: 1px solid var(--border-strong); }
.btn-s:hover { background: var(--bg); color: var(--ink); }
.btn-a { background: var(--saffron); color: var(--navy); }
.btn-a:hover { background: var(--saffron-hover); color: var(--navy); }
.btn-off { background: var(--border); color: var(--muted); }
.btn-danger { background: var(--red-bg); color: var(--red); }

.iconbtn {
  width: 44px; height: 44px; border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center;
  color: #fff; text-decoration: none; border: 0; background: transparent; cursor: pointer; flex: none;
}
.iconbtn:hover { background: rgba(255,255,255,0.1); color: #fff; }

.sec {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--muted); margin: 22px 0 8px;
}
.sec:first-child { margin-top: 4px; }

.av { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex: none; }
.av-sm { width: 24px; height: 24px; font-size: 10px; }
.av-lg { width: 40px; height: 40px; font-size: 13px; }
.av-xl { width: 56px; height: 56px; font-size: 18px; }

.ib { width: 42px; height: 42px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.bar { height: 6px; border-radius: 3px; background: var(--grey-bg); overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--saffron); border-radius: 3px; transition: width 0.2s; }
.bar-lg { height: 10px; border-radius: 5px; }

/* Segmented Controls (Exact UXTeam Dark & Light) */
.seg-dark { display: flex; background: var(--navy-2); border-radius: 12px; padding: 3px; margin-top: 12px; }
.seg-dark button { flex: 1; min-height: 38px; border: 0; border-radius: 10px; background: transparent; color: #C9D1E3; font-size: 14px; font-weight: 700; cursor: pointer; padding: 0 12px; }
.seg-dark button.on { background: #fff; color: var(--ink); }

.seg-light { display: inline-flex; background: var(--grey-bg); border-radius: 12px; padding: 3px; }
.seg-light button { min-height: 38px; padding: 0 14px; border: 0; border-radius: 10px; background: transparent; color: var(--ink-2); font-size: 14px; font-weight: 700; cursor: pointer; }
.seg-light button.on { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(14,26,51,0.15); }

/* Case Detail 5-Action Strip & Tabs */
.acts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); background: #fff; border-bottom: 1px solid var(--border); }
.act { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 62px; border: 0; background: none; font-size: 12px; font-weight: 600; color: var(--ink); cursor: pointer; text-decoration: none; }
.act:hover { background: var(--bg); color: var(--ink); }

.tabs-bar { display: flex; gap: 4px; padding: 0 24px; background: #fff; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs-bar::-webkit-scrollbar { display: none; }
.tb { min-height: 46px; padding: 0 12px; border: 0; border-bottom: 3px solid transparent; background: none; font-size: 14px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap; }
.tb.on { color: var(--ink); border-bottom-color: var(--saffron); }

/* Smart List Tiles (Exact UXTeam Cases) */
.sl-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; scrollbar-width: none; }
.sl-strip::-webkit-scrollbar { display: none; }
.sl { display: flex; flex-direction: column; align-items: flex-start; min-width: 102px; padding: 10px 12px; border-radius: 14px; border: 1px solid var(--border); background: #fff; color: var(--ink); cursor: pointer; text-align: left; flex: none; }
.sl.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.sl.warn { border-color: var(--amber-border); background: var(--amber-card); }
.sl.warn.on { background: var(--saffron-ink); border-color: var(--saffron-ink); color: #fff; }

/* Filter Pills */
.pill-bar { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.pill-bar::-webkit-scrollbar { display: none; }
.pill { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-strong); background: #fff; font-size: 13.5px; font-weight: 600; color: var(--ink); cursor: pointer; white-space: nowrap; }
.pill.on { background: var(--navy); border-color: var(--navy); color: #fff; }

.pill-sq { min-height: 44px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--border-strong); background: #fff; font-size: 14px; font-weight: 600; color: var(--ink); cursor: pointer; }
.pill-sq.on { background: var(--navy); border-color: var(--navy); color: #fff; }

/* Rows, KV, Tables */
.row { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 12px 14px; border-bottom: 1px solid var(--grey-bg); text-decoration: none; color: var(--ink); }
.row:last-child { border-bottom: 0; }
a.row:hover, button.row:hover { background: #F8F9FB; color: var(--ink); }
.kv { display: flex; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--grey-bg); font-size: 14px; }
.kv:last-child { border-bottom: 0; }
.kv span:first-child { width: 116px; flex: none; color: var(--muted); }

.tbl-wrap { width: 100%; overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11.5px; font-weight: 700; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); background: #FAFBFD; white-space: nowrap; text-transform: uppercase; letter-spacing: 0.04em; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--grey-bg); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #F8F9FB; }

/* Switches & Checkboxes */
.switch { width: 50px; height: 30px; border-radius: 15px; border: 0; background: var(--border-strong); position: relative; cursor: pointer; flex: none; transition: background 0.15s; }
.switch span { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: left 0.15s; }
.switch.on { background: var(--green); }
.switch.on span { left: 23px; }

.check { width: 26px; height: 26px; border-radius: 8px; border: 2px solid #94A0B4; background: #fff; display: inline-flex; align-items: center; justify-content: center; color: transparent; cursor: pointer; flex: none; }
.check.on { background: var(--green); border-color: var(--green); color: #fff; }

.mx-cell { width: 36px; height: 36px; border-radius: 10px; border: 0; background: var(--grey-bg); color: #94A0B4; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.mx-cell.on { background: var(--green-bg); color: var(--green); }
.mx-cell.lock { cursor: default; background: var(--blue-bg); color: var(--blue); }

/* Inputs */
.field { width: 100%; height: 48px; border: 1px solid var(--border-strong); border-radius: 12px; padding: 0 14px; font-size: 15px; color: var(--ink); background: #fff; }
textarea.field { height: auto; padding: 12px 14px; }

/* Responsive Grids */
.grid-home { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, 1fr); gap: 20px; align-items: start; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.split-order { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 20px; align-items: start; }
.grid-home > *, .grid-2 > *, .grid-3 > *, .grid-4 > *, .split-order > *, .grid-2-always > * { min-width: 0; max-width: 100%; }
.card, .plain, .row { min-width: 0; max-width: 100%; }

/* Calendar Week Strip inside Dark Header */
.week-strip-dark { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-top: 12px; }
.day-dark { display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 74px; padding: 8px 0; border-radius: 14px; border: 0; background: transparent; color: #E2E7F1; cursor: pointer; }
.day-dark.on { background: var(--saffron); color: var(--ink); }
.heat { width: 22px; height: 5px; border-radius: 3px; }

/* Order Paper */
.paper { background: #fff; padding: 24px 24px; border-radius: 8px; box-shadow: 0 2px 10px rgba(14,26,51,0.12); font-family: Tinos, 'Times New Roman', Georgia, serif; font-size: 15px; line-height: 1.6; color: #111; }
.paper mark { background: #FFE7B8; padding: 0 3px; }

/* Modals & Bottom Sheets */
.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(14,26,51,0.55); display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal-panel { background: #fff; border-radius: 22px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; padding: 18px 20px 22px; box-shadow: 0 18px 40px rgba(14,26,51,0.28); }
.grab { display: none; width: 40px; height: 4px; border-radius: 2px; background: var(--border-strong); margin: 0 auto 14px; }

/* Toast */
#toast-root { position: fixed; bottom: 24px; right: 24px; z-index: 95; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 14px; font-size: 14px; font-weight: 600; box-shadow: 0 10px 28px rgba(14,26,51,0.3); border-left: 4px solid var(--saffron); }

/* Mobile Tabbar (EXACT UXTeam 72px bar + 56px Saffron FAB with crisp 26px SVG +) */
.tabbar { display: none; }

/* Auth Split Layout */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--bg); }
.auth-hero { background: var(--navy); color: #fff; padding: 48px 52px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-col { display: flex; align-items: center; justify-content: center; padding: 28px 20px; }

/* Munshi Big Touch Targets */
.munshi-job { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 76px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 18px; background: #fff; color: var(--ink); text-align: left; cursor: pointer; }
.munshi-job.on { background: #F1F8F3; border-color: #B7DFC3; }
.munshi-tick { width: 40px; height: 40px; border-radius: 12px; border: 2px solid #94A0B4; display: flex; align-items: center; justify-content: center; flex: none; color: transparent; }
.munshi-job.on .munshi-tick { background: var(--green); border-color: var(--green); color: #fff; }
.munshi-tile { display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; gap: 12px; min-height: 104px; padding: 14px; border-radius: 18px; text-decoration: none; font-weight: 700; font-size: 15px; border: 0; cursor: pointer; text-align: left; }

@media (max-width: 1080px) {
  .grid-home, .split-order { grid-template-columns: minmax(0, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 959px) {
  .sidebar { display: none; }
  .shell { width: 100%; max-width: 100vw; overflow-x: clip; }
  .main-col { margin-left: 0; width: 100%; max-width: 100vw; padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
  .hero-band { padding: 16px 16px 14px; width: 100%; max-width: 100vw; }
  .page-body { padding: 12px 16px 24px; width: 100%; max-width: 100vw; }
  .tabs-bar { padding: 0 12px; max-width: 100vw; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .grid-2-always { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .desktop-only { display: none !important; }

  /* Exact UXTeam Mobile Bottom Navigation Bar pinned to device width */
  .tabbar {
    display: flex;
    align-items: center;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 100vw;
    z-index: 50;
    height: calc(72px + env(safe-area-inset-bottom, 0px));
    padding: 0 4px env(safe-area-inset-bottom, 0px);
    background: #fff;
    border-top: 1px solid var(--border);
  }
  .tab {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-width: 60px;
    min-height: 52px;
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-decoration: none;
  }
  .tab:hover, .tab.on { color: var(--ink); }
  .tab .badge {
    position: absolute;
    top: 2px;
    right: 10px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: #C2410C;
    color: #fff;
    font-size: 10px;
    line-height: 17px;
    text-align: center;
  }
  .fab {
    width: 56px;
    height: 56px;
    margin-top: -28px;
    border-radius: 18px;
    border: 0;
    background: var(--saffron);
    color: var(--navy);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 18px rgba(14,26,51,0.28);
    cursor: pointer;
    flex: none;
  }

  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal-panel { border-radius: 24px 24px 0 0; max-width: 100%; padding: 12px 16px 24px; }
  .grab { display: block; }
  #toast-root { bottom: 86px; right: 14px; left: 14px; }
  .auth-wrap { grid-template-columns: 1fr; }
  .auth-hero { padding: 32px 20px 26px; }
}

@media (min-width: 960px) {
  .mobile-only { display: none !important; }
  .grid-2-always { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
}

@media print {
  .sidebar, .tabbar, .no-print { display: none !important; }
  .main-col { margin-left: 0 !important; }
}
