:root {
  --bg: #f4efe6;
  --bg-2: #ece6d8;
  --bg-3: #e2dac8;
  --ink: #1a1814;
  --ink-2: #3a352c;
  --ink-3: #6b6254;
  --ink-4: #9a9080;
  --line: #1a1814;
  --line-soft: #c4b89e;
  --accent: #e85d3a;
  --accent-2: #2b4c7e;
  --accent-3: #4a7c3a;
  --tan: #c4b08a;
  --cream: #faf6ec;
  --paper: #f9f4e8;

  --mono: "JetBrains Mono", ui-monospace, monospace;
  --serif: "Instrument Serif", "Times New Roman", serif;
  --sans: "Geist", ui-sans-serif, system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body, #root { height: 100%; width: 100%; overflow: hidden; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  user-select: none;
  cursor: default;
}

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }

/* ============ DESKTOP ============ */
.desktop {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 40% at 70% 20%, rgba(232,93,58,0.06), transparent 60%),
    radial-gradient(ellipse 50% 40% at 20% 80%, rgba(43,76,126,0.05), transparent 60%),
    var(--bg);
  overflow: hidden;
}
.desktop-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, rgba(26,24,20,0.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(26,24,20,0.035) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}
.desktop-noise {
  position: absolute; inset: 0;
  opacity: 0.35;
  pointer-events: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.08 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  mix-blend-mode: multiply;
}

/* ============ MENUBAR ============ */
.menubar {
  position: absolute; top: 0; left: 0; right: 0; height: 28px;
  background: rgba(250,246,236,0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--ink);
  display: flex; align-items: center;
  padding: 0 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  z-index: 1000;
  gap: 0;
}
.menubar-logo {
  width: 20px; height: 20px;
  background: var(--ink);
  color: var(--bg);
  display: grid; place-items: center;
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  margin-right: 12px;
}
.menubar-item { padding: 4px 10px; letter-spacing: 0.02em; }
.menubar-item:hover { background: var(--ink); color: var(--bg); }
.menubar-item.active { background: var(--ink); color: var(--bg); }
.menubar-spacer { flex: 1; }
.menubar-right { display: flex; align-items: center; gap: 14px; font-size: 10.5px; color: var(--ink-2); }
.menubar-right .pill { display: inline-flex; gap: 4px; align-items: center; }

.menubar-dropdown {
  position: absolute;
  top: 28px;
  background: var(--paper);
  border: 1px solid var(--ink);
  min-width: 220px;
  box-shadow: 4px 4px 0 rgba(26,24,20,0.15);
  font-family: var(--mono);
  font-size: 11px;
  padding: 4px 0;
  z-index: 2000;
}
.menubar-dropdown-item { padding: 5px 12px; display: flex; justify-content: space-between; gap: 20px; }
.menubar-dropdown-item:hover { background: var(--ink); color: var(--bg); }
.menubar-dropdown-sep { height: 1px; background: var(--line-soft); margin: 4px 0; }
.menubar-dropdown-kbd { color: var(--ink-4); font-size: 10px; }
.menubar-dropdown-item:hover .menubar-dropdown-kbd { color: var(--bg-3); }

/* ============ WINDOW CHROME ============ */
.window {
  position: absolute;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow:
    3px 3px 0 rgba(26,24,20,0.12),
    8px 8px 24px rgba(26,24,20,0.08);
  display: flex; flex-direction: column;
  min-width: 320px;
  overflow: hidden;
}
.window.minimized { display: none; }
.window-titlebar {
  display: flex; align-items: center;
  height: 24px;
  padding: 0 8px;
  background: var(--ink);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  cursor: grab;
  user-select: none;
  flex-shrink: 0;
  position: relative;
}
.window-titlebar:active { cursor: grabbing; }
.window-titlebar::before {
  content: '';
  position: absolute;
  inset: 4px 80px 4px 60px;
  background-image: repeating-linear-gradient(
    90deg,
    rgba(244,239,230,0.25) 0 1px,
    transparent 1px 3px
  );
  pointer-events: none;
}
.window-title { position: relative; z-index: 2; padding: 0 6px; background: var(--ink); white-space: nowrap; }
.window-traffic { display: flex; gap: 4px; z-index: 2; }
.window-traffic button {
  width: 11px; height: 11px;
  border: 1px solid var(--bg);
  background: var(--bg);
  color: var(--ink);
  font-size: 9px;
  line-height: 1;
  display: grid; place-items: center;
  font-family: var(--mono);
}
.window-traffic button:hover { background: var(--accent); color: var(--bg); }
.window-traffic button.close:hover { background: var(--accent); }
.window-meta {
  margin-left: auto; z-index: 2; font-size: 9px; opacity: 0.6;
  padding-left: 8px;
}
.window-body { flex: 1; overflow: auto; position: relative; }
.window-body::-webkit-scrollbar { width: 10px; height: 10px; }
.window-body::-webkit-scrollbar-track { background: var(--bg-2); }
.window-body::-webkit-scrollbar-thumb { background: var(--ink-3); border: 2px solid var(--bg-2); }
.window-body::-webkit-scrollbar-thumb:hover { background: var(--ink); }
.window-resize {
  position: absolute; bottom: 0; right: 0; width: 14px; height: 14px;
  cursor: nwse-resize;
  background:
    linear-gradient(135deg, transparent 50%, var(--ink) 50%, var(--ink) 55%, transparent 55%, transparent 70%, var(--ink) 70%, var(--ink) 75%, transparent 75%, transparent 90%, var(--ink) 90%);
  z-index: 5;
}

.window.focused { box-shadow: 3px 3px 0 rgba(26,24,20,0.18), 10px 10px 32px rgba(26,24,20,0.12); }
.window.unfocused .window-titlebar { background: var(--ink-3); }

/* ============ DOCK ============ */
.dock {
  position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: end; gap: 6px;
  padding: 6px 10px;
  background: rgba(250,246,236,0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--ink);
  border-radius: 4px;
  z-index: 900;
  box-shadow: 0 8px 24px rgba(26,24,20,0.12);
}
.dock-item {
  width: 44px; height: 44px;
  border: 1px solid var(--ink);
  background: var(--cream);
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  position: relative;
  transition: transform 150ms ease;
  cursor: pointer;
}
.dock-item:hover { transform: translateY(-6px) scale(1.08); }
.dock-item.active::after {
  content: '';
  position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--ink);
}
.dock-label {
  position: absolute; bottom: 52px; left: 50%; transform: translateX(-50%);
  white-space: nowrap; padding: 3px 8px;
  background: var(--ink); color: var(--bg);
  font-family: var(--mono); font-size: 10px;
  opacity: 0; pointer-events: none;
  transition: opacity 150ms;
}
.dock-item:hover .dock-label { opacity: 1; }
.dock-sep { width: 1px; height: 36px; background: var(--line-soft); margin: 0 4px; align-self: center; }

/* ============ COMPONENTS ============ */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--ink);
  background: var(--cream);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 80ms;
}
.btn:hover { background: var(--ink); color: var(--bg); }
.btn:active { transform: translate(1px,1px); }
.btn.primary { background: var(--ink); color: var(--bg); }
.btn.primary:hover { background: var(--accent); }
.btn.accent { background: var(--accent); color: var(--cream); border-color: var(--ink); }
.btn.sm { padding: 2px 6px; font-size: 10px; }
.btn.icon { width: 26px; height: 26px; padding: 0; justify-content: center; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 7px;
  border: 1px solid var(--ink);
  background: var(--bg-2);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.pill.dot::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-3);
}
.pill.accent { background: var(--accent); color: var(--cream); }
.pill.ink { background: var(--ink); color: var(--bg); }
.pill.outline { background: transparent; }

.badge {
  display: inline-block;
  background: var(--accent);
  color: var(--cream);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  padding: 1px 5px;
  letter-spacing: 0.04em;
}

.input, .textarea, .select {
  border: 1px solid var(--ink);
  background: var(--cream);
  padding: 5px 8px;
  font-family: var(--mono);
  font-size: 11px;
  outline: none;
  width: 100%;
}
.input:focus { background: var(--paper); box-shadow: inset 2px 2px 0 var(--accent); }

.checkbox, .radio {
  width: 14px; height: 14px;
  border: 1px solid var(--ink);
  background: var(--cream);
  display: inline-grid; place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.checkbox.on { background: var(--ink); }
.checkbox.on::after { content: '✓'; color: var(--bg); font-size: 10px; line-height: 1; font-family: var(--mono); font-weight: 700; }
.radio { border-radius: 50%; }
.radio.on::after { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }

.switch {
  width: 28px; height: 16px;
  border: 1px solid var(--ink);
  background: var(--cream);
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
}
.switch::after {
  content: '';
  position: absolute; top: 1px; left: 1px;
  width: 12px; height: 12px;
  background: var(--ink);
  transition: transform 150ms;
}
.switch.on { background: var(--accent); }
.switch.on::after { transform: translateX(12px); background: var(--cream); }

.segmented {
  display: inline-flex;
  border: 1px solid var(--ink);
}
.segmented button {
  padding: 3px 10px;
  font-family: var(--mono);
  font-size: 10.5px;
  border-right: 1px solid var(--ink);
  background: var(--cream);
}
.segmented button:last-child { border-right: none; }
.segmented button.on { background: var(--ink); color: var(--bg); }

.slider-track {
  height: 3px; background: var(--ink-4);
  position: relative; cursor: pointer;
  flex: 1;
}
.slider-fill { position: absolute; top: 0; left: 0; height: 100%; background: var(--accent); }
.slider-thumb {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 12px; height: 12px;
  background: var(--ink);
  border: 2px solid var(--cream);
  cursor: grab;
}

/* ============ TABS ============ */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--ink);
  background: var(--bg-2);
  font-family: var(--mono); font-size: 10.5px;
}
.tab {
  padding: 5px 12px;
  border-right: 1px solid var(--line-soft);
  cursor: pointer;
  letter-spacing: 0.02em;
}
.tab.active { background: var(--paper); font-weight: 600; position: relative; }
.tab.active::after { content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--paper); }
.tab:hover:not(.active) { background: var(--bg-3); }

/* ============ ACCORDION ============ */
.accordion-item { border-bottom: 1px solid var(--line-soft); }
.accordion-head {
  padding: 8px 12px;
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer;
  font-family: var(--mono); font-size: 11px;
  font-weight: 500;
}
.accordion-head:hover { background: var(--bg-2); }
.accordion-chev { transition: transform 150ms; font-family: var(--mono); }
.accordion-item.open .accordion-chev { transform: rotate(90deg); }
.accordion-body { padding: 0 12px 12px; display: none; font-size: 12px; line-height: 1.55; color: var(--ink-2); }
.accordion-item.open .accordion-body { display: block; }

/* ============ TABLE ============ */
.table { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 10.5px; }
.table th, .table td { padding: 5px 10px; text-align: left; border-bottom: 1px solid var(--line-soft); }
.table th { background: var(--bg-2); font-weight: 600; cursor: pointer; user-select: none; letter-spacing: 0.03em; font-size: 10px; text-transform: uppercase; }
.table th:hover { background: var(--bg-3); }
.table tr:hover td { background: var(--bg-2); }
.table td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ============ BREADCRUMBS ============ */
.breadcrumbs { display: flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10.5px; padding: 6px 10px; background: var(--bg-2); border-bottom: 1px solid var(--line-soft); }
.breadcrumbs a { color: var(--ink-3); }
.breadcrumbs a:hover { color: var(--ink); }
.breadcrumbs .sep { color: var(--ink-4); }
.breadcrumbs .current { color: var(--ink); font-weight: 500; }

/* ============ TOAST ============ */
.toast-stack { position: absolute; top: 40px; right: 14px; display: flex; flex-direction: column; gap: 8px; z-index: 3000; pointer-events: none; }
.toast {
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(26,24,20,0.15);
  padding: 8px 12px;
  min-width: 260px;
  max-width: 320px;
  font-size: 11px;
  display: flex; gap: 10px;
  pointer-events: auto;
  animation: toastIn 200ms ease-out;
}
@keyframes toastIn { from { transform: translateX(20px); opacity: 0; } }
.toast-icon {
  width: 20px; height: 20px;
  background: var(--accent);
  color: var(--cream);
  display: grid; place-items: center;
  font-family: var(--mono); font-weight: 700; font-size: 11px;
  flex-shrink: 0;
}
.toast-title { font-weight: 600; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.02em; }
.toast-body { color: var(--ink-2); font-size: 11px; margin-top: 2px; }

/* ============ TOOLTIP ============ */
.tooltip {
  position: absolute;
  background: var(--ink);
  color: var(--bg);
  padding: 3px 7px;
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.02em;
  pointer-events: none;
  white-space: nowrap;
  z-index: 4000;
}

/* ============ CONTEXT MENU ============ */
.ctx-menu {
  position: fixed;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(26,24,20,0.2);
  min-width: 180px;
  padding: 3px 0;
  font-family: var(--mono); font-size: 11px;
  z-index: 5000;
}
.ctx-item {
  padding: 4px 12px;
  display: flex; justify-content: space-between; gap: 20px;
  cursor: pointer;
}
.ctx-item:hover { background: var(--ink); color: var(--bg); }
.ctx-item.disabled { color: var(--ink-4); cursor: default; }
.ctx-item.disabled:hover { background: transparent; color: var(--ink-4); }
.ctx-sep { height: 1px; background: var(--line-soft); margin: 3px 0; }

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(26,24,20,0.3);
  backdrop-filter: blur(2px);
  display: grid; place-items: center;
  z-index: 4500;
  animation: fadeIn 150ms;
}
@keyframes fadeIn { from { opacity: 0; } }
.modal {
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 6px 6px 0 rgba(26,24,20,0.2);
  min-width: 420px;
  max-width: 520px;
  font-size: 12px;
}

/* ============ COMMAND PALETTE ============ */
.cmdk-overlay {
  position: fixed; inset: 0;
  background: rgba(26,24,20,0.15);
  backdrop-filter: blur(6px);
  display: grid; place-items: start center;
  padding-top: 12vh;
  z-index: 6000;
  animation: fadeIn 120ms;
}
.cmdk {
  width: 560px;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 6px 6px 0 rgba(26,24,20,0.25);
  overflow: hidden;
}
.cmdk-input {
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-bottom: 1px solid var(--ink);
  background: var(--paper);
  font-family: var(--mono); font-size: 14px;
  outline: none;
}
.cmdk-list { max-height: 340px; overflow: auto; padding: 4px 0; }
.cmdk-group { font-family: var(--mono); font-size: 9px; font-weight: 700; letter-spacing: 0.1em; color: var(--ink-4); padding: 6px 16px 2px; text-transform: uppercase; }
.cmdk-item {
  padding: 6px 16px;
  display: flex; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 11.5px;
  cursor: pointer;
}
.cmdk-item.selected { background: var(--ink); color: var(--bg); }
.cmdk-item .cmdk-kbd { margin-left: auto; font-size: 9.5px; color: var(--ink-4); }
.cmdk-item.selected .cmdk-kbd { color: var(--bg-3); }
.cmdk-icon { width: 20px; height: 20px; display: grid; place-items: center; border: 1px solid currentColor; font-size: 10px; font-family: var(--mono); }

/* ============ DROPDOWN ============ */
.dd { position: relative; display: inline-block; }
.dd-menu {
  position: absolute; top: calc(100% + 4px); left: 0;
  min-width: 180px;
  background: var(--paper); border: 1px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(26,24,20,0.15);
  z-index: 100;
  font-family: var(--mono); font-size: 11px;
  padding: 3px 0;
}
.dd-item { padding: 5px 12px; display: flex; justify-content: space-between; gap: 20px; cursor: pointer; }
.dd-item:hover { background: var(--ink); color: var(--bg); }
.dd-sep { height: 1px; background: var(--line-soft); margin: 3px 0; }

/* ============ AVATAR ============ */
.avatar {
  width: 28px; height: 28px;
  border: 1px solid var(--ink);
  background: var(--tan);
  display: grid; place-items: center;
  font-family: var(--serif); font-style: italic; font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
}
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { margin-left: -6px; box-shadow: -1px 0 0 var(--paper); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* ============ RATING ============ */
.rating { display: inline-flex; gap: 2px; font-family: var(--mono); color: var(--ink); }
.rating .star { font-size: 14px; line-height: 1; }
.rating .star.off { color: var(--ink-4); }

/* ============ PROGRESS ============ */
.progress {
  height: 8px; background: var(--bg-3);
  border: 1px solid var(--ink);
  position: relative; overflow: hidden;
}
.progress-fill { height: 100%; background: var(--ink); }
.progress.striped .progress-fill {
  background-image: repeating-linear-gradient(45deg, var(--ink) 0 4px, var(--ink-2) 4px 8px);
}
.progress.accent .progress-fill { background: var(--accent); }

/* ============ CHART BITS ============ */
.sparkline { stroke: var(--ink); fill: none; stroke-width: 1.5; }
.sparkline-fill { fill: var(--accent); opacity: 0.15; }

/* ============ SCREEN READER ============ */
.sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ============ MARQUEE ============ */
.marquee {
  overflow: hidden;
  display: flex;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.05em;
}
.marquee-track { display: flex; gap: 32px; animation: marquee 40s linear infinite; padding-right: 32px; }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ============ WIDGETS GENERIC ============ */
.widget {
  position: absolute;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(26,24,20,0.1);
}
.widget-head {
  padding: 4px 8px;
  border-bottom: 1px solid var(--ink);
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex; justify-content: space-between; align-items: center;
  background: var(--bg-2);
}
.widget-body { padding: 10px; }

/* ============ NUMERIC ============ */
.num-display {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}
.kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--ink);
  background: var(--cream);
  font-family: var(--mono); font-size: 9.5px;
  box-shadow: 1px 1px 0 var(--ink);
  line-height: 1.2;
}

/* ============ SEARCH ============ */
.search-field {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px;
  border: 1px solid var(--ink);
  background: var(--cream);
  font-family: var(--mono); font-size: 11px;
}
.search-field input { background: transparent; border: none; outline: none; flex: 1; font-family: inherit; font-size: inherit; }

/* ============ CHAT ============ */
.chat-msg { padding: 6px 10px; margin: 4px 10px; border: 1px solid var(--line-soft); max-width: 80%; font-size: 11px; line-height: 1.45; }
.chat-msg.me { margin-left: auto; background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chat-msg.them { background: var(--cream); }
.chat-meta { font-family: var(--mono); font-size: 9px; color: var(--ink-4); margin-top: 2px; letter-spacing: 0.04em; }
.chat-msg.me .chat-meta { color: var(--bg-3); }

/* ============ TERMINAL ============ */
.terminal {
  background: #14130f;
  color: #e8d9b8;
  font-family: var(--mono);
  font-size: 11px;
  padding: 10px 12px;
  line-height: 1.55;
  overflow: auto;
  height: 100%;
}
.terminal .prompt { color: #e85d3a; }
.terminal .path { color: #7ea8d4; }
.terminal .branch { color: #a9c48b; }
.terminal .out { color: #c4b89e; }
.terminal .dim { opacity: 0.5; }

/* ============ STEPPER ============ */
.stepper { display: flex; align-items: center; gap: 0; font-family: var(--mono); font-size: 10.5px; }
.stepper-node {
  width: 22px; height: 22px;
  border: 1px solid var(--ink);
  background: var(--cream);
  display: grid; place-items: center;
  font-size: 10px; font-weight: 600;
}
.stepper-node.done { background: var(--ink); color: var(--bg); }
.stepper-node.active { background: var(--accent); color: var(--cream); }
.stepper-bar { flex: 1; height: 1px; background: var(--ink); }
.stepper-bar.done { background: var(--ink); }
.stepper-bar.todo { background: var(--line-soft); }
.stepper-label { font-size: 9.5px; color: var(--ink-3); margin-top: 4px; text-align: center; }

/* ============ DATE ============ */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line-soft); border: 1px solid var(--ink); }
.cal-cell {
  aspect-ratio: 1;
  background: var(--paper);
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 10px;
  cursor: pointer;
  position: relative;
}
.cal-cell:hover { background: var(--bg-2); }
.cal-cell.off { color: var(--ink-4); background: var(--bg-2); }
.cal-cell.today { background: var(--accent); color: var(--cream); font-weight: 600; }
.cal-cell.has-event::after { content: ''; position: absolute; bottom: 3px; left: 50%; transform: translateX(-50%); width: 3px; height: 3px; border-radius: 50%; background: var(--accent); }
.cal-cell.today.has-event::after { background: var(--cream); }
.cal-head { font-family: var(--mono); font-size: 9px; text-transform: uppercase; text-align: center; color: var(--ink-3); padding: 4px 0; background: var(--bg-2); }

/* ============ KANBAN ============ */
.kanban { display: flex; gap: 8px; padding: 10px; height: 100%; }
.kanban-col { flex: 1; display: flex; flex-direction: column; background: var(--bg-2); border: 1px solid var(--ink); min-width: 0; }
.kanban-col-head { padding: 6px 10px; border-bottom: 1px solid var(--ink); font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; display: flex; justify-content: space-between; align-items: center; }
.kanban-cards { padding: 8px; display: flex; flex-direction: column; gap: 6px; overflow: auto; }
.kanban-card {
  background: var(--paper); border: 1px solid var(--ink);
  padding: 8px 10px; font-size: 11px;
  cursor: grab;
  display: flex; flex-direction: column; gap: 6px;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.dragging { opacity: 0.4; }
.kanban-card-title { font-weight: 500; font-size: 11.5px; }
.kanban-card-meta { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 9.5px; color: var(--ink-3); }

/* ============ FILE TREE ============ */
.tree { font-family: var(--mono); font-size: 11px; padding: 6px 0; }
.tree-item {
  padding: 2px 10px 2px 22px;
  position: relative;
  cursor: pointer;
  white-space: nowrap;
}
.tree-item:hover { background: var(--bg-2); }
.tree-item.selected { background: var(--ink); color: var(--bg); }
.tree-item .tree-chev { position: absolute; left: 6px; font-size: 9px; color: var(--ink-3); top: 3px; }
.tree-item .tree-icon { display: inline-block; width: 14px; text-align: center; font-size: 11px; margin-right: 4px; }
.tree-children { padding-left: 14px; }

/* ============ MAP ============ */
.map-placeholder {
  background:
    radial-gradient(circle at 30% 40%, rgba(232,93,58,0.2), transparent 40%),
    linear-gradient(to bottom, #e5d9b8, #c4b08a);
  height: 100%; width: 100%;
  position: relative;
  border-bottom: 1px solid var(--ink);
  overflow: hidden;
}

/* ============ PHOTO PLACEHOLDER ============ */
.photo-ph {
  background:
    repeating-linear-gradient(45deg, var(--bg-3) 0 8px, var(--bg-2) 8px 16px);
  border: 1px solid var(--ink);
  display: grid; place-items: center;
  font-family: var(--mono); font-size: 9.5px;
  color: var(--ink-3);
  text-align: center; padding: 8px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  aspect-ratio: 4/3;
}

/* ============ RICH ============ */
.richtext { font-size: 13px; line-height: 1.6; color: var(--ink-2); padding: 14px 18px; font-family: var(--sans); }
.richtext h1 { font-family: var(--serif); font-size: 38px; line-height: 1; font-weight: 400; color: var(--ink); margin-bottom: 6px; letter-spacing: -0.02em; }
.richtext h1 em { color: var(--accent); }
.richtext .lede { font-family: var(--serif); font-size: 18px; line-height: 1.35; color: var(--ink); margin: 10px 0 18px; font-style: italic; }
.richtext h2 { font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink-3); margin: 20px 0 10px; font-weight: 600; border-bottom: 1px solid var(--line-soft); padding-bottom: 4px; }
.richtext p { margin-bottom: 10px; }
.richtext p + p { text-indent: 1.2em; }
.richtext a.inline { border-bottom: 1px solid var(--accent); color: var(--ink); padding-bottom: 1px; }
.richtext a.inline:hover { background: var(--accent); color: var(--cream); }
.richtext ul { padding-left: 18px; margin: 8px 0; }
.richtext li { margin-bottom: 4px; }
.richtext blockquote { border-left: 3px solid var(--accent); padding: 2px 0 2px 14px; margin: 12px 0; font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--ink); }

/* ============ MIX ============ */
.divider { border-top: 1px solid var(--line-soft); margin: 10px 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.row { display: flex; align-items: center; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.tiny { font-family: var(--mono); font-size: 9.5px; color: var(--ink-3); letter-spacing: 0.04em; text-transform: uppercase; }
.mono { font-family: var(--mono); }
.serif { font-family: var(--serif); }

/* ============ STATUS LIGHTS ============ */
.status-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.status-dot.ok { background: var(--accent-3); box-shadow: 0 0 0 2px rgba(74,124,58,0.15); }
.status-dot.warn { background: #d4a03a; box-shadow: 0 0 0 2px rgba(212,160,58,0.15); }
.status-dot.down { background: var(--accent); box-shadow: 0 0 0 2px rgba(232,93,58,0.15); }
.status-dot.blink { animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: 0.3; } }

/* ============ TAG INPUT ============ */
.tag-input {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 4px;
  border: 1px solid var(--ink);
  background: var(--cream);
  min-height: 28px;
}
.tag-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 4px 2px 7px;
  background: var(--ink); color: var(--bg);
  font-family: var(--mono); font-size: 10px;
}
.tag-chip button { color: var(--bg); padding: 0 2px; }
.tag-input input { flex: 1; min-width: 60px; border: none; background: transparent; outline: none; font-family: var(--mono); font-size: 11px; padding: 2px; }

/* ============ CAROUSEL ============ */
.carousel { position: relative; overflow: hidden; border: 1px solid var(--ink); }
.carousel-track { display: flex; transition: transform 300ms ease; }
.carousel-slide { flex-shrink: 0; width: 100%; }
.carousel-dots { display: flex; justify-content: center; gap: 4px; padding: 6px 0; background: var(--bg-2); border-top: 1px solid var(--line-soft); }
.carousel-dot { width: 6px; height: 6px; border: 1px solid var(--ink); cursor: pointer; }
.carousel-dot.active { background: var(--ink); }

/* ============ PANEL (for resizable) ============ */
.panel-split { display: flex; height: 100%; }
.panel-resizer { width: 4px; background: var(--line-soft); cursor: col-resize; flex-shrink: 0; }
.panel-resizer:hover { background: var(--accent); }

/* ============ TWEAKS PANEL ============ */
.tweaks {
  position: fixed;
  bottom: 72px;
  right: 14px;
  width: 240px;
  background: var(--paper);
  border: 1px solid var(--ink);
  box-shadow: 4px 4px 0 rgba(26,24,20,0.2);
  z-index: 950;
  font-family: var(--mono); font-size: 11px;
}
.tweaks-head {
  padding: 5px 10px;
  background: var(--ink); color: var(--bg);
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  display: flex; justify-content: space-between; align-items: center;
}
.tweaks-section { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
.tweaks-label { font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 5px; }
.swatch-row { display: flex; gap: 4px; }
.swatch {
  width: 22px; height: 22px;
  border: 1px solid var(--ink);
  cursor: pointer;
}
.swatch.selected { box-shadow: inset 0 0 0 2px var(--cream); }

/* ============ DIALPAD ============ */
.dialpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.dialpad button {
  aspect-ratio: 1.4;
  border: 1px solid var(--ink);
  background: var(--cream);
  font-family: var(--mono); font-size: 14px; font-weight: 500;
}
.dialpad button:hover { background: var(--ink); color: var(--bg); }
.dialpad button:active { background: var(--accent); }

/* ============ GUESTBOOK ENTRY ============ */
.guest-entry {
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  margin: 6px 10px;
  background: var(--cream);
  font-size: 11.5px;
  line-height: 1.5;
  position: relative;
}
.guest-name { font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: 0.04em; }
.guest-date { font-family: var(--mono); font-size: 9.5px; color: var(--ink-4); float: right; }

/* ============ DRAG INDICATOR ============ */
.drag-handle {
  width: 10px;
  display: flex; flex-direction: column; justify-content: center; gap: 1px;
  cursor: grab;
  opacity: 0.3;
}
.drag-handle::before, .drag-handle::after {
  content: '⋮⋮'; font-size: 10px; letter-spacing: -2px; line-height: 0.5;
}

.focus-ring:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Dark mode */
body.dark {
  --bg: #1a1814;
  --bg-2: #242019;
  --bg-3: #2e2920;
  --ink: #f4efe6;
  --ink-2: #d9d2c2;
  --ink-3: #a19883;
  --ink-4: #6b6254;
  --line: #f4efe6;
  --line-soft: #3a352c;
  --paper: #1f1c17;
  --cream: #2a2620;
  --tan: #8a7a5c;
}

/* ============ MOBILE ============ */
/* Phones (portrait, and landscape phones) get a single-app, full-screen shell.
   The desktop window-manager metaphor is mouse-only and overflows a phone, so
   here windows fill the screen one at a time (z-index already tracks focus) and
   the dock becomes a scrollable app bar — every app stays reachable. */
@media (max-width: 760px), (orientation: landscape) and (max-height: 460px) {
  /* Decorative desktop furniture — hide on phones */
  .widget,
  .ticker-wrap { display: none !important; }

  /* Menubar → slim status bar: logo + clock only (all apps live in the dock) */
  .menubar-item { display: none; }
  .menubar-right .pill { display: none; }

  /* Windows fill the screen, one at a time. !important overrides the inline
     left/top/width/height React sets per window; z-index stays inline so the
     focused window remains on top. */
  .window {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    top: 28px !important;
    bottom: calc(56px + env(safe-area-inset-bottom)) !important;
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    border-left: none;
    border-right: none;
    box-shadow: none;
  }
  .window-meta,
  .window-resize { display: none; }
  .window-titlebar::before { inset: 4px 16px 4px 60px; }

  /* Dock → full-width, horizontally scrollable app bar pinned to the bottom */
  .dock {
    left: 0; right: 0; bottom: 0;
    transform: none;
    border-radius: 0;
    border-left: none; border-right: none; border-bottom: none;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    max-width: 100vw;
  }
  .dock-item { width: 40px; height: 40px; flex: 0 0 auto; }
  .dock-item:hover { transform: none; }
  .dock-label { display: none; }

  /* Window content laid out for desktop widths — collapse to one column */
  .grid-2, .grid-3 { grid-template-columns: 1fr !important; }
  .kanban { flex-direction: column; height: auto; }
  .kanban-col { min-height: 140px; }

  /* Overlays sized for the small viewport */
  .cmdk { width: 92vw; max-width: 92vw; }
  .cmdk-overlay { padding-top: 8vh; }
  .toast-stack { left: 8px; right: 8px; top: 34px; }
  .toast { min-width: 0; max-width: none; width: 100%; }
}
