/*
 * Criaffy Operational Studio — Design System
 *
 * Tema: Operational Minimal + Studio Polish
 * Paleta: Deep Teal (#145C66) como acento único
 * Regras: light, neutral, professional; zero gradientes decorativos,
 *         zero glow/neon/glassmorphism, zero dark theme autenticado.
 */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;450;500;600;700&display=swap');

/* =========================================================
   TOKENS
   ========================================================= */
:root {
  /* Brand — Deep Teal é ACENTO, nunca fundo predominante */
  --teal-900: #0A3038;
  --teal-800: #0E3F4A;
  --teal-700: #104A52;  /* hover */
  --teal-600: #145C66;  /* primary */
  --teal-500: #1A7080;
  --teal-400: #2A8FA0;
  --teal-200: #9DCDD5;
  --teal-100: #C8E4E8;
  --teal-50:  #E9F1F2;  /* soft accent */

  /* Superfície */
  --bg:           #F7FAFB;
  --surface:      #FFFFFF;
  --surface-2:    #F0F4F5;
  --surface-3:    #E8EEF0;

  /* Bordas */
  --border:       #DDE6E8;
  --border-2:     #C5D4D8;

  /* Texto */
  --text:         #0F2124;
  --text-2:       #3D5A5E;
  --text-muted:   #6B8C90;
  --text-placeholder: #9BB5B8;

  /* Semântica */
  --success:      #16A34A;
  --success-bg:   #DCFCE7;
  --warning:      #D97706;
  --warning-bg:   #FEF3C7;
  --error:        #DC2626;
  --error-bg:     #FEE2E2;
  --info:         #0284C7;
  --info-bg:      #E0F2FE;

  /* Layout */
  --sidebar-w:    220px;
  --topbar-h:     56px;
  --radius:       8px;
  --radius-sm:    5px;
  --radius-lg:    12px;
  --radius-pill:  999px;

  /* Sombras sutis, nunca dramáticas */
  --shadow-sm:    0 1px 3px rgb(15 33 36 / .06), 0 1px 2px rgb(15 33 36 / .04);
  --shadow:       0 2px 8px rgb(15 33 36 / .08), 0 1px 3px rgb(15 33 36 / .05);
  --shadow-lg:    0 8px 24px rgb(15 33 36 / .10), 0 2px 6px rgb(15 33 36 / .06);

  /* Tipografia */
  --font:         'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Motion */
  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out:  cubic-bezier(0.45, 0, 0.55, 1);
  --dur-fast:     120ms;
  --dur-base:     200ms;
  --dur-slow:     320ms;

  color-scheme: light;
}

/* =========================================================
   RESET BASE
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: none; }
img, svg { display: block; }
ul, ol { list-style: none; }

:focus-visible {
  outline: 2px solid var(--teal-600);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* =========================================================
   SHELL LAYOUT — Sidebar + Main
   ========================================================= */
.studio-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr;
  min-height: 100vh;
}

.studio-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}

.studio-sidebar__logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.studio-sidebar__brand {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}

.studio-sidebar__badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--teal-600);
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  border-radius: var(--radius-pill);
  padding: 2px 7px;
  line-height: 1.6;
}

.studio-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.studio-sidebar__section { margin-bottom: 20px; }

.studio-sidebar__section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 10px;
  margin-bottom: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 10px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 450;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
  cursor: pointer;
  width: 100%;
  text-align: left;
  text-decoration: none;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.active {
  background: var(--teal-50);
  color: var(--teal-700);
  font-weight: 600;
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.75;
}

.nav-item.active svg { opacity: 1; }

.studio-sidebar__footer {
  border-top: 1px solid var(--border);
  padding: 12px 8px;
  flex-shrink: 0;
}

.studio-sidebar__user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius);
  cursor: default;
}

.studio-sidebar__user-avatar {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-pill);
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--teal-700);
  flex-shrink: 0;
}

.studio-sidebar__user-info { flex: 1; min-width: 0; }
.studio-sidebar__user-email {
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}
.studio-sidebar__user-role {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: capitalize;
}

.studio-sidebar__logout {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: var(--radius);
  color: var(--text-muted);
  flex-shrink: 0;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.studio-sidebar__logout:hover {
  background: var(--error-bg);
  color: var(--error);
}

/* =========================================================
   MAIN CONTENT
   ========================================================= */
.studio-main {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.studio-topbar {
  display: none;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 12px;
  gap: 12px;
}

.studio-topbar__left,
.studio-topbar__right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.studio-topbar__title {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.studio-topbar__user-email {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-2);
}

@media (max-width: 480px) {
  .studio-topbar__user-email { display: none; }
}

.studio-page {
  flex: 1;
  padding: 28px 32px;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.page-header__title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
  line-height: 1.25;
}

.page-header__subtitle {
  font-size: 13.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.page-header__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.breadcrumb__sep { opacity: 0.4; font-size: 11px; }
.breadcrumb a { color: var(--text-2); }
.breadcrumb a:hover { color: var(--teal-600); }
.breadcrumb__current { color: var(--text); font-weight: 500; }

/* =========================================================
   BUTTONS
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  height: 34px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background var(--dur-fast),
    border-color var(--dur-fast),
    box-shadow var(--dur-fast),
    transform var(--dur-fast) var(--ease-out);
  white-space: nowrap;
  text-decoration: none;
  user-select: none;
  line-height: 1;
}

.btn:active { transform: translateY(1px); }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; }

.btn-primary {
  background: var(--teal-600);
  color: #fff;
  border-color: var(--teal-600);
}
.btn-primary:hover { background: var(--teal-700); border-color: var(--teal-700); box-shadow: var(--shadow-sm); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-2);
  border-color: var(--border-2);
}
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-2); }

.btn-ghost {
  background: transparent;
  color: var(--text-2);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--surface-2); }

.btn-danger {
  background: var(--error-bg);
  color: var(--error);
  border-color: #f9a8a8;
}
.btn-danger:hover { background: #fee2e2; }

.btn-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border-color: #fcd34d;
}
.btn-warning:hover { background: #fde68a; }

.btn-success {
  background: var(--success-bg);
  color: var(--success);
  border-color: #86efac;
}
.btn-success:hover { background: #bbf7d0; }

.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 40px; padding: 0 20px; font-size: 14px; }

.btn:disabled, .btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

.btn.loading {
  position: relative;
  pointer-events: none;
  color: transparent;
}
.btn.loading::after {
  content: '';
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  color: white;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========================================================
   BADGES & STATUS
   ========================================================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
  border: 1px solid transparent;
}

.badge-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; flex-shrink: 0;
}

.status-planned       { background: var(--surface-3);  color: var(--text-muted);  border-color: var(--border); }
.status-available     { background: #FFFBEB;            color: #92400E;            border-color: #FDE68A; }
.status-assigned      { background: #EFF6FF;            color: #1D4ED8;            border-color: #BFDBFE; }
.status-generating    { background: #EDE9FE;            color: #6D28D9;            border-color: #C4B5FD; }
.status-generation_failed  { background: var(--error-bg); color: var(--error);    border-color: #FECACA; }
.status-awaiting_review    { background: #FFFBEB;       color: #92400E;            border-color: #FDE68A; }
.status-changes_requested  { background: #FFF7ED;       color: #C2410C;            border-color: #FED7AA; }
.status-awaiting_approval  { background: #EFF6FF;       color: #1D4ED8;            border-color: #BFDBFE; }
.status-approved      { background: var(--success-bg);  color: var(--success);     border-color: #86EFAC; }
.status-published     { background: var(--teal-50);     color: var(--teal-700);    border-color: var(--teal-100); }
.status-archived      { background: var(--surface-3);   color: var(--text-muted);  border-color: var(--border); }
.status-draft         { background: var(--surface-3);   color: var(--text-muted);  border-color: var(--border); }
.status-pending_activation { background: #FFFBEB;         color: #92400E;            border-color: #FDE68A; }
.status-active        { background: var(--success-bg);  color: var(--success);     border-color: #86EFAC; }
.status-inactive      { background: var(--surface-3);   color: var(--text-muted);  border-color: var(--border); }
.status-suspended     { background: var(--error-bg);    color: var(--error);       border-color: #FECACA; }
.status-invited       { background: #E0F2FE;            color: #075985;            border-color: #BAE6FD; }

.role-superadmin { background: #EDE9FE; color: #5B21B6; border-color: #C4B5FD; }
.role-admin { background: #EDE9FE; color: #5B21B6; border-color: #C4B5FD; }
.role-content_partner { background: var(--teal-50); color: var(--teal-700); border-color: var(--teal-100); }
.role-customer { background: var(--surface-3); color: var(--text-2); border-color: var(--border); }

/* =========================================================
   CARDS
   ========================================================= */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.card-sm { padding: 14px 16px; border-radius: var(--radius); }

.card-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
  letter-spacing: -0.015em;
}

.card-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.5;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.metric-label {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.metric-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
}

.metric-sub {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* =========================================================
   TABLE
   ========================================================= */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

thead th {
  padding: 10px 16px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }

.td-muted { color: var(--text-muted); font-size: 12.5px; }
.td-mono { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); }

/* =========================================================
   FORMS
   ========================================================= */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.form-label-required::after {
  content: ' *';
  color: var(--error);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
  line-height: 1.5;
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--text-placeholder); }

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--teal-600);
  box-shadow: 0 0 0 3px rgb(20 92 102 / .12);
}

.form-input.error,
.form-select.error,
.form-textarea.error { border-color: var(--error); }

.form-input.error:focus,
.form-select.error:focus,
.form-textarea.error:focus { box-shadow: 0 0 0 3px rgb(220 38 38 / .12); }

.form-textarea { resize: vertical; min-height: 80px; }

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236B8C90' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 32px;
  cursor: pointer;
}

.form-help { font-size: 12px; color: var(--text-muted); }
.form-error { font-size: 12px; color: var(--error); font-weight: 500; }

/* =========================================================
   FEEDBACK STATES
   ========================================================= */
.skeleton {
  background: var(--surface-2);
  border-radius: var(--radius);
  animation: skeleton-pulse 1.6s ease-in-out infinite;
}
@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 24px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state__icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--text-muted);
}

.empty-state__title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 6px;
}

.empty-state__body {
  font-size: 13.5px;
  max-width: 320px;
  line-height: 1.6;
}

.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13.5px;
  border: 1px solid transparent;
}

.alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; }

.alert-error   { background: var(--error-bg);   color: #991b1b; border-color: #FECACA; }
.alert-warning { background: var(--warning-bg);  color: #92400E; border-color: #FDE68A; }
.alert-success { background: var(--success-bg);  color: #166534; border-color: #86EFAC; }
.alert-info    { background: var(--info-bg);     color: #075985; border-color: #BAE6FD; }

.feedback-loading {
  color: var(--text-muted);
  font-size: 13.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.spinner {
  width: 16px; height: 16px;
  border: 2px solid var(--border-2);
  border-top-color: var(--teal-600);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-width: 260px;
  max-width: 360px;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  pointer-events: all;
  animation: toast-in var(--dur-slow) var(--ease-out) both;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* =========================================================
   FILTERS BAR
   ========================================================= */
.filters {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

/* =========================================================
   METRICS OVERVIEW GRID
   ========================================================= */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

/* =========================================================
   PRODUCT GRID / LIST
   ========================================================= */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.product-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast), transform var(--dur-fast) var(--ease-out);
}

.product-card:hover {
  border-color: var(--border-2);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.product-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.product-card__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.product-card__meta {
  font-size: 12px;
  color: var(--text-muted);
}

.product-card__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 4px;
}

/* =========================================================
   PRODUCT DETAIL — 2-col layout
   ========================================================= */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  align-items: start;
}

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

.detail-panel__header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-panel__title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}

.detail-panel__body { padding: 18px; }

.actions-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.action-item { width: 100%; text-align: left; }

/* History / Timeline */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 0 12px;
  padding-bottom: 16px;
  position: relative;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border-2);
  border: 2px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border-2);
  margin-top: 4px;
  position: relative;
  z-index: 1;
  justify-self: center;
}

.timeline-item:not(:last-child) .timeline-dot::after {
  content: '';
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: calc(100% + 6px);
  background: var(--border);
}

.timeline-dot.active { background: var(--teal-600); box-shadow: 0 0 0 1px var(--teal-200); }

.timeline-content { padding-top: 2px; }
.timeline-event { font-size: 13px; font-weight: 500; color: var(--text); }
.timeline-time  { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* =========================================================
   DIALOG / MODAL
   ========================================================= */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(15 33 36 / .35);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  animation: fade-in 150ms ease both;
}

[hidden] {
  display: none !important;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.dialog {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 480px;
  animation: dialog-in var(--dur-base) var(--ease-out) both;
}

@keyframes dialog-in {
  from { opacity: 0; transform: scale(0.97) translateY(6px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.dialog__header {
  padding: 18px 20px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dialog__title { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.dialog__body { padding: 18px 20px; }
.dialog__footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* =========================================================
   DIVIDERS & LAYOUT HELPERS
   ========================================================= */
.divider { height: 1px; background: var(--border); margin: 16px 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }

.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }

.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }

.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }

.text-sm  { font-size: 12px; }
.text-base { font-size: 13.5px; }
.text-lg  { font-size: 15px; }
.text-muted { color: var(--text-muted); }
.text-error { color: var(--error); }
.text-success { color: var(--success); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-teal { color: var(--teal-600); }

/* =========================================================
   RESPONSIVENESS
   ========================================================= */
@media (max-width: 1024px) {
  .studio-layout { grid-template-columns: minmax(0, 1fr); }

  .studio-sidebar {
    transform: translateX(-100%);
    transition: transform var(--dur-base) var(--ease-out);
    box-shadow: var(--shadow-lg);
  }

  .studio-sidebar.open { transform: translateX(0); }

  .studio-main { margin-left: 0; }

  .studio-topbar { display: flex; }

  .detail-layout { grid-template-columns: 1fr; }

  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .studio-page { padding: 16px; }
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .product-grid { grid-template-columns: 1fr; }
  .page-header { flex-direction: column; gap: 10px; }
  .page-header__actions { width: 100%; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .filters { flex-direction: column; align-items: stretch; }
}

/* Sidebar overlay on mobile */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgb(15 33 36 / .25);
  z-index: 99;
}

@media (max-width: 1024px) {
  .sidebar-overlay.visible { display: block; }
}

/* =========================================================
   AVATAR
   ========================================================= */
.avatar {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--teal-700);
  flex-shrink: 0;
  text-transform: uppercase;
}
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }

/* =========================================================
   DROPDOWN / MENU
   ========================================================= */
.dropdown {
  position: relative;
  display: inline-flex;
}

.dropdown__trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  height: 34px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.dropdown__trigger:hover {
  background: var(--surface-2);
  border-color: var(--border);
}

.dropdown__menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 150;
  display: none;
  flex-direction: column;
  gap: 2px;
  animation: dropdown-in var(--dur-fast) var(--ease-out) both;
}

.dropdown.open .dropdown__menu { display: flex; }

@keyframes dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dropdown__item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 450;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
  border: none;
  background: transparent;
  width: 100%;
  text-align: left;
}
.dropdown__item:hover {
  background: var(--surface-2);
  color: var(--text);
}
.dropdown__item--danger { color: var(--error); }
.dropdown__item--danger:hover { background: var(--error-bg); }
.dropdown__divider { height: 1px; background: var(--border); margin: 4px 0; }

/* =========================================================
   DRAWER (right-side sheet)
   ========================================================= */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgb(15 33 36 / .25);
  z-index: 200;
  display: none;
}
.drawer-backdrop.open { display: block; }

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 100%;
  max-width: 420px;
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 201;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--dur-base) var(--ease-out);
}
.drawer-backdrop.open + .drawer,
.drawer.open { transform: translateX(0); }

.drawer__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.drawer__title { font-size: 15px; font-weight: 700; letter-spacing: -0.02em; }
.drawer__body { flex: 1; overflow-y: auto; padding: 20px; }
.drawer__footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* =========================================================
   TABS
   ========================================================= */
.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: fit-content;
}

.tab {
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast);
}
.tab:hover { color: var(--text); }
.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

/* =========================================================
   CHECKBOX / RADIO
   ========================================================= */
.form-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text);
  cursor: pointer;
}
.form-check input[type="checkbox"],
.form-check input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--teal-600);
  cursor: pointer;
}

/* =========================================================
   TOOLTIP
   ========================================================= */
.tooltip {
  position: relative;
}
.tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 8px;
  background: var(--text);
  color: var(--surface);
  font-size: 11px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur-fast);
  z-index: 200;
}
.tooltip:hover::after { opacity: 1; }

/* =========================================================
   DASHBOARD WIDGETS
   ========================================================= */
.widget {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}

.widget--editing {
  border-color: var(--teal-200);
  box-shadow: 0 0 0 1px var(--teal-100), var(--shadow);
}

.widget__header {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 16px;
}

.widget__icon {
  width: 28px;
  height: 28px;
  border-radius: var(--radius);
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--teal-600);
  flex-shrink: 0;
}
.widget__icon svg { width: 14px; height: 14px; }

.widget__titles { flex: 1; min-width: 0; }
.widget__title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.015em;
  line-height: 1.3;
}
.widget__subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 1px;
}

.widget__actions { flex-shrink: 0; }

.widget__loading,
.widget__error,
.widget__empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

.widget__loading { gap: 8px; }
.widget__empty {
  flex-direction: column;
  gap: 6px;
}
.widget__empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-2);
}
.widget__empty-body {
  font-size: 13px;
  color: var(--text-muted);
  max-width: 320px;
}
.widget__error {
  flex-direction: column;
  gap: 10px;
}
.widget__error-message {
  color: var(--error);
  font-weight: 500;
}

.widget__metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 12px;
}

.widget__metric {
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.widget__metric-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.widget__metric-label {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 4px;
}

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

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

.widget__wave-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}
.widget__wave-name { font-weight: 600; color: var(--text-2); }
.widget__wave-value { color: var(--text-muted); font-variant-numeric: tabular-nums; }

.widget__wave-track {
  width: 100%;
  height: 6px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.widget__wave-bar {
  height: 100%;
  background: var(--teal-600);
  border-radius: var(--radius-pill);
  transition: width var(--dur-slow) var(--ease-out);
}

/* Widget customization controls */
.widget-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.widget-control__visibility {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13.5px;
  color: var(--text);
  flex: 1;
}

.widget-control__handle {
  color: var(--text-muted);
  font-size: 12px;
  letter-spacing: -1px;
  user-select: none;
}

.widget-control__actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

/* =========================================================
   RESPONSIVENESS — Dashboard extras
   ========================================================= */
@media (max-width: 640px) {
  .widget { padding: 14px 16px; }
  .widget__metrics { grid-template-columns: repeat(2, 1fr); }
}

/* =========================================================
   CATALOG LAYOUT
   ========================================================= */
.catalog-layout {
  display: grid;
  grid-template-columns: 220px 220px 1fr;
  gap: 16px;
  align-items: start;
}

.catalog-panel { min-width: 0; }
.catalog-panel--wide { grid-column: span 1; }

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

.catalog-niche,
.catalog-subniche {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background var(--dur-fast), border-color var(--dur-fast), color var(--dur-fast);
}

.catalog-niche:hover,
.catalog-subniche:hover {
  background: var(--surface-2);
  color: var(--text);
}

.catalog-niche.active,
.catalog-subniche.active {
  background: var(--teal-50);
  border-color: var(--teal-100);
  color: var(--teal-700);
}

.catalog-niche__count {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 1px 6px;
}

/* =========================================================
   INFO GRID
   ========================================================= */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.info-cell {
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* =========================================================
   PROGRESS
   ========================================================= */
.progress-track {
  height: 8px;
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--teal-600);
  border-radius: var(--radius-pill);
  transition: width 0.3s ease;
}

/* =========================================================
   RESPONSIVENESS — Catalog extras
   ========================================================= */
@media (max-width: 1024px) {
  .catalog-layout {
    grid-template-columns: 1fr 1fr;
  }
  .catalog-panel--wide { grid-column: span 2; }
}

@media (max-width: 640px) {
  .catalog-layout {
    grid-template-columns: 1fr;
  }
  .catalog-panel--wide { grid-column: span 1; }
  .info-grid { grid-template-columns: 1fr 1fr; }
}

.login-page {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 36px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}
.login-brand__name {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.login-brand__badge {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--teal-600);
  background: var(--teal-50);
  border: 1px solid var(--teal-100);
  border-radius: var(--radius-pill);
  padding: 2px 7px;
  line-height: 1.6;
}
.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
  letter-spacing: -0.02em;
}
.login-subtitle {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.login-field { margin-bottom: 16px; }
.login-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}
.login-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.login-field input:focus {
  outline: none;
  border-color: var(--teal-600);
  box-shadow: 0 0 0 3px rgb(20 92 102 / .12);
}
.login-field input::placeholder { color: var(--text-placeholder); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 42px; }
.password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.password-toggle:hover { background: var(--surface-2); color: var(--text); }
.login-error {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--error-bg);
  color: #991b1b;
  border: 1px solid #fecaca;
  font-size: 13px;
  margin-bottom: 16px;
}
.login-btn {
  width: 100%;
  height: 42px;
  font-size: 14px;
}
.login-btn.loading::after { color: #fff; }
.login-back {
  display: block;
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-muted);
}
.login-back:hover { color: var(--teal-600); }
.login-footer {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

@media (max-width: 480px) {
  .login-card { padding: 28px 22px; }
}
