:root {
  --obsidian: #0a0a0c;
  --slate: #16161b;
  --alabaster: #faf9f6;
  --porcelain: #ffffff;
  --gold: #d4af37;
  --champagne: #f3e5ab;
  --amber: #7a5307;
  --emerald: #1f7a5c;
  --crimson: #b91c1c;
  --ink: #0a0a0c;
  --muted: #4b5563;
  --border-dark: rgba(212, 175, 55, 0.35);
  --border-light: rgba(10, 10, 12, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--obsidian);
  color: var(--ink);
  font-family: 'Space Grotesk', system-ui, -apple-system, sans-serif;
  overflow-x: hidden;
}

[hidden] {
  display: none !important;
}

/* ==================== Auth Screen ==================== */

.auth-screen {
  min-height: 100vh;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 14px;
  background:
    radial-gradient(circle at 50% 0%, rgba(212, 175, 55, 0.14), transparent 55%),
    var(--obsidian);
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--slate);
  border: 1px solid var(--border-dark);
  border-radius: 24px;
  padding: 28px 22px;
  color: var(--alabaster);
  box-shadow: 0 32px 80px -24px rgba(0, 0, 0, 0.85);
}

.auth-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 18px;
}

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

.brand-glyph {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #f3e5ab, #d4af37);
  color: var(--obsidian);
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-sub {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--champagne);
  font-weight: 600;
}

.lang-pill {
  min-height: 44px;
  min-width: 68px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--border-dark);
  background: rgba(255, 255, 255, 0.04);
  color: var(--champagne);
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.auth-title {
  margin: 0;
  font-family: 'Oswald', sans-serif;
  font-size: 30px;
  letter-spacing: 0.02em;
  line-height: 1.05;
  color: var(--porcelain);
}

.auth-desc {
  margin: 8px 0 22px;
  font-size: 14px;
  line-height: 1.5;
  color: #d1d5db;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--champagne);
}

.field input,
.sidebar-search,
.text-editor,
.fresh-link-input {
  font-size: 16px;
  font-family: 'Space Grotesk', sans-serif;
}

.field input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: var(--obsidian);
  color: var(--porcelain);
  outline: none;
}

.field input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.25);
}

.gold-cta {
  margin-top: 6px;
  width: 100%;
  min-height: 50px;
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid #f3e5ab;
  background: linear-gradient(135deg, #f3e5ab, #d4af37);
  color: var(--obsidian);
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  cursor: pointer;
}

.gold-cta:disabled {
  opacity: 0.6;
  cursor: wait;
}

.setup-welcome {
  background: rgba(212, 175, 55, 0.08);
  border: 1px solid var(--border-dark);
  border-radius: 14px;
  padding: 14px;
}

.setup-pill {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--gold);
}

.setup-name {
  margin: 4px 0 2px;
  font-family: 'Oswald', sans-serif;
  font-size: 22px;
  color: var(--porcelain);
}

.setup-email {
  margin: 0;
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  color: var(--champagne);
}

.form-error {
  margin: 4px 0 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(185, 28, 28, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fecaca;
  font-size: 13px;
  line-height: 1.4;
}

.setup-invalid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-foot {
  margin: 18px 0 0;
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
}

/* ==================== App Shell ==================== */

.app {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100vh;
  background: var(--alabaster);
  overflow: hidden;
}

.topbar {
  min-height: 58px;
  width: 100%;
  background: var(--obsidian);
  border-bottom: 1px solid var(--border-dark);
  padding: 6px 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--porcelain);
  z-index: 30;
}

.topbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.icon-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border-dark);
  background: rgba(255, 255, 255, 0.05);
  color: var(--champagne);
  font-size: 18px;
  cursor: pointer;
}

.topbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.topbar-emblem {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #f3e5ab, #d4af37);
  color: var(--obsidian);
  font-family: 'Oswald', sans-serif;
  font-weight: 700;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.topbar-label {
  font-family: 'Oswald', sans-serif;
  font-size: 16px;
  letter-spacing: 0.08em;
  color: var(--champagne);
  white-space: nowrap;
}

.board-title-btn {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: var(--porcelain);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.online-users {
  display: flex;
  align-items: center;
  gap: 6px;
}

.user-pill {
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--obsidian);
}

.ghost-dark-btn {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.04);
  color: var(--alabaster);
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  cursor: pointer;
  white-space: nowrap;
}

.ghost-dark-btn:hover {
  border-color: var(--gold);
  color: var(--champagne);
}

.gold-outline-btn {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--gold);
  background: rgba(212, 175, 55, 0.14);
  color: var(--champagne);
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  white-space: nowrap;
}

.zoom-pill {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  overflow: hidden;
}

.zoom-btn {
  min-width: 44px;
  min-height: 44px;
  border: 0;
  background: transparent;
  color: var(--champagne);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
}

.zoom-pct {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  padding: 0 4px;
  color: var(--porcelain);
}

/* ==================== Workspace & Sidebar ==================== */

.workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  position: relative;
  width: 100%;
}

.sidebar {
  width: 280px;
  max-width: 85vw;
  background: var(--porcelain);
  border-right: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  z-index: 25;
  flex-shrink: 0;
}

.sidebar.closed {
  display: none;
}

@media (max-width: 768px) {
  .sidebar {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.25);
  }
}

.sidebar-head {
  padding: 14px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-head h2 {
  margin: 0;
  font-family: 'Oswald', sans-serif;
  font-size: 18px;
  letter-spacing: 0.06em;
}

.sidebar-search {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background: var(--alabaster);
  color: var(--ink);
}

.template-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.gold-small-btn {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--amber);
  background: linear-gradient(135deg, #f3e5ab, #d4af37);
  color: var(--obsidian);
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.ghost-light-btn {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background: var(--alabaster);
  color: var(--ink);
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.board-list {
  list-style: none;
  margin: 0;
  padding: 10px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.board-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border-light);
  background: var(--porcelain);
  cursor: pointer;
}

.board-item.active {
  background: #fffbeb;
  border-color: var(--gold);
}

.board-item-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.board-item-meta {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  color: var(--muted);
}

.board-del-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--crimson);
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

/* ==================== Stage, Cursors & Toolbar ==================== */

.stage {
  flex: 1;
  position: relative;
  min-width: 0;
  min-height: 0;
  background: var(--alabaster);
  overflow: hidden;
  touch-action: none;
}

#canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: default;
}

#canvas.panning {
  cursor: grab;
}

#canvas.crosshair {
  cursor: crosshair;
}

.cursors {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.cursor-tag {
  position: absolute;
  transform: translate(4px, 4px);
  padding: 3px 8px;
  border-radius: 999px;
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--obsidian);
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.tip-banner {
  position: absolute;
  bottom: 78px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 24px);
  background: rgba(10, 10, 12, 0.9);
  color: var(--champagne);
  border: 1px solid var(--border-dark);
  border-radius: 14px;
  padding: 6px 8px 6px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  line-height: 1.35;
  z-index: 15;
}

.tip-close {
  min-width: 44px;
  min-height: 44px;
  border-radius: 999px;
  border: 1px solid var(--border-dark);
  background: rgba(212, 175, 55, 0.16);
  color: var(--champagne);
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.toolbar {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100vw - 16px);
  background: var(--obsidian);
  border: 1px solid var(--border-dark);
  border-radius: 18px;
  padding: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
  z-index: 20;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.tool {
  min-width: 44px;
  min-height: 44px;
  padding: 0 11px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  color: #e5e7eb;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.tool.active {
  background: linear-gradient(135deg, #f3e5ab, #d4af37);
  color: var(--obsidian);
}

.tool.danger {
  color: #fca5a5;
  border-color: rgba(185, 28, 28, 0.5);
}

.tool-sep {
  width: 1px;
  height: 26px;
  background: rgba(255, 255, 255, 0.16);
  margin: 0 3px;
  flex-shrink: 0;
}

.swatches {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 4px;
  flex-shrink: 0;
}

.swatch {
  width: 32px;
  height: 32px;
  min-width: 44px;
  min-height: 44px;
  padding: 6px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background-clip: content-box !important;
  cursor: pointer;
}

.swatch.active {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.45);
}

/* ==================== Inline Note Editor ==================== */

.editor-wrap {
  position: absolute;
  z-index: 40;
  width: 320px;
  max-width: calc(100vw - 24px);
  background: var(--porcelain);
  border: 2px solid var(--gold);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
}

.text-editor {
  width: 100%;
  min-height: 110px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background: var(--alabaster);
  color: var(--ink);
  resize: vertical;
  outline: none;
}

.editor-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ==================== Admin Team Modal ==================== */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 12, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 50;
}

.modal-card {
  width: 100%;
  max-width: 540px;
  background: var(--porcelain);
  border: 2px solid var(--gold);
  border-radius: 22px;
  padding: 22px;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.45);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.modal-head h2 {
  margin: 0;
  font-family: 'Oswald', sans-serif;
  font-size: 22px;
}

.icon-dark-btn {
  min-width: 44px;
  min-height: 44px;
  border-radius: 10px;
  border: 1px solid var(--border-light);
  background: var(--alabaster);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.modal-sub {
  margin: 8px 0 16px;
  font-size: 14px;
  color: var(--muted);
}

.team-users-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.team-row {
  border: 1px solid var(--border-light);
  background: var(--alabaster);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.team-user-name {
  font-weight: 700;
  font-size: 15px;
}

.team-user-meta {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  color: var(--muted);
}

.fresh-link-box {
  margin-top: 14px;
  padding: 12px;
  border-radius: 14px;
  background: #fffbeb;
  border: 1px solid var(--gold);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fresh-link-label {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--amber);
}

.fresh-link-input {
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border-light);
  background: var(--porcelain);
}
