/* ==========================================================================
   Chaturmas Nivas Trust PMS — design system
   Tokens taken verbatim from the approved prototype (OKLCH).
   ========================================================================== */
:root {
  --page-bg:      oklch(97.5% 0.008 75);
  --surface:      oklch(99% 0.004 75);
  --surface-2:    oklch(96% 0.015 90);
  --border:       oklch(90% 0.01 75);
  --border-in:    oklch(88% 0.01 75);
  --hair:         oklch(94% 0.008 75);
  --ink:          oklch(22% 0.015 75);
  --ink-2:        oklch(30% 0.02 75);
  --muted:        oklch(48% 0.02 75);
  --muted-2:      oklch(55% 0.02 75);
  --link:         oklch(45% 0.13 55);

  --sidebar-bg:   oklch(26% 0.05 30);
  --sidebar-ink:  oklch(96% 0.01 70);
  --sidebar-mut:  oklch(75% 0.03 60);
  --sidebar-lbl:  oklch(60% 0.03 60);
  --sidebar-act:  oklch(38% 0.07 35);
  --sidebar-dot:  oklch(70% 0.15 55);
  --sidebar-div:  oklch(38% 0.04 30);

  --primary:      oklch(65% 0.14 55);
  --primary-ink:  oklch(20% 0.02 60);
  --dark:         oklch(24% 0.02 75);
  --green:        oklch(55% 0.14 150);

  /* status */
  --ok-bg:   oklch(90% 0.06 145); --ok-tx:   oklch(38% 0.1 145);
  --warn-bg: oklch(92% 0.06 85);  --warn-tx: oklch(42% 0.1 85);
  --dang-bg: oklch(92% 0.06 30);  --dang-tx: oklch(42% 0.12 30);
  --info-bg: oklch(90% 0.03 250); --info-tx: oklch(40% 0.1 250);
  --neutral-bg: oklch(92% 0.01 75); --neutral-tx: oklch(48% 0.02 75);

  --font-body: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-head: 'Lora', Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--page-bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: oklch(85% 0.01 75); border-radius: 4px; }
a { color: var(--link); text-decoration: none; }
a:hover { color: oklch(38% 0.14 55); }
h1,h2,h3,h4 { margin: 0; }

/* ---- App shell ---- */
.app { display: flex; width: 100%; min-height: 100vh; }
.sidebar {
  width: 248px; flex-shrink: 0; background: var(--sidebar-bg); color: var(--sidebar-ink);
  display: flex; flex-direction: column; padding: 16px 14px; gap: 2px;
  overflow-y: auto; position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 6px 10px 14px; }
.sidebar .brand .name { font-family: var(--font-head); font-weight: 600; font-size: 16px; line-height: 1.25; }
.sidebar .brand .sub { font-size: 11px; color: var(--sidebar-mut); margin-top: 2px; letter-spacing: .3px; }
.nav-group { margin-bottom: 6px; }
.nav-label { font-size: 10px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase; color: var(--sidebar-lbl); padding: 4px 12px 3px; }
.nav-item {
  display: flex; align-items: center; gap: 9px; padding: 6px 12px; border-radius: 7px;
  cursor: pointer; font-size: 13px; font-weight: 500; color: var(--sidebar-mut); text-decoration: none;
}
.nav-item:hover { color: var(--sidebar-ink); }
.nav-item .dot { width: 6px; height: 6px; border-radius: 50%; background: oklch(50% 0.03 40); flex-shrink: 0; }
.nav-item.active { background: var(--sidebar-act); color: var(--sidebar-ink); }
.nav-item.active .dot { background: var(--sidebar-dot); }
.sidebar .profile {
  margin-top: auto; padding: 10px; border-top: 1px solid var(--sidebar-div);
  display: flex; align-items: center; gap: 9px;
}
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: var(--primary-ink);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; flex-shrink: 0;
}
.profile .who { font-size: 12.5px; font-weight: 600; }
.profile .role { font-size: 11px; color: var(--sidebar-mut); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 64px; flex-shrink: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
}
.topbar .title { font-family: var(--font-head); font-size: 20px; font-weight: 600; }
.topbar .right { display: flex; align-items: center; gap: 14px; }
.daychip { font-size: 13px; color: oklch(45% 0.02 75); background: oklch(93% 0.015 90); padding: 6px 12px; border-radius: 20px; font-weight: 600; }
.vdiv { width: 1px; height: 24px; background: var(--border); }
.content { flex: 1; overflow-y: auto; padding: 26px 28px 60px; }

/* ---- Cards / panels ---- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 22px; }
.card.pad18 { padding: 18px 20px; }
.card.flush { padding: 0; overflow: hidden; }
.panel-title { font-weight: 700; font-size: 15px; margin-bottom: 14px; }
.panel-title.sm { font-size: 14.5px; }
.subtle { font-size: 12.5px; color: var(--muted); }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2,1fr); }
.g3 { grid-template-columns: repeat(3,1fr); }
.g4 { grid-template-columns: repeat(4,1fr); }
.g5 { grid-template-columns: repeat(5,1fr); }
.g6 { grid-template-columns: repeat(6,1fr); }
.mb12 { margin-bottom: 12px; } .mb16 { margin-bottom: 16px; } .mb20 { margin-bottom: 20px; }
.mb22 { margin-bottom: 22px; } .mb26 { margin-bottom: 26px; } .mt16 { margin-top: 16px; }
.row { display: flex; gap: 16px; } .between { justify-content: space-between; align-items: center; }
.wrap { flex-wrap: wrap; } .aic { align-items: center; }

/* ---- KPI ---- */
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 18px 20px; }
.kpi .label { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.kpi .value { font-size: 26px; font-weight: 800; font-family: var(--font-head); color: oklch(24% 0.02 75); }
.kpi .value.sm { font-size: 22px; }
.kpi .trend { font-size: 12px; margin-top: 6px; font-weight: 600; }

/* ---- Badges & chips ---- */
.badge { font-size: 11.5px; font-weight: 700; padding: 4px 10px; border-radius: 20px; display: inline-block; white-space: nowrap; }
.badge.sm { font-size: 11px; padding: 3px 9px; }
.b-ok   { background: var(--ok-bg);   color: var(--ok-tx); }
.b-warn { background: var(--warn-bg); color: var(--warn-tx); }
.b-dang { background: var(--dang-bg); color: var(--dang-tx); }
.b-info { background: var(--info-bg); color: var(--info-tx); }
.b-mut  { background: var(--neutral-bg); color: var(--neutral-tx); }
.chip {
  padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; cursor: pointer;
  background: transparent; color: oklch(40% 0.02 75); border: 1px solid oklch(85% 0.01 75); text-decoration: none; display: inline-block;
}
.chip.active { background: var(--dark); color: #fff; border-color: var(--dark); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- Buttons ---- */
.btn { font-size: 13.5px; font-weight: 700; padding: 11px 20px; border-radius: 9px; cursor: pointer; text-align: center; border: none; display: inline-block; font-family: inherit; text-decoration: none; }
.btn-primary { background: var(--primary); color: var(--primary-ink); }
.btn-dark { background: var(--dark); color: #fff; }
.btn-green { background: var(--green); color: #fff; }
.btn-ghost { background: transparent; border: 1px solid oklch(85% 0.01 75); color: var(--ink); }
.btn.sm { padding: 9px 15px; font-size: 12.5px; }
.btn.xs { padding: 7px 14px; font-size: 12.5px; border-radius: 8px; }
.btn[disabled], .btn.disabled { opacity: .5; pointer-events: none; }
.link-btn { font-size: 13px; font-weight: 600; color: var(--link); cursor: pointer; }
.back-link { font-size: 13px; font-weight: 600; color: var(--link); cursor: pointer; margin-bottom: 16px; display: inline-block; }

/* ---- Forms ---- */
.field { display: flex; flex-direction: column; }
.field.span2 { grid-column: 1 / 3; }
.field-label { font-size: 12px; font-weight: 600; margin-bottom: 5px; color: var(--muted); }
input, textarea, select {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border-in);
  font-family: inherit; font-size: 13px; background: #fff; color: var(--ink);
}
textarea { min-height: 56px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
label.check { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; cursor: pointer; }
label.check input { width: auto; }

/* ---- Tables (grid based) ---- */
.tbl { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.tbl .thead, .tbl .trow { display: grid; gap: 16px; padding: 12px 20px; align-items: center; }
.tbl .thead { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); border-bottom: 1px solid var(--border); }
.tbl .trow { font-size: 13.5px; border-bottom: 1px solid var(--hair); }
.tbl .trow:last-child { border-bottom: none; }
.tbl .trow.click { cursor: pointer; }
.tbl .trow.click:hover { background: oklch(97% 0.008 75); }
.strong { font-weight: 700; }
.link-cell { font-weight: 700; color: var(--link); cursor: pointer; }
.muted { color: var(--muted); }
.moneyf { font-family: var(--font-head); font-weight: 800; }

/* ---- Pagination ---- */
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; }
.pgs { display: flex; align-items: center; gap: 6px; }
.pg { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid transparent; color: var(--ink-2); }
.pg.edge { border-color: var(--border-in); color: var(--muted-2); }
.pg.cur { background: var(--dark); color: #fff; font-weight: 700; }

/* ---- Progress bars ---- */
.bar { height: 9px; border-radius: 6px; background: oklch(92% 0.01 75); overflow: hidden; }
.bar.sm { height: 6px; border-radius: 4px; }
.bar > i { display: block; height: 100%; border-radius: inherit; background: var(--primary); }

/* ---- Room tiles ---- */
.room-grid { display: grid; gap: 8px; }
.room-tile { aspect-ratio: 1; border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 700; }
.rt-vacant { background: oklch(70% 0.15 150); color: oklch(20% 0.08 150); }
.rt-occupied { background: oklch(60% 0.02 260); color: oklch(95% 0.01 260); }
.rt-cleaning { background: oklch(80% 0.15 85); color: oklch(30% 0.1 85); }
.rt-maintenance { background: oklch(72% 0.17 30); color: oklch(98% 0.02 30); }
.rt-reserved { background: oklch(80% 0.09 250); color: oklch(30% 0.1 250); }
.rt-blocked { background: oklch(58% 0.1 300); color: oklch(95% 0.02 300); }
.rt-vip { background: oklch(75% 0.16 70); color: oklch(30% 0.1 70); }
.avail-tile { padding: 9px; border-radius: 8px; background: oklch(93% 0.06 145); text-align: center; }
.avail-tile .n { font-weight: 700; font-size: 12.5px; color: oklch(30% 0.1 150); }
.avail-tile .c { font-size: 10.5px; color: oklch(40% 0.08 150); margin-top: 1px; }

/* ---- Notices ---- */
.notice { padding: 11px 16px; border-radius: 9px; font-size: 13px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.notice.ok   { background: oklch(93% 0.06 145); color: oklch(30% 0.1 150); }
.notice.warn { background: oklch(94% 0.07 50); color: oklch(38% 0.12 50); }
.notice.dang { background: oklch(95% 0.06 30); color: oklch(35% 0.12 30); }
.flash { position: fixed; top: 76px; right: 28px; z-index: 300; box-shadow: 0 10px 30px rgba(0,0,0,.15); }

/* ---- Modals ---- */
.scrim { position: fixed; inset: 0; background: oklch(20% 0.01 75 / 55%); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: var(--surface); border-radius: 16px; max-width: 94vw; max-height: 88vh; overflow-y: auto; padding: 26px 28px; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.modal.w440 { width: 440px; } .modal.w560 { width: 560px; } .modal.w620 { width: 620px; } .modal.w680 { width: 680px; }
.modal-close { width: 32px; height: 32px; border-radius: 50%; background: oklch(94% 0.005 75); display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 16px; color: oklch(40% 0.02 75); flex-shrink: 0; text-decoration: none; }
.modal-kicker { font-size: 11.5px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.modal-title { font-family: var(--font-head); font-weight: 700; font-size: 19px; margin-top: 4px; }
.dl { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 20px; font-size: 13.5px; }
.dl .k { color: var(--muted); font-size: 12px; }
.dl .v { font-weight: 700; margin-top: 2px; }

/* ---- Stepper ---- */
.stepper { display: flex; gap: 6px; margin: 16px 0 20px; }
.stepper > i { flex: 1; height: 4px; border-radius: 3px; background: var(--border); }
.stepper > i.on { background: var(--primary); }
.slip { border: 1px dashed oklch(75% 0.02 75); border-radius: 12px; padding: 20px; }

/* ---- Settings ---- */
.settings { display: flex; gap: 24px; align-items: flex-start; }
.settings .tabs { width: 200px; flex-shrink: 0; display: flex; flex-direction: column; gap: 4px; }
.settings .tab { padding: 10px 14px; border-radius: 8px; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--ink-2); text-decoration: none; }
.settings .tab.active { background: var(--dark); color: #fff; }
.settings .pane { flex: 1; min-width: 0; }
.mini-form { display: flex; gap: 10px; align-items: flex-end; padding: 14px; border-radius: 10px; background: var(--surface-2); }

/* ---- Image upload slot placeholder ---- */
.image-slot {
  width: 100%; height: 100%; border: 1.5px dashed var(--border-in); border-radius: 10px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--muted); font-size: 12px; text-align: center; cursor: pointer; background: oklch(97% 0.006 75); overflow: hidden;
}
.image-slot.filled { border-style: solid; }
.image-slot img { width: 100%; height: 100%; object-fit: cover; }
.image-slot input[type=file] { display: none; }

/* ---- Misc utility ---- */
.dashed-add { border: 1.5px dashed oklch(85% 0.01 75); border-radius: 12px; padding: 14px 16px; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.hidden { display: none; }
.tag-basis { font-size: 11px; color: oklch(38% 0.1 55); font-weight: 700; }

@media print {
  .sidebar, .topbar, .no-print { display: none !important; }
  .content { padding: 0; }
  .app { display: block; }
  .print-only-slip { box-shadow: none; }
}

@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2,1fr); }
  .g5, .g6 { grid-template-columns: repeat(3,1fr); }
}
@media (max-width: 760px) {
  .sidebar { display: none; }
  .g2, .g3, .g4, .g5, .g6 { grid-template-columns: 1fr; }
  .settings { flex-direction: column; }
  .settings .tabs { width: 100%; flex-direction: row; overflow-x: auto; }
}
