/* DARA 2.0 — Tenant Admin Console */
:root {
  --accent-h: 220;
  --accent-c: 0.13;
  --accent-l: 55%;
  --accent: oklch(var(--accent-l) var(--accent-c) var(--accent-h));
  --accent-hover: oklch(48% var(--accent-c) var(--accent-h));
  --accent-soft: oklch(96% 0.025 var(--accent-h));
  --accent-soft-2: oklch(92% 0.045 var(--accent-h));
  --accent-ink: oklch(30% 0.08 var(--accent-h));

  --bg: oklch(99% 0.003 240);
  --surface: #ffffff;
  --surface-2: oklch(98% 0.004 240);
  --surface-3: oklch(96% 0.005 240);
  --border: oklch(92% 0.006 240);
  --border-strong: oklch(86% 0.008 240);

  --ink: oklch(22% 0.012 240);
  --ink-2: oklch(42% 0.012 240);
  --ink-3: oklch(58% 0.01 240);
  --ink-4: oklch(72% 0.008 240);

  --green: oklch(62% 0.14 155);
  --green-soft: oklch(95% 0.04 155);
  --amber: oklch(72% 0.15 75);
  --amber-soft: oklch(96% 0.05 75);
  --red: oklch(58% 0.19 22);
  --red-soft: oklch(96% 0.04 22);
  --violet: oklch(52% 0.17 295);
  --violet-soft: oklch(96% 0.04 295);

  --shadow-sm: 0 1px 2px oklch(20% 0.02 240 / 0.04);
  --shadow-md: 0 6px 24px -8px oklch(20% 0.02 240 / 0.12), 0 2px 4px oklch(20% 0.02 240 / 0.04);
  --shadow-lg: 0 24px 60px -12px oklch(20% 0.02 240 / 0.18), 0 4px 8px oklch(20% 0.02 240 / 0.06);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;

  --font-sans: "Inter Tight", "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body, #root { height: 100%; margin: 0; }
body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01", "ss03";
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, select, textarea { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
.tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }

/* ---------------- App shell ---------------- */
.app {
  display: grid;
  grid-template-columns: 232px 1fr;
  height: 100vh;
  overflow: hidden;
}
.sidebar {
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  gap: 2px;
  overflow-y: auto;
}
.sidebar .brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px 14px;
}
.sidebar .brand .logo {
  width: 28px; height: 28px;
  background: var(--accent);
  border-radius: 7px;
  display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 14px;
  letter-spacing: -0.02em;
  box-shadow: inset 0 -6px 10px -4px oklch(30% 0.1 var(--accent-h));
}
.sidebar .brand .name {
  font-weight: 600; letter-spacing: -0.01em; font-size: 15px;
}
.sidebar .brand .tenant {
  font-size: 11px; color: var(--ink-3); margin-top: 1px;
}

.nav-group { padding: 12px 10px 4px; font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  position: relative;
}
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); }
.nav-item .icon { width: 16px; height: 16px; flex-shrink: 0; color: var(--ink-3); }
.nav-item.active .icon { color: var(--accent); }
.nav-item .badge {
  margin-left: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 7px;
  font-size: 11px; font-weight: 600;
  color: var(--ink-2);
}
.nav-item.active .badge { background: #fff; border-color: var(--accent-soft-2); color: var(--accent-ink); }

.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.user-chip {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}
.user-chip:hover { background: var(--surface-3); }
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 600; font-size: 11px;
  color: #fff; flex-shrink: 0;
  letter-spacing: 0.02em;
}
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }
.avatar.lg { width: 40px; height: 40px; font-size: 14px; }

/* ---------------- Main ---------------- */
.main {
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
}
.topbar {
  height: 52px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center;
  padding: 0 24px;
  gap: 14px;
  background: var(--surface);
  position: sticky; top: 0; z-index: 20;
}
.breadcrumb { color: var(--ink-3); font-size: 13px; display: flex; align-items: center; gap: 8px; }
.breadcrumb strong { color: var(--ink); font-weight: 500; }
.topbar .search {
  flex: 1; max-width: 420px;
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-3);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  color: var(--ink-3);
  font-size: 13px;
}
.topbar .search:focus-within { border-color: var(--accent-soft-2); background: var(--surface); }
.topbar .search input { flex: 1; border: 0; outline: 0; background: transparent; }
.topbar .search kbd {
  font-family: var(--font-mono); font-size: 10.5px;
  padding: 1px 5px; border-radius: 4px;
  background: var(--surface); border: 1px solid var(--border); color: var(--ink-3);
}
.topbar-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.page {
  padding: 28px 32px 60px;
  max-width: 1440px;
}
.page-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}
.page-title {
  font-size: 24px; font-weight: 600; letter-spacing: -0.02em;
  margin: 0 0 4px;
}
.page-subtitle { color: var(--ink-3); font-size: 13.5px; }

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 500;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  transition: all 0.12s;
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); }
.btn.primary {
  background: var(--accent); color: #fff; border-color: var(--accent);
  box-shadow: inset 0 -2px 0 oklch(45% var(--accent-c) var(--accent-h) / 0.4);
}
.btn.primary:hover { background: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--ink); }
.btn.danger { color: var(--red); border-color: var(--red-soft); }
.btn.danger:hover { background: var(--red-soft); }
.btn.sm { padding: 4px 8px; font-size: 12px; }
.btn.lg { padding: 10px 16px; font-size: 14px; }
.btn .icon { width: 14px; height: 14px; }
.btn[disabled] { opacity: 0.5; cursor: not-allowed; }
.icon-btn {
  width: 30px; height: 30px;
  border-radius: var(--radius-sm);
  display: grid; place-items: center;
  color: var(--ink-3);
}
.icon-btn:hover { background: var(--surface-3); color: var(--ink); }

/* ---------------- Cards ---------------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.card-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.card-title { font-weight: 600; font-size: 14px; letter-spacing: -0.005em; }
.card-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.card-body { padding: 18px; }

/* ---------------- KPI tiles ---------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 20px;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  position: relative;
  overflow: hidden;
}
.kpi .label { font-size: 12px; color: var(--ink-3); font-weight: 500; letter-spacing: 0.01em; }
.kpi .value { font-size: 28px; font-weight: 600; letter-spacing: -0.03em; margin-top: 8px; }
.kpi .delta { font-size: 12px; margin-top: 4px; color: var(--ink-3); }
.kpi .delta.up { color: var(--green); }
.kpi .delta.down { color: var(--red); }
.kpi .spark { position: absolute; right: 14px; bottom: 12px; opacity: 0.5; }

/* ---------------- Tables ---------------- */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.table th {
  text-align: left;
  font-weight: 500;
  color: var(--ink-3);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.selected { background: var(--accent-soft); }

/* ---------------- Badges / Pills ---------------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid transparent;
  white-space: nowrap;
}
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pill.onsite { color: var(--green); background: var(--green-soft); }
.pill.pending { color: oklch(48% 0.14 75); background: var(--amber-soft); }
.pill.denied { color: var(--red); background: var(--red-soft); }
.pill.vip { color: var(--violet); background: var(--violet-soft); }
.pill.checkedout { color: var(--ink-3); background: var(--surface-3); }
.pill.approved { color: var(--green); background: var(--green-soft); }
.pill.scheduled { color: var(--accent-ink); background: var(--accent-soft); }

/* ---------------- Inputs ---------------- */
.field {
  display: flex; flex-direction: column; gap: 6px;
}
.field label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
}
.field .hint { font-size: 12px; color: var(--ink-3); }
.input, .select, .textarea {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13.5px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
  transition: border-color 0.1s, box-shadow 0.1s;
  width: 100%;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft-2);
}
.textarea { min-height: 78px; resize: vertical; }

.seg {
  display: inline-flex; background: var(--surface-3); padding: 2px; border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.seg button {
  padding: 5px 12px;
  border-radius: 5px;
  font-size: 12.5px;
  color: var(--ink-2);
  font-weight: 500;
}
.seg button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ---------------- Tabs ---------------- */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tabs .tab {
  padding: 10px 14px;
  font-size: 13px;
  color: var(--ink-3);
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.tabs .tab:hover { color: var(--ink); }
.tabs .tab.active { color: var(--ink); border-bottom-color: var(--accent); }

/* ---------------- Dashboard layout ---------------- */
.col-split-2 {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 16px;
}
.col-split-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

/* ---------------- Live map / floor plan ---------------- */
.floor {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(oklch(97% 0.005 240) 1px, transparent 1px) 0 0 / 24px 24px,
    linear-gradient(90deg, oklch(97% 0.005 240) 1px, transparent 1px) 0 0 / 24px 24px,
    var(--surface-2);
  border-radius: var(--radius);
  overflow: hidden;
}
.room {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 11px;
  color: var(--ink-3);
}
.room .rn { font-weight: 500; color: var(--ink-2); font-size: 11.5px; }
.pin {
  position: absolute;
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff; font-size: 10px; font-weight: 600;
  border: 2px solid #fff;
  box-shadow: 0 2px 4px oklch(20% 0.02 240 / 0.2);
  cursor: pointer;
}

/* ---------------- Modal / Drawer ---------------- */
.scrim {
  position: fixed; inset: 0;
  background: oklch(20% 0.02 240 / 0.36);
  z-index: 100;
  backdrop-filter: blur(2px);
  animation: scrimIn 0.18s ease;
}
@keyframes scrimIn { from { opacity: 0; } to { opacity: 1; } }
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 520px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 101;
  display: flex; flex-direction: column;
  animation: drawerIn 0.22s cubic-bezier(.2,.8,.2,1);
}
@keyframes drawerIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.drawer-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.drawer-body { flex: 1; overflow-y: auto; padding: 22px; }
.drawer-footer {
  border-top: 1px solid var(--border);
  padding: 14px 22px;
  display: flex; gap: 8px; justify-content: flex-end;
}

.modal {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 560px;
  max-width: calc(100vw - 40px);
  max-height: 86vh;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 101;
  display: flex; flex-direction: column;
  animation: modalIn 0.2s cubic-bezier(.2,.8,.2,1);
}
@keyframes modalIn { from { transform: translate(-50%, -48%); opacity: 0; } to { transform: translate(-50%, -50%); opacity: 1; } }

/* ---------------- Workflow canvas ---------------- */
.flow-canvas {
  background:
    radial-gradient(circle at 1px 1px, oklch(90% 0.005 240) 1px, transparent 0) 0 0 / 18px 18px,
    var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 520px;
  position: relative;
  overflow: hidden;
}
.flow-node {
  position: absolute;
  width: 180px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow-sm);
  cursor: grab;
  user-select: none;
}
.flow-node.selected {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft-2);
}
.flow-node .title { font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.flow-node .desc { font-size: 11.5px; color: var(--ink-3); margin-top: 4px; }
.flow-node .type-dot {
  width: 8px; height: 8px; border-radius: 50%;
}

/* ---------------- Tweaks panel ---------------- */
.tweaks {
  position: fixed;
  bottom: 18px; right: 18px;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 200;
  overflow: hidden;
  display: none;
}
.tweaks.open { display: block; }
.tweaks h4 { margin: 0; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; font-weight: 600; }
.tweaks .body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.swatch {
  width: 100%; aspect-ratio: 1; border-radius: 6px;
  border: 2px solid transparent;
  cursor: pointer;
}
.swatch.active { border-color: var(--ink); }

/* scroll */
.main::-webkit-scrollbar, .drawer-body::-webkit-scrollbar, .sidebar::-webkit-scrollbar { width: 10px; height: 10px; }
.main::-webkit-scrollbar-thumb, .drawer-body::-webkit-scrollbar-thumb, .sidebar::-webkit-scrollbar-thumb {
  background: oklch(88% 0.006 240); border-radius: 10px; border: 2px solid var(--bg);
}

/* misc */
.row { display: flex; align-items: center; gap: 8px; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--border); margin: 12px 0; }
.muted { color: var(--ink-3); }
.stack-sm { display: flex; flex-direction: column; gap: 4px; }
.stack-md { display: flex; flex-direction: column; gap: 10px; }
.stack-lg { display: flex; flex-direction: column; gap: 18px; }
.hstack { display: flex; align-items: center; gap: 10px; }

/* chart */
.bar-chart { display: flex; align-items: flex-end; gap: 6px; height: 140px; padding: 8px 0; }
.bar { flex: 1; background: var(--accent-soft); border-radius: 3px 3px 0 0; position: relative; min-height: 4px; }
.bar .fill { position: absolute; bottom: 0; left: 0; right: 0; background: var(--accent); border-radius: 3px 3px 0 0; }

/* step indicator */
.steps { display: flex; align-items: center; gap: 0; margin-bottom: 24px; }
.step {
  display: flex; align-items: center; gap: 8px;
  padding-right: 18px; color: var(--ink-3); font-size: 12.5px; font-weight: 500;
}
.step .dot { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--border-strong); background: var(--surface); font-size: 11px; font-weight: 600; }
.step.done .dot { background: var(--accent); color: #fff; border-color: var(--accent); }
.step.active { color: var(--ink); }
.step.active .dot { background: var(--accent); color: #fff; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft-2); }
.step-connector { height: 1px; width: 36px; background: var(--border); margin-right: 18px; }
.step.done + .step-connector { background: var(--accent); }

/* command palette */
.cmdk {
  position: fixed; top: 20%; left: 50%; transform: translateX(-50%);
  width: 560px; max-width: 90vw;
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 120; overflow: hidden;
}
