/* Variant Production OS — design tokens and primitives (Linear-inspired, dark-first) */

:root {
  --bg: #0e0f11;
  --panel: #16171a;
  --panel-2: #1c1d21;
  --panel-3: #232428;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #e8e9eb;
  --text-dim: #9b9da3;
  --text-faint: #5e6066;
  --accent: #6e79f4;
  --accent-dim: rgba(110, 121, 244, 0.16);
  --ok: #3fb87f;
  --ok-dim: rgba(63, 184, 127, 0.14);
  --warn: #e0a83e;
  --warn-dim: rgba(224, 168, 62, 0.14);
  --bad: #e5564f;
  --bad-dim: rgba(229, 86, 79, 0.14);
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --font: "Inter", "Segoe UI", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  --speed: 140ms;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-dim); }

h1, h2, h3 { font-weight: 600; margin: 0; }
h1 { font-size: 16px; }
h2 { font-size: 14px; }

.mono { font-family: var(--mono); font-size: 12px; }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.small { font-size: 12px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 7px 14px;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease), transform var(--speed) var(--ease);
  user-select: none;
  white-space: nowrap;
}
.btn:hover { background: var(--panel-3); border-color: rgba(255, 255, 255, 0.22); }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.45; cursor: default; pointer-events: none; }

.btn-primary { background: var(--accent); border-color: transparent; color: #fff; }
.btn-primary:hover { background: #7d87f6; }

.btn-ok { border-color: rgba(63, 184, 127, 0.5); color: var(--ok); }
.btn-ok:hover { background: var(--ok-dim); }
.btn-bad { border-color: rgba(229, 86, 79, 0.5); color: var(--bad); }
.btn-bad:hover { background: var(--bad-dim); }

.kbd {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-faint);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 2px;
}
.btn-primary .kbd { color: rgba(255, 255, 255, 0.7); background: rgba(0, 0, 0, 0.2); border-color: transparent; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--panel-2);
  color: var(--text-dim);
  border: 1px solid var(--border);
  transition: background var(--speed) var(--ease), color var(--speed) var(--ease);
}
.chip.done { background: var(--ok-dim); color: var(--ok); border-color: transparent; }
.chip.active { background: var(--accent-dim); color: var(--accent); border-color: transparent; font-weight: 500; }
.chip.clickable { cursor: pointer; }
.chip.clickable:hover { border-color: var(--border-strong); color: var(--text); }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.todo { background: var(--text-faint); }
.dot.claimed { background: var(--warn); }
.dot.submitted { background: var(--accent); }
.dot.approved { background: var(--ok); }

.swatch { width: 12px; height: 12px; border-radius: 3px; display: inline-block; flex: none; border: 1px solid rgba(255, 255, 255, 0.18); }

.progress-track { height: 4px; background: var(--panel-3); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); border-radius: 2px; transition: width 300ms var(--ease); }

.img-frame {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.img-frame img { width: 100%; height: 100%; object-fit: contain; display: block; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--panel-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--speed) var(--ease), transform var(--speed) var(--ease);
  z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@keyframes card-in {
  from { opacity: 0; transform: translateX(28px); }
  to { opacity: 1; transform: translateX(0); }
}
@keyframes card-out {
  from { opacity: 1; transform: translateX(0); }
  to { opacity: 0; transform: translateX(-28px); }
}
.card-enter { animation: card-in 180ms var(--ease); }
.card-exit { animation: card-out 140ms var(--ease) forwards; }

@keyframes pulse-border {
  0%, 100% { border-color: rgba(110, 121, 244, 0.5); }
  50% { border-color: rgba(110, 121, 244, 0.15); }
}
.watching { animation: pulse-border 2.4s ease-in-out infinite; }

.appbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  min-height: 52px;
}
.appbar .brand {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.appbar .brand .logo {
  width: 18px; height: 18px; border-radius: 5px;
  background: var(--accent);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff;
}
.appbar nav { display: flex; gap: 2px; }
.appbar nav a {
  color: var(--text-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  transition: color var(--speed) var(--ease), background var(--speed) var(--ease);
}
.appbar nav a:hover { color: var(--text); background: var(--panel-2); }
.appbar nav a.active { color: var(--text); background: var(--panel-3); }
.appbar .side { display: flex; align-items: center; gap: 12px; min-width: 0; }

.account-menu {
  position: relative;
  flex: none;
}
.account-menu-trigger {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid rgba(148, 157, 255, 0.24);
  background: rgba(18, 22, 31, 0.88);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 8px 20px rgba(0, 0, 0, 0.22);
  transition: background var(--speed) var(--ease), border-color var(--speed) var(--ease), box-shadow var(--speed) var(--ease), transform var(--speed) var(--ease);
}
.account-menu-trigger:hover,
.account-menu-trigger[aria-expanded="true"] {
  background: rgba(24, 29, 42, 0.95);
  border-color: rgba(166, 174, 255, 0.46);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.07), 0 10px 24px rgba(0, 0, 0, 0.28);
}
.account-menu-trigger:focus-visible {
  outline: 2px solid rgba(141, 149, 255, 0.78);
  outline-offset: 2px;
}
.account-menu-trigger:active { transform: scale(0.96); }
.account-menu-avatar {
  width: 34px;
  height: 34px;
  display: block;
  overflow: visible;
}
.account-menu-avatar-frame {
  fill: rgba(12, 15, 22, 0.96);
  stroke: rgba(255, 255, 255, 0.18);
  stroke-width: 1;
}
.account-menu-avatar-shine {
  fill: rgba(255, 255, 255, 0.18);
}
.account-menu-avatar-text {
  fill: #fff;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0;
  pointer-events: none;
}
.account-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 80;
  width: 220px;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.42);
}
.account-menu-panel[hidden] { display: none; }
.account-menu-head {
  padding: 8px 9px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 5px;
}
.account-menu-name {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.account-menu-email {
  color: var(--text-dim);
  font-size: 11.5px;
  margin-top: 2px;
  overflow-wrap: anywhere;
}
.account-menu-item {
  width: 100%;
  min-height: 32px;
  display: flex;
  align-items: center;
  padding: 7px 9px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  text-decoration: none;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
}
.account-menu-item:hover {
  background: var(--panel-2);
}
.account-menu-item.danger {
  color: var(--bad);
}
.account-menu-item.danger:hover {
  background: var(--bad-dim);
}

.metric {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}
.metric .label { font-size: 12px; color: var(--text-dim); margin: 0 0 4px; }
.metric .value { font-size: 24px; font-weight: 600; line-height: 1.2; }

.search {
  background: var(--panel-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 7px 12px;
  outline: none;
  transition: border-color var(--speed) var(--ease);
  width: 240px;
}
.search:focus { border-color: var(--accent); }
.search::placeholder { color: var(--text-faint); }

.heat-cell {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  background: var(--panel-3);
  position: relative;
  flex: none;
}
.heat-cell.blocked { background: var(--panel-2); }
.heat-cell.todo { background: #2e3038; }
.heat-cell.partial { background: rgba(63, 184, 127, 0.35); }
.heat-cell.submitted { background: rgba(110, 121, 244, 0.55); }
.heat-cell.done { background: var(--ok); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
}
.badge.idle { background: var(--panel-3); color: var(--text-dim); }
.badge.live { background: var(--accent-dim); color: var(--accent); }
.badge.done { background: var(--ok-dim); color: var(--ok); }
.badge.review { background: var(--warn-dim); color: var(--warn); }

@media (max-width: 720px) {
  html, body { font-size: 13px; }
  h1 { font-size: 15px; }

  .appbar {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    padding: 10px 12px;
    position: sticky;
  }
  .appbar .side {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }
  .appbar .side:first-child {
    align-items: flex-start;
    flex-direction: column;
  }
  .appbar nav {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .appbar nav::-webkit-scrollbar { display: none; }
  .appbar nav a {
    flex: 0 0 auto;
    padding: 7px 10px;
  }
  .appbar .progress-track { width: 100% !important; }

  .metric { padding: 12px; }
  .metric .value { font-size: 20px; }
  .search { width: 100%; }
  .btn {
    min-height: 36px;
    padding: 8px 12px;
  }
  .toast {
    left: 12px;
    right: 12px;
    bottom: 14px;
    transform: translateY(8px);
    text-align: center;
  }
  .toast.show { transform: translateY(0); }
}
