/* Rumah Teduh — Ops & Sales Dashboard
   Design system: warm olive + cream, Plus Jakarta Sans, soft rounded cards.
   Selaras dengan referensi Claude Design (Jun 2026). */

:root {
  /* Brand */
  --olive: #6B7A42;
  --olive-700: #4D5930;
  --olive-300: #aeb38c;
  --olive-soft: #E7EBD8;   /* nav-active / chip tint */
  --olive-tint: #F0F2E6;   /* hover / panel */
  --cream: #EFE6C2;

  /* Status */
  --green: #4f8a52;   --green-soft: #e4eede;
  --blue: #3a626e;    --blue-soft: #e4eef0;
  --amber: #8c6218;   --amber-soft: #f5ebd4;
  --red: #b8503f;     --red-soft: #f6e4df;
  --slate: #7b7e70;   --slate-soft: #eceadf;
  --purple: #5f5189;  --purple-soft: #eae5f1;

  /* Neutrals (warm) */
  --bg: #F3F1E8;
  --surface: #ffffff;
  --surface-2: #faf9f3;
  --ink: #1E1E1E;
  --ink-2: #57594d;
  --ink-3: #8a8c7e;
  --line: #E6E2D5;
  --line-2: #efedde;

  --shadow: 0 1px 2px rgba(45,42,30,.04), 0 1px 3px rgba(45,42,30,.05);
  --shadow-lift: 0 10px 30px rgba(45,42,30,.10), 0 3px 10px rgba(45,42,30,.06);
  --r: 16px; --r-sm: 11px; --r-lg: 22px;
  --pad: 18px;
  --side-w: 248px;
  --maxw: 1140px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
.num { font-variant-numeric: tabular-nums; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--olive-700); text-decoration: none; }
:focus-visible { outline: 2px solid var(--olive); outline-offset: 2px; border-radius: 8px; }
h1,h2,h3 { margin: 0; font-weight: 700; letter-spacing: -.02em; }
.hidden { display: none !important; }

/* ---------- Login gate ---------- */
.gate {
  position: fixed; inset: 0; z-index: 100; padding: 24px; display: grid; place-items: center;
  background: radial-gradient(120% 90% at 50% -10%, #fff 0%, var(--olive-tint) 50%, var(--bg) 100%);
}
.gate-card {
  width: 100%; max-width: 360px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-lift); padding: 32px 26px; text-align: center;
}
.gate-mark {
  width: 56px; height: 56px; border-radius: 18px; margin: 0 auto 14px;
  background: var(--olive); color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: 22px; letter-spacing: -.02em; box-shadow: var(--shadow);
}
.gate-card h1 { font-size: 19px; }
.gate-card p { color: var(--ink-2); margin: 6px 0 20px; font-size: 13px; }
.gate-card input {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--surface-2); margin-bottom: 10px;
}
.gate-err { color: var(--red); font-size: 12.5px; min-height: 18px; margin-bottom: 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 10px 16px; border-radius: var(--r-sm); font-weight: 600; font-size: 13.5px;
  transition: background .15s, box-shadow .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--olive-tint); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--olive); border-color: var(--olive); color: #fff; }
.btn-primary:hover { background: var(--olive-700); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--olive-tint); color: var(--ink); }
.btn-sm { padding: 7px 11px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ---------- App shell (sidebar + content) ---------- */
.app { display: flex; min-height: 100vh; }
.brand { display: flex; align-items: center; gap: 11px; flex-shrink: 0; }
.brand .wm { width: 42px; height: 42px; border-radius: 13px; background: var(--olive);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 16px; letter-spacing: -.02em; }
.brand .nm { font-weight: 700; font-size: 16px; letter-spacing: -.02em; }
.brand .sub { color: var(--ink-3); font-size: 12px; font-weight: 500; }

/* Sidebar (desktop) */
.sidebar {
  width: var(--side-w); flex-shrink: 0; position: sticky; top: 0; height: 100vh;
  background: var(--bg); border-right: 1px solid var(--line);
  padding: 20px 14px 16px; display: flex; flex-direction: column; gap: 22px;
}
.sidebar .brand { padding: 4px 8px 0; }
.nav-vert { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  border: 0; background: transparent; color: var(--ink-2); font-weight: 600; font-size: 14px;
  padding: 10px 12px; border-radius: var(--r-sm); transition: background .15s, color .15s;
}
.nav-item:hover { background: var(--olive-tint); color: var(--ink); }
.nav-item.active { background: var(--olive-soft); color: var(--olive-700); font-weight: 700; }
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.side-foot { margin-top: auto; padding: 8px; display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); }
.side-foot .row-f { display: flex; align-items: center; gap: 8px; }
.pill-refresh { color: var(--ink-3); font-size: 11.5px; white-space: nowrap; }

/* Content column */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar-mobile { display: none; }
.main { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 26px 28px 48px; }

.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.view-head h2 { font-size: 22px; }
.view-head .desc { color: var(--ink-2); font-size: 13px; margin-top: 4px; }

/* ---------- Bottom nav (mobile) ---------- */
.tabs-mobile {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 45;
  background: rgba(255,255,255,.96); backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); display: none;
  padding: 6px 4px calc(6px + var(--safe-b)); grid-template-columns: repeat(7, 1fr); gap: 2px;
}
.mtab {
  border: 0; background: transparent; color: var(--ink-3);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 5px 2px; border-radius: 10px; font-size: 9.5px; font-weight: 600;
}
.mtab svg { width: 21px; height: 21px; }
.mtab.active { color: var(--olive-700); }
.mtab.active .mt-ic { background: var(--olive-soft); }
.mt-ic { width: 40px; height: 26px; border-radius: 9px; display: grid; place-items: center; transition: background .15s; }

/* ---------- Cards & stats ---------- */
.grid { display: grid; gap: 12px; }
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); gap: 11px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 15px 16px; box-shadow: var(--shadow); }
.stat .k { color: var(--ink-3); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 25px; font-weight: 700; margin-top: 4px; letter-spacing: -.02em; }
.stat .v small { font-size: 13px; color: var(--ink-3); font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); padding: var(--pad); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-h h3 { font-size: 15px; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 4px; gap: 2px; box-shadow: var(--shadow); max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { border: 0; background: transparent; color: var(--ink-2); padding: 7px 14px; border-radius: 8px; font-weight: 600; font-size: 12.5px; white-space: nowrap; flex-shrink: 0; }
.seg button.active { background: var(--olive); color: #fff; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--surface); color: var(--ink);
}
textarea.input { resize: vertical; min-height: 76px; }
.input::placeholder { color: var(--ink-3); }

/* ---------- Badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.b-green { background: var(--green-soft); color: var(--green); }
.b-blue { background: var(--blue-soft); color: var(--blue); }
.b-amber { background: var(--amber-soft); color: var(--amber); }
.b-red { background: var(--red-soft); color: var(--red); }
.b-slate { background: var(--slate-soft); color: var(--slate); }
.b-purple { background: var(--purple-soft); color: var(--purple); }
.b-olive { background: var(--olive-soft); color: var(--olive-700); }

/* ---------- Room map ---------- */
.floor { margin-bottom: 20px; }
.floor-h { display: flex; align-items: center; gap: 8px; margin: 4px 2px 11px; }
.floor-h h3 { font-size: 13px; color: var(--ink-2); text-transform: uppercase; letter-spacing: .04em; }
.floor-h .count { color: var(--ink-3); font-size: 12px; }
.rooms { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.room {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 12px 12px 13px 15px; text-align: left; min-height: 96px;
  box-shadow: var(--shadow); transition: box-shadow .15s, transform .05s, border-color .15s;
  display: flex; flex-direction: column; gap: 4px; overflow: hidden;
}
.room:hover { box-shadow: var(--shadow-lift); }
.room:active { transform: translateY(1px); }
.room::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--slate); }
.room.s-terisi::before { background: var(--green); }
.room.s-booked::before { background: var(--blue); }
.room.s-ending::before { background: var(--amber); }
.room.s-kosong::before { background: var(--slate); }
.room.s-maintenance::before { background: var(--red); }
.room .rn { font-size: 18px; font-weight: 800; letter-spacing: -.02em; }
.room .rmeta { font-size: 11px; color: var(--ink-3); }
.room .rocc { font-size: 11.5px; color: var(--ink-2); font-weight: 600; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.room .rtags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: auto; }
.tag { font-size: 9.5px; font-weight: 700; padding: 2.5px 6px; border-radius: 6px; text-transform: uppercase; letter-spacing: .02em; }
.tag-weekly { background: var(--purple-soft); color: var(--purple); }
.tag-soon { background: var(--amber-soft); color: var(--amber); }
.tag-next { background: var(--blue-soft); color: var(--blue); }
.legend { display: flex; flex-wrap: wrap; gap: 13px; margin-bottom: 15px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); font-weight: 500; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* ---------- Lists / rows ---------- */
.rows { display: flex; flex-direction: column; }
.row { display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--line-2); }
.row:last-child { border-bottom: 0; }
.row .av { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; display: grid; place-items: center; font-weight: 800; color: var(--olive-700); background: var(--olive-soft); font-size: 13px; }
.row .meta { flex: 1; min-width: 0; }
.row .meta .t { font-weight: 700; font-size: 13.5px; }
.row .meta .s { color: var(--ink-3); font-size: 12px; margin-top: 1px; }
.row .right { text-align: right; flex-shrink: 0; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

.empty { text-align: center; color: var(--ink-3); padding: 44px 20px; }
.empty .big { font-size: 30px; margin-bottom: 6px; }

/* ---------- Modal / drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(34,33,24,.42); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.open { opacity: 1; pointer-events: auto; }
.sheet { position: fixed; z-index: 61; background: var(--surface); box-shadow: var(--shadow-lift); display: flex; flex-direction: column; transition: transform .25s ease;
  top: 0; right: 0; bottom: 0; width: min(470px, 100%); transform: translateX(100%); border-left: 1px solid var(--line); }
.sheet.open { transform: translateX(0); }
.sheet-h { display: flex; align-items: center; justify-content: space-between; padding: 17px 20px; border-bottom: 1px solid var(--line); }
.sheet-h h3 { font-size: 16px; }
.sheet-b { padding: 20px; overflow-y: auto; flex: 1; }
.sheet-f { padding: 14px 20px calc(14px + var(--safe-b)); border-top: 1px solid var(--line); display: flex; gap: 8px; }
.form-grid { display: grid; gap: 13px; }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line-2); }
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--ink-2); }
.kv .v { font-weight: 600; text-align: right; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; box-shadow: var(--shadow-lift); animation: toastIn .2s ease; max-width: 90vw; }
.toast.ok { background: var(--olive-700); }
.toast.err { background: var(--red); }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Loading ---------- */
.skeleton { background: linear-gradient(90deg, var(--line-2) 25%, var(--line) 37%, var(--line-2) 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: 8px; }
@keyframes sk { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: rot .7s linear infinite; }
.spin.dark { border-color: var(--line); border-top-color: var(--olive); }
@keyframes rot { to { transform: rotate(360deg); } }

/* ---------- Calculator ---------- */
.calc-out { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.calc-out pre { white-space: pre-wrap; font-family: inherit; margin: 0; font-size: 13.5px; line-height: 1.7; }
.note { background: var(--olive-tint); border: 1px solid var(--olive-soft); color: var(--olive-700); border-radius: var(--r-sm); padding: 10px 12px; font-size: 12.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .sidebar { display: none; }
  .app { display: block; padding-bottom: calc(74px + var(--safe-b)); }
  .tabs-mobile { display: grid; }
  .topbar-mobile {
    display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 40;
    background: rgba(243,241,232,.9); backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--line); height: 58px; padding: 0 16px;
  }
  .topbar-mobile .brand .wm { width: 34px; height: 34px; border-radius: 11px; font-size: 14px; }
  .topbar-mobile .topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
  .main { padding: 16px 14px 30px; }
  .rooms { grid-template-columns: 1fr 1fr; }
  .rooms .room { order: var(--m-order, 0); }
  .view-head h2 { font-size: 20px; }
  .stat .v { font-size: 22px; }
  .sheet { top: auto; left: 0; right: 0; bottom: 0; width: 100%; max-height: 92vh;
    transform: translateY(100%); border-left: 0; border-top: 1px solid var(--line);
    border-radius: var(--r-lg) var(--r-lg) 0 0; }
  .sheet.open { transform: translateY(0); }
  .toast-wrap { bottom: calc(84px + var(--safe-b)); }
}
