/* O Office — Aura OS tokens (otlub-dock aligned). No purple AI-slop glass. */
:root {
  --surface: #131313;
  --surface-dim: #131313;
  --surface-container-lowest: #0e0e0e;
  --surface-container-low: #1c1b1b;
  --surface-container: #201f1f;
  --surface-container-high: #2a2a2a;
  --surface-container-highest: #353534;
  --on-surface: #e5e2e1;
  --on-surface-variant: #c1c6d7;
  --outline: #8b90a0;
  --outline-variant: #414755;
  --primary: #adc6ff;
  --on-primary: #002e69;
  --primary-container: #4b8eff;
  --tertiary: #ffb595;
  --tertiary-container: #ef6719;
  --background: #131313;
  --chrome-h: 52px;
  --status-h: 26px;
  --sidebar-w: 272px;
  --radius-md: 0.75rem;
  --radius-sm: 0.5rem;
  --font-display: "Hanken Grotesk", system-ui, sans-serif;
  --font-body: Inter, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  /* Editor desk / paper (light canvas inside dark shell) */
  --desk: #d8dce3;
  --desk-edge: #c5cad3;
  --paper: #ffffff;
  --paper-shadow: 0 1px 2px rgba(19, 19, 19, 0.06), 0 8px 28px rgba(19, 19, 19, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--background);
  color: var(--on-surface);
  font-family: var(--font-body);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

.mesh-bg {
  background-color: var(--surface-container-lowest);
  background-image:
    radial-gradient(ellipse 80% 50% at 18% 8%, rgba(75, 142, 255, 0.14), transparent 55%),
    radial-gradient(ellipse 50% 55% at 88% 90%, rgba(239, 103, 25, 0.07), transparent 45%);
}

.font-display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.font-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Top chrome ─────────────────────────────────────────── */

.oo-chrome {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 40;
  height: var(--chrome-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 12px 0 14px;
  background: rgba(20, 20, 20, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.oo-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 1;
}

.oo-icon {
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
}

.oo-wordmark {
  display: flex;
  align-items: baseline;
  gap: 6px;
  white-space: nowrap;
}

.oo-name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
}

.oo-sep {
  opacity: 0.35;
}

.oo-suite {
  color: var(--on-surface-variant);
  font-size: 0.82rem;
}

.oo-pill {
  margin-left: 6px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(75, 142, 255, 0.12);
  color: var(--primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.oo-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.oo-tool-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.oo-tool-sep {
  width: 1px;
  height: 22px;
  margin: 0 6px;
  background: rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}

/* Icon-first toolbar buttons */
.oo-icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--on-surface-variant);
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.oo-icon-btn .material-symbols-outlined {
  font-size: 22px;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
}

.oo-icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--on-surface);
}

.oo-icon-btn:focus-visible {
  outline: 2px solid var(--primary-container);
  outline-offset: 1px;
}

.oo-icon-btn.active,
.oo-icon-btn[aria-pressed="true"] {
  background: rgba(75, 142, 255, 0.2);
  border-color: rgba(173, 198, 255, 0.35);
  color: var(--primary);
}

.oo-icon-btn.active .material-symbols-outlined,
.oo-icon-btn[aria-pressed="true"] .material-symbols-outlined {
  font-variation-settings: "FILL" 1, "wght" 500, "GRAD" 0, "opsz" 24;
}

.oo-icon-btn.accent {
  color: var(--primary);
}

.oo-icon-btn.accent:hover {
  background: rgba(75, 142, 255, 0.18);
}

.oo-icon-btn.muted {
  opacity: 0.75;
}

/* Compact text CTA (compose / rare actions) */
.oo-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(75, 142, 255, 0.14);
  color: var(--on-surface);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  height: 36px;
  cursor: pointer;
  text-decoration: none;
  font-family: var(--font-body);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.oo-btn .material-symbols-outlined {
  font-size: 18px;
}

.oo-btn:hover {
  background: rgba(75, 142, 255, 0.24);
}

.oo-btn.ghost {
  background: transparent;
  color: var(--on-surface-variant);
}

.oo-btn.ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--on-surface);
}

/* ── Status strip ───────────────────────────────────────── */

.oo-status {
  position: fixed;
  top: var(--chrome-h);
  left: 0;
  right: 0;
  z-index: 30;
  height: var(--status-h);
  display: flex;
  align-items: center;
  padding: 0 14px;
  background: rgba(14, 14, 14, 0.94);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--on-surface-variant);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.oo-status.is-warn {
  color: var(--tertiary);
}

.oo-status.is-ok {
  color: #9ad4a8;
}

/* ── Body: sidebar + stage ──────────────────────────────── */

.oo-body {
  position: fixed;
  top: calc(var(--chrome-h) + var(--status-h));
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  min-height: 0;
}

/* DMS browser */
.oo-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface-container-low);
  border-right: 1px solid rgba(255, 255, 255, 0.07);
}

.oo-sidebar[hidden],
.oo-body.sidebar-collapsed .oo-sidebar {
  display: none;
}

.oo-body.sidebar-collapsed {
  --sidebar-w: 0px;
}

.oo-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.oo-side-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: -0.02em;
}

.oo-side-meta {
  padding: 0 12px 8px;
  color: var(--on-surface-variant);
  font-size: 11px;
  line-height: 1.35;
}

.oo-side-path {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--primary);
  word-break: break-all;
}

.oo-folder-tree {
  list-style: none;
  margin: 0;
  padding: 4px 8px 8px;
  overflow: auto;
  max-height: 42%;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.oo-folder-item {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 6px 8px;
  margin: 1px 0;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--on-surface-variant);
  font-family: var(--font-body);
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.oo-folder-item .material-symbols-outlined {
  font-size: 18px;
  flex-shrink: 0;
  opacity: 0.9;
}

.oo-folder-item:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--on-surface);
}

.oo-folder-item.active {
  background: rgba(75, 142, 255, 0.16);
  color: var(--primary);
}

.oo-folder-item .oo-folder-count {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10px;
  opacity: 0.65;
}

.oo-file-list-head {
  padding: 8px 12px 4px;
  color: var(--on-surface-variant);
}

.oo-file-list {
  list-style: none;
  margin: 0;
  padding: 4px 8px 12px;
  overflow: auto;
  flex: 1;
  min-height: 0;
}

.oo-file-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 8px;
  margin: 2px 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--on-surface);
  font-family: var(--font-body);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
}

.oo-file-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.06);
}

.oo-file-item.active {
  background: rgba(75, 142, 255, 0.14);
  border-color: rgba(173, 198, 255, 0.28);
}

.oo-file-item .material-symbols-outlined {
  font-size: 20px;
  color: var(--primary);
  margin-top: 1px;
}

.oo-file-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.oo-file-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.oo-file-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--on-surface-variant);
  letter-spacing: 0.02em;
}

.oo-side-empty,
.oo-side-stub {
  margin: 8px 12px;
  padding: 10px;
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  color: var(--on-surface-variant);
  font-size: 12px;
  line-height: 1.4;
}

.oo-side-stub {
  border-style: solid;
  border-color: rgba(239, 103, 25, 0.28);
  background: rgba(239, 103, 25, 0.06);
  color: var(--tertiary);
  font-size: 11px;
}

/* ── Editor stage (desk + paper) ────────────────────────── */

.oo-stage {
  position: relative;
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, #e4e7ec 0%, var(--desk) 48%, #cfd4dc 100%);
  border-left: 1px solid rgba(0, 0, 0, 0.04);
}

.oo-stage-inner {
  flex: 1;
  min-height: 0;
  display: flex;
  padding: 14px 18px 18px;
}

/* Document: centered paper frame */
.oo-stage[data-mode="doc"] .oo-paper {
  width: min(100%, 920px);
  margin: 0 auto;
  height: 100%;
  background: var(--paper);
  border-radius: 2px;
  box-shadow: var(--paper-shadow);
  border: 1px solid rgba(19, 19, 19, 0.06);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Spreadsheet: wide framed canvas */
.oo-stage[data-mode="sheet"] .oo-paper {
  width: 100%;
  height: 100%;
  background: var(--paper);
  border-radius: 4px;
  box-shadow: var(--paper-shadow);
  border: 1px solid rgba(19, 19, 19, 0.08);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.oo-paper-bar {
  flex-shrink: 0;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  background: linear-gradient(180deg, #f7f8fa 0%, #eef0f4 100%);
  border-bottom: 1px solid rgba(19, 19, 19, 0.08);
  color: #5c6370;
  font-size: 11px;
  font-weight: 600;
}

.oo-paper-bar .material-symbols-outlined {
  font-size: 16px;
  color: #4b8eff;
}

.oo-paper-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.oo-paper-hint {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.55;
}

.univer-host {
  flex: 1;
  min-height: 0;
  width: 100%;
  background: #fff;
}

/* Univer sometimes paints full-bleed chrome; keep our margins via paper */
.univer-host > * {
  min-height: 100%;
}

.oo-fallback {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 32px;
  text-align: center;
  background: var(--surface-container-low);
  color: var(--on-surface);
}

.oo-fallback[hidden] {
  display: none !important;
}

.oo-fallback h1 {
  margin: 0;
  font-size: 1.5rem;
}

.oo-fallback p {
  margin: 0;
  max-width: 36rem;
  color: var(--on-surface-variant);
}

/* ── Compose panel ──────────────────────────────────────── */

.oo-compose {
  position: fixed;
  top: calc(var(--chrome-h) + var(--status-h) + 12px);
  right: 16px;
  z-index: 50;
  width: min(360px, calc(100vw - 32px));
  padding: 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(28, 27, 27, 0.97);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.oo-compose[hidden] {
  display: none !important;
}

.oo-compose-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.oo-compose-hint {
  margin: 0;
  font-size: 12px;
  color: var(--on-surface-variant);
  line-height: 1.4;
}

.oo-compose-prompt {
  width: 100%;
  resize: vertical;
  min-height: 100px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(14, 14, 14, 0.9);
  color: var(--on-surface);
  padding: 10px;
  font-family: var(--font-body);
  font-size: 13px;
}

.oo-compose-actions {
  display: flex;
  justify-content: flex-end;
}

@media (max-width: 900px) {
  :root {
    --sidebar-w: 240px;
  }

  .oo-pill {
    display: none;
  }

  .oo-suite {
    display: none;
  }

  .oo-stage-inner {
    padding: 10px;
  }
}

@media (max-width: 720px) {
  .oo-sidebar {
    position: absolute;
    z-index: 25;
    top: 0;
    left: 0;
    bottom: 0;
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.35);
  }

  .oo-body.sidebar-collapsed .oo-sidebar {
    display: none;
  }
}

/* ── Templates ▾ menu ───────────────────────────────────── */

.oo-menu {
  position: relative;
}

.oo-menu .oo-caret {
  font-size: 16px;
  opacity: 0.7;
}

.oo-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 50;
  min-width: 240px;
  padding: 6px;
  background: var(--surface-container-high);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.oo-menu-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--on-surface);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.oo-menu-item .material-symbols-outlined {
  font-size: 18px;
  color: var(--primary);
}

.oo-menu-item:hover {
  background: rgba(75, 142, 255, 0.14);
}

.oo-menu-hint {
  flex-basis: 100%;
  padding-left: 26px;
  font-size: 11px;
  font-weight: 400;
  color: var(--on-surface-variant);
}

/* ── Side tabs + template drawer ────────────────────────── */

.oo-side-tabs {
  display: flex;
  gap: 4px;
  padding: 6px 8px 4px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.oo-side-tab {
  flex: 1;
  border: 0;
  border-radius: var(--radius-sm);
  padding: 6px 4px;
  background: transparent;
  color: var(--on-surface-variant);
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.oo-side-tab.active,
.oo-side-tab[aria-selected="true"] {
  background: rgba(75, 142, 255, 0.16);
  color: var(--primary);
}

.oo-drawer {
  position: fixed;
  top: calc(var(--chrome-h) + var(--status-h));
  right: 0;
  bottom: 0;
  z-index: 35;
  width: min(420px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--surface-container);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.4);
}

.oo-drawer[hidden] {
  display: none;
}

.oo-drawer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.oo-drawer-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--on-surface-variant);
}

.oo-drawer-meta {
  padding: 6px 14px;
  color: var(--outline);
}

.oo-drawer-body {
  flex: 1;
  overflow: auto;
  padding: 8px 12px 24px;
}

.oo-drawer-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--on-surface-variant);
  line-height: 1.4;
}

.oo-tpl-pack {
  margin-bottom: 8px;
}

.oo-tpl-pack-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  background: var(--surface-container-high);
  color: var(--on-surface);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}

.oo-tpl-pack-head:hover {
  border-color: rgba(173, 198, 255, 0.35);
}

.oo-tpl-list {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.oo-tpl-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 4px;
  border: 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  color: var(--on-surface);
  font-family: var(--font-body);
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.oo-tpl-item:hover {
  background: rgba(75, 142, 255, 0.12);
}

.oo-tpl-item code {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--outline);
}

.oo-tpl-item em {
  font-style: normal;
  color: var(--tertiary);
  font-size: 10px;
}

.oo-proc-card {
  margin-bottom: 14px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  background: var(--surface-container-low);
}

.oo-proc-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.oo-proc-agency {
  color: var(--primary);
}

.oo-proc-id {
  color: var(--outline);
}
