/* "Studio" shell — shared design tokens + chrome for every v2-styled page.
   Ported from the client's Next.js operations-v2 prototype (globals.css +
   studio-shell.tsx). Any future v2 page extends templates/base-v2.html and
   gets these tokens/shell for free; add page-specific CSS in its own file. */

:root {
  --st-canvas: #e6e6e4;
  --st-card: #efefed;
  --st-raised: #f9f9f8;
  --st-ink: #0b0b0b;
  --st-ink-2: #4f4e4a;
  --st-ink-3: #6b6a65;
  --st-line: rgba(11, 11, 11, 0.12);
  --st-accent: #e05a17;
  --st-accent-wash: rgba(224, 90, 23, 0.16);
  --st-ghost: #dcdcd9;
  --st-roof: #3b3b39;
  --st-pill: #0b0b0b;
  --st-on-pill: #ffffff;
  --font-studio: "Urbanist", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --st-canvas: #111110;
    --st-card: #1c1c1b;
    --st-raised: #262625;
    --st-ink: #f5f5f3;
    --st-ink-2: #c3c2b7;
    --st-ink-3: #9d9c95;
    --st-line: rgba(255, 255, 255, 0.12);
    --st-accent: #d95926;
    --st-accent-wash: rgba(217, 89, 38, 0.22);
    --st-ghost: #2e2e2c;
    --st-roof: #55544f;
    --st-pill: #f5f5f3;
    --st-on-pill: #0b0b0b;
  }
}

:root[data-theme="dark"] {
  --st-canvas: #111110;
  --st-card: #1c1c1b;
  --st-raised: #262625;
  --st-ink: #f5f5f3;
  --st-ink-2: #c3c2b7;
  --st-ink-3: #9d9c95;
  --st-line: rgba(255, 255, 255, 0.12);
  --st-accent: #d95926;
  --st-accent-wash: rgba(217, 89, 38, 0.22);
  --st-ghost: #2e2e2c;
  --st-roof: #55544f;
  --st-pill: #f5f5f3;
  --st-on-pill: #0b0b0b;
}

.studio * {
  transition-duration: inherit;
}
@media (prefers-reduced-motion: reduce) {
  .studio * {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.studio {
  font-family: var(--font-studio);
  background-color: var(--st-canvas);
  color: var(--st-ink);
  min-height: 100vh;
}

.studio-wrap {
  max-width: 1500px;
  margin: 0 auto;
  padding: 20px 20px 48px;
}

/* ── Typography hierarchy: thin big numerals, bold small labels ── */
.st-hero-figure { font-weight: 300; letter-spacing: -0.01em; }
.st-caption { font-size: 13px; color: var(--st-ink-3); }
.st-label { font-size: 12px; color: var(--st-ink-3); }
.st-value { font-size: 15px; color: var(--st-ink); margin-top: 2px; }

/* ── Card radii conventions ── */
.st-card-lg { border-radius: 28px; background-color: var(--st-card); }
.st-card-md { border-radius: 22px; background-color: var(--st-card); }
.st-card-sm { border-radius: 20px; background-color: var(--st-raised); }

/* ── Header / shell chrome ── */
.studio-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 16px 0 20px;
}
.studio-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--st-ink);
}
.studio-logo-tile {
  width: 48px;
  height: 36px;
  border-radius: 8px;
  background-color: var(--st-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.studio-logo-tile svg { width: 20px; height: 20px; color: #fff; }
.studio-logo-tile img { width: 26px; height: 26px; object-fit: contain; }
.studio-logo-word { font-size: 18px; font-weight: 600; }

.studio-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  flex-wrap: wrap;
}
.studio-pill {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--st-ink-2);
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  flex-shrink: 0;
}
.studio-pill:hover { background-color: var(--st-raised); color: var(--st-ink); }
.studio-pill.is-active { background-color: var(--st-pill); color: var(--st-on-pill); }
.studio-pill svg { width: 18px; height: 18px; }
.studio-pill-sm { width: 36px; height: 36px; }
.studio-pill-sm svg { width: 15px; height: 15px; }

.studio-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  position: relative;
  margin-left: auto;
}

.studio-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-left: 6px;
}
.studio-user-avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background-color: var(--st-ink);
  color: var(--st-canvas);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}
.studio-user-meta { display: none; }
.studio-user-name { font-size: 14px; font-weight: 600; }
.studio-user-role { font-size: 12px; color: var(--st-ink-3); }
@media (min-width: 640px) {
  .studio-user-meta { display: block; }
}

/* To-do popover */
.studio-todo-panel {
  position: absolute;
  top: 54px;
  right: 0;
  width: 384px;
  max-height: 70vh;
  overflow-y: auto;
  border-radius: 20px;
  background-color: var(--st-card);
  border: 1px solid var(--st-line);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.35);
  padding: 16px;
  z-index: 40;
  display: none;
}
.studio-todo-panel.is-open { display: block; }
@media (max-width: 640px) {
  .studio-todo-panel { position: fixed; inset: 80px 12px auto 12px; width: auto; }
}

/* Small muted text link, e.g. "← Back" in page headers */
.st-back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--st-ink-3);
  text-decoration: none;
}
.st-back-link:hover { color: var(--st-ink); }

/* ── Buttons ── shared across every v2 page ── */
.st-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.st-btn svg { width: 15px; height: 15px; flex-shrink: 0; }
.st-btn-primary { background-color: var(--st-accent); color: #fff; }
.st-btn-primary:hover { opacity: 0.9; }
.st-btn-ghost { background-color: transparent; color: var(--st-ink); border-color: var(--st-line); }
.st-btn-ghost:hover { background-color: var(--st-raised); }
.st-btn-danger { background-color: #c0392b; color: #fff; }
.st-btn-danger:hover { opacity: 0.9; }
.st-btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 999px; }
.st-btn-icon.st-btn-ghost { color: var(--st-ink-3); }
.st-btn-icon.st-btn-ghost:hover { color: var(--st-ink); }

/* ── Form fields ── */
.st-field { display: flex; flex-direction: column; gap: 6px; }
.st-field label { font-size: 12px; font-weight: 600; color: var(--st-ink-3); }
.st-field input,
.st-field select,
.st-field textarea {
  font-family: inherit;
  font-size: 14px;
  color: var(--st-ink);
  background-color: var(--st-raised);
  border: 1px solid var(--st-line);
  border-radius: 10px;
  padding: 10px 12px;
}
.st-field input:focus,
.st-field select:focus,
.st-field textarea:focus { outline: none; border-color: var(--st-accent); }
.st-field .st-error { font-size: 12px; color: #c0392b; }
.st-form-row { display: grid; grid-template-columns: 1fr; gap: 16px; margin-bottom: 16px; }
@media (min-width: 640px) {
  .st-form-row.cols-2 { grid-template-columns: 1fr 1fr; }
  .st-form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
}
.st-section-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--st-ink-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--st-line);
  padding-bottom: 8px;
  margin: 24px 0 16px;
}
.st-section-title:first-child { margin-top: 0; }

/* ── Table ── */
.st-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.st-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--st-ink-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 10px 14px;
  border-bottom: 1px solid var(--st-line);
}
.st-table td { padding: 12px 14px; border-bottom: 1px solid var(--st-line); color: var(--st-ink); }
.st-table tr:last-child td { border-bottom: none; }
.st-table tr:hover td { background-color: var(--st-raised); }

/* ── Badge / pill tag ── */
.st-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background-color: var(--st-pill);
  color: var(--st-on-pill);
}

/* ── Dialog ── native <dialog>, same idiom as the ⌘K palette ── */
.st-dialog {
  width: min(420px, calc(100vw - 32px));
  margin: auto;
  padding: 24px;
  border: 1px solid var(--st-line);
  border-radius: 20px;
  background-color: var(--st-card);
  color: var(--st-ink);
  font-family: var(--font-studio);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.35);
}
.st-dialog::backdrop { background-color: rgba(0, 0, 0, 0.4); }
.st-dialog-title { font-size: 16px; font-weight: 600; margin: 0 0 8px; }
.st-dialog-body { font-size: 13px; color: var(--st-ink-3); margin: 0 0 20px; line-height: 1.5; }
.st-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }
