/**
 * tal-theme.css — Multi-skin design system (Shell + modules)
 * ---------------------------------------------------------------------------
 * Skins: platform (default, Cogover layout × TAL teal) | editorial (alias) | studio | lookbook
 * Module style.css dùng token --tal-* / --navy/--bg — không hard-code palette.
 * Ref: docs/ui/PLAN_MIGRATE_COGOVER_PLATFORM.md + docs/ui/TAL_UI_TEMPLATE.html
 */
@import url("https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600;700&family=Manrope:wght@400;500;600;700;800&family=Newsreader:opsz,wght@6..72,500;6..72,600;6..72,700&family=Outfit:wght@500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&family=Syne:wght@600;700;800&display=swap");

:root {
  --tal-frame: #0c0c0e;
  --tal-ink: #24222a;
  --tal-ink-soft: #3a3842;
  --tal-primary: #0d6e67;
  --tal-primary-light: #1aa38f;
  --tal-accent: #0d6e67;
  --tal-accent-soft: rgba(15, 138, 97, 0.16);
  --tal-accent-hover: #0b5f59;

  --tal-success: #0f7a4c;
  --tal-warning: #b45309;
  --tal-danger: #b42318;

  --tal-bg: #f7f5f2;
  --tal-bg-elevated: #f1eeea;
  --tal-surface: #ffffff;
  --tal-text: #24222a;
  --tal-muted: #797683;
  --tal-border: #ece8e3;
  --tal-border-strong: #ddd8d1;

  --tal-radius: 16px;
  --tal-radius-sm: 8px;
  --tal-radius-lg: 24px;
  --tal-shadow: 0 8px 28px rgba(13, 22, 47, 0.07), 0 1px 2px rgba(13, 22, 47, 0.04);
  --tal-shadow-hover: 0 12px 36px rgba(13, 22, 47, 0.1);
  --tal-sidebar-w: 248px;
  --tal-sidebar-bg: #fbfaf8;
  --tal-sidebar-fg: #24222a;
  --tal-sidebar-muted: #797683;
  --tal-sidebar-hover: #f3f0eb;
  --tal-sidebar-border: #ece8e3;
  --tal-sidebar-active-fg: #083d48;
  --tal-logo-radius: 8px;
  --tal-title-size: 26px;
  --tal-nav-active-bg: rgba(15, 138, 97, 0.16);
  --tal-nav-active-bar: #0d6e67;
  --tal-header-h: 56px;

  --tal-font: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --tal-font-display: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --tal-font-mono: "JetBrains Mono", ui-monospace, monospace;

  --tal-canvas:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(13, 110, 103, 0.07), transparent 55%),
    radial-gradient(ellipse 60% 40% at -10% 100%, rgba(12, 36, 56, 0.04), transparent 50%);

  --navy: var(--tal-ink);
  --navy-deep: #0c2438;
  --green: var(--tal-success);
  --orange: var(--tal-warning);
  --red: var(--tal-danger);
  --bg: var(--tal-bg);
  --card: var(--tal-surface);
  --border: var(--tal-border);
  --text: var(--tal-text);
  --muted: var(--tal-muted);
  --radius: var(--tal-radius);

  --tal-stage-1: #797683;
  --tal-stage-2: #2a6fbf;
  --tal-stage-3: #b45309;
  --tal-stage-4: #0f7a4c;
  --tal-stage-5: #b42318;
}

/* ---------- Skin: Platform (Cogover layout × TAL) + editorial alias ---------- */
html[data-tal-skin="platform"],
html[data-tal-skin="editorial"] {
  --tal-frame: #0c0c0e;
  --tal-ink: #24222a;
  --tal-ink-soft: #3a3842;
  --tal-primary: #0d6e67;
  --tal-primary-light: #1aa38f;
  --tal-accent: #0d6e67;
  --tal-accent-soft: rgba(15, 138, 97, 0.16);
  --tal-accent-hover: #0b5f59;
  --tal-bg: #f7f5f2;
  --tal-bg-elevated: #f1eeea;
  --tal-surface: #ffffff;
  --tal-text: #24222a;
  --tal-muted: #797683;
  --tal-border: #ece8e3;
  --tal-border-strong: #ddd8d1;
  --tal-radius: 16px;
  --tal-radius-sm: 8px;
  --tal-radius-lg: 24px;
  --tal-shadow: 0 8px 28px rgba(13, 22, 47, 0.07), 0 1px 2px rgba(13, 22, 47, 0.04);
  --tal-shadow-hover: 0 12px 36px rgba(13, 22, 47, 0.1);
  --tal-sidebar-bg: #fbfaf8;
  --tal-sidebar-fg: #24222a;
  --tal-sidebar-muted: #797683;
  --tal-sidebar-hover: #f3f0eb;
  --tal-sidebar-border: #ece8e3;
  --tal-sidebar-active-fg: #083d48;
  --tal-font: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --tal-font-display: "Manrope", ui-sans-serif, system-ui, sans-serif;
  --tal-title-size: 26px;
  --tal-nav-active-bg: rgba(15, 138, 97, 0.16);
  --tal-nav-active-bar: #0d6e67;
  --tal-canvas:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(13, 110, 103, 0.07), transparent 55%),
    radial-gradient(ellipse 60% 40% at -10% 100%, rgba(12, 36, 56, 0.04), transparent 50%);
  --navy-deep: #0c2438;
}

/* ---------- Skin: Studio / Campaign ---------- */
html[data-tal-skin="studio"] {
  --tal-ink: #0a1628;
  --tal-ink-soft: #12263f;
  --tal-primary: #0a1628;
  --tal-primary-light: #1a3354;
  --tal-accent: #00c2a8;
  --tal-accent-soft: #d8f7f2;
  --tal-accent-hover: #00a890;
  --tal-bg: #eef2f7;
  --tal-bg-elevated: #e4ebf3;
  --tal-surface: #ffffff;
  --tal-text: #0b1220;
  --tal-muted: #5a6b82;
  --tal-border: #d0dae6;
  --tal-border-strong: #b4c2d4;
  --tal-radius: 12px;
  --tal-radius-sm: 8px;
  --tal-radius-lg: 18px;
  --tal-shadow: 0 1px 0 rgba(10, 22, 40, 0.04), 0 12px 32px rgba(10, 22, 40, 0.07);
  --tal-shadow-hover: 0 16px 40px rgba(0, 194, 168, 0.12);
  --tal-font: "Instrument Sans", system-ui, sans-serif;
  --tal-font-display: "Syne", system-ui, sans-serif;
  --tal-title-size: 28px;
  --tal-logo-radius: 11px;
  --tal-nav-active-bg: rgba(0, 194, 168, 0.18);
  --tal-nav-active-bar: #7dff6b;
  --tal-canvas:
    radial-gradient(ellipse 70% 55% at 110% -5%, rgba(0, 194, 168, 0.14), transparent 55%),
    radial-gradient(ellipse 55% 45% at -5% 105%, rgba(125, 255, 107, 0.08), transparent 50%),
    linear-gradient(165deg, #e8eef6 0%, #f4f7fb 45%, #eef6f4 100%);
  --navy-deep: #050d18;
  --tal-stage-2: #0891b2;
  --tal-stage-3: #ca8a04;
  --tal-sidebar-bg: #0a1628;
  --tal-sidebar-fg: #f5f7fa;
  --tal-sidebar-muted: rgba(245, 247, 250, 0.55);
  --tal-sidebar-hover: rgba(255, 255, 255, 0.07);
  --tal-sidebar-border: rgba(255, 255, 255, 0.1);
  --tal-sidebar-active-fg: #fff;
  --tal-frame: #050d18;
}

/* ---------- Skin: Lookbook ---------- */
html[data-tal-skin="lookbook"] {
  --tal-ink: #1a1f2e;
  --tal-ink-soft: #2a3144;
  --tal-primary: #1a1f2e;
  --tal-primary-light: #3a4258;
  --tal-accent: #e8a87c;
  --tal-accent-soft: #fbf0e6;
  --tal-accent-hover: #d4925f;
  --tal-bg: #faf9f7;
  --tal-bg-elevated: #f3f1ec;
  --tal-surface: #ffffff;
  --tal-text: #1c1917;
  --tal-muted: #78716c;
  --tal-border: #e7e2db;
  --tal-border-strong: #d4cdc3;
  --tal-radius: 14px;
  --tal-radius-sm: 8px;
  --tal-radius-lg: 22px;
  --tal-shadow: 0 2px 16px rgba(26, 31, 46, 0.05);
  --tal-shadow-hover: 0 12px 36px rgba(26, 31, 46, 0.08);
  --tal-font: "Outfit", system-ui, sans-serif;
  --tal-font-display: "Outfit", system-ui, sans-serif;
  --tal-title-size: 30px;
  --tal-logo-radius: 50%;
  --tal-nav-active-bg: rgba(232, 168, 124, 0.2);
  --tal-nav-active-bar: #e8a87c;
  --tal-canvas:
    radial-gradient(ellipse 90% 60% at 50% -20%, rgba(232, 168, 124, 0.12), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 80%, rgba(26, 31, 46, 0.03), transparent 50%);
  --navy-deep: #12151f;
  --tal-sidebar-w: 260px;
  --tal-sidebar-bg: #1a1f2e;
  --tal-sidebar-fg: #f5f7fa;
  --tal-sidebar-muted: rgba(245, 247, 250, 0.55);
  --tal-sidebar-hover: rgba(255, 255, 255, 0.07);
  --tal-sidebar-border: rgba(255, 255, 255, 0.1);
  --tal-sidebar-active-fg: #fff;
  --tal-frame: #12151f;
}

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

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--tal-font);
  color: var(--tal-text);
  background-color: var(--tal-bg);
  background-image: var(--tal-canvas);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.2s ease;
}

html[data-tal-skin="platform"] .tal-brand-mark .tal-logo,
html[data-tal-skin="editorial"] .tal-brand-mark .tal-logo {
  background: linear-gradient(88deg, #083d48, #0d6e67 40%, #1aa38f);
  color: #fff;
}

/* ---------- Shared chrome ---------- */
.tal-brand-mark {
  display: flex;
  align-items: center;
  gap: 12px;
}
.tal-brand-mark .tal-logo {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: var(--tal-logo-radius);
  background: var(--tal-accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--tal-font-display);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
}
html[data-tal-skin="studio"] .tal-brand-mark .tal-logo {
  color: #0a1628;
  box-shadow: 0 0 0 2px rgba(125, 255, 107, 0.35);
}
.tal-brand-mark .tal-brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.tal-brand-mark .tal-brand-name {
  font-family: var(--tal-font-display);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: inherit;
}
html[data-tal-skin="studio"] .tal-brand-mark .tal-brand-name {
  font-weight: 700;
  letter-spacing: -0.03em;
}
html[data-tal-skin="lookbook"] .tal-brand-mark .tal-brand-name {
  font-weight: 600;
  font-size: 18px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.tal-brand-mark .tal-brand-sub {
  font-size: 11px;
  font-weight: 500;
  opacity: 0.72;
  letter-spacing: 0.02em;
}

.tal-nav-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--tal-radius-sm);
  color: inherit;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  margin-bottom: 2px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background 0.15s ease, color 0.15s ease;
}
.tal-nav-item .tal-nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  margin-top: 1px;
  opacity: 0.85;
}
.tal-nav-item .tal-nav-label { flex: 1; min-width: 0; line-height: 1.35; }
.tal-nav-item small {
  display: block;
  font-size: 11px;
  font-weight: 400;
  opacity: 0.65;
  margin-top: 2px;
  line-height: 1.35;
}
.tal-nav-item:hover { background: var(--tal-sidebar-hover, rgba(255, 255, 255, 0.08)); }
.tal-nav-item.active {
  background: var(--tal-nav-active-bg);
  color: var(--tal-sidebar-active-fg, #fff);
  font-weight: 600;
}
.tal-nav-item.active .tal-nav-icon { opacity: 1; color: var(--tal-accent); }

.tal-card {
  background: var(--tal-surface);
  border: 1px solid var(--tal-border);
  border-radius: var(--tal-radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--tal-shadow);
}

.tal-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--tal-radius-sm);
  border: 1px solid transparent;
  font-family: inherit;
  font-weight: 600;
  font-size: 13.5px;
  cursor: pointer;
  background: var(--tal-ink);
  color: #fff;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.tal-btn:hover { background: var(--tal-ink-soft); }
.tal-btn:disabled { opacity: 0.55; cursor: default; }
.tal-btn-accent { background: var(--tal-accent); color: #fff; }
html[data-tal-skin="studio"] .tal-btn-accent { color: #0a1628; }
.tal-btn-accent:hover { background: var(--tal-accent-hover); }
.tal-btn-ghost {
  background: transparent;
  color: var(--tal-ink);
  border-color: var(--tal-border);
}
.tal-btn-ghost:hover { background: var(--tal-bg-elevated); }

.tal-badge-demo {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--tal-accent-soft);
  color: var(--tal-accent-hover);
  border: 1px solid color-mix(in srgb, var(--tal-accent) 35%, transparent);
}

.tal-assumption-banner {
  background: var(--tal-accent-soft);
  border: 1px solid color-mix(in srgb, var(--tal-accent) 35%, transparent);
  color: var(--tal-accent-hover);
  padding: 0.55rem 0.85rem;
  border-radius: var(--tal-radius);
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.page-title {
  font-family: var(--tal-font-display);
  font-size: var(--tal-title-size);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 4px;
  color: var(--tal-ink);
}
html[data-tal-skin="studio"] .page-title {
  font-weight: 800;
  letter-spacing: -0.04em;
}
html[data-tal-skin="lookbook"] .page-title {
  font-weight: 500;
  letter-spacing: -0.01em;
}
.page-subtitle {
  color: var(--tal-muted);
  font-size: 13.5px;
  margin: 0 0 22px;
  line-height: 1.45;
  max-width: 52ch;
}

/* Skin picker (shell) */
.tal-skin-picker {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tal-skin-picker label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.55;
}
.tal-skin-picker select {
  width: 100%;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  padding: 7px 10px;
  border-radius: var(--tal-radius-sm);
  border: 1px solid var(--tal-sidebar-border, rgba(255, 255, 255, 0.16));
  background: var(--tal-surface);
  color: var(--tal-sidebar-fg, #fff);
  cursor: pointer;
}
html[data-tal-skin="studio"] .tal-skin-picker select,
html[data-tal-skin="lookbook"] .tal-skin-picker select {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.16);
}
.tal-skin-picker select option {
  color: #0f1720;
  background: #fff;
}

/* Hide module sidebar when embedded in Shell — single chrome */
body.tal-in-shell .sidebar,
body.tal-in-shell .app-shell > .sidebar {
  display: none !important;
}
body.tal-in-shell .user-box,
body.tal-in-shell .app-shell > .sidebar .user-box {
  display: none !important;
}
body.tal-in-shell .app-shell,
body.tal-in-shell .shell {
  display: block;
}
body.tal-in-shell .main {
  max-width: none;
  padding: 16px 24px 32px;
  min-height: 100vh;
}

/* Empty / skeleton / error — shared with tal-states.js */
.tal-empty,
.tal-error {
  text-align: center;
  padding: 28px 20px;
  border: 1px dashed var(--tal-border, #e5e7eb);
  border-radius: 12px;
  background: var(--tal-bg, #f7f5f2);
  color: var(--tal-ink, #24222a);
}
.tal-empty-title,
.tal-error-title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}
.tal-empty-hint,
.tal-error-msg {
  margin: 0 0 12px;
  font-size: 13px;
  color: var(--tal-muted, #797683);
  line-height: 1.45;
}
.tal-empty-cta,
.tal-error-retry {
  appearance: none;
  border: 0;
  background: var(--tal-accent, #0d6e67);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.tal-error {
  border-style: solid;
  border-color: #fecaca;
  background: #fef2f2;
}
.tal-skeleton {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 0;
}
.tal-sk-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #ece8e3 0%, #f5f2ed 50%, #ece8e3 100%);
  background-size: 200% 100%;
  animation: tal-sk-shine 1.2s ease-in-out infinite;
}
.tal-sk-wide { width: 88%; }
.tal-sk-mid { width: 64%; }
.tal-sk-short { width: 42%; }
@keyframes tal-sk-shine {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

/* Platform home link (standalone modules / portal) */
.tal-home-bar {
  padding: 10px 16px;
  border-bottom: 1px solid var(--tal-border, #e5e7eb);
  background: var(--tal-bg-elevated, #fff);
  font-size: 14px;
}
.tal-home-bar a,
a.tal-home-link {
  color: var(--tal-accent, #2563eb);
  text-decoration: none;
  font-weight: 600;
}
.tal-home-bar a:hover,
a.tal-home-link:hover {
  text-decoration: underline;
}
.sidebar .tal-home-link,
.nav .tal-home-link {
  margin-bottom: 4px;
}

/* Motion */
@keyframes tal-fade-up {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.tal-animate-in {
  animation: tal-fade-up 0.35s ease both;
}
.tal-animate-in-delay-1 { animation-delay: 0.06s; }
.tal-animate-in-delay-2 { animation-delay: 0.12s; }

html[data-tal-skin="studio"] .tal-animate-in {
  animation-duration: 0.45s;
}

/* Kanban — muted stage headers */
.kanban-col-header {
  font-size: 12px !important;
  font-weight: 600 !important;
  letter-spacing: 0.02em;
  padding: 9px 12px !important;
  border-radius: 8px !important;
  margin-bottom: 10px !important;
  color: #fff !important;
  opacity: 0.95;
}

/* Stage pills */
.stage-pill[data-stage="RECEIVED_FROM_CRM"],
.tal-stage-RECEIVED_FROM_CRM { background: #64748b; }
.tal-stage-QUOTE_DRAFTING { background: #3b6ea5; }
.tal-stage-PENDING_APPROVAL { background: #b45309; }
.tal-stage-APPROVED { background: #1f7a4c; }
.tal-stage-CONTRACTING { background: #2563eb; }
.tal-stage-CREATIVE_REVIEW { background: #7c3aed; }
.tal-stage-IN_PROGRESS { background: #0e7490; }
.tal-stage-QUOTE_CHANGE_PENDING { background: #c2410c; }
.tal-stage-ACCEPTANCE { background: #0f766e; }
.tal-stage-CLOSED_WON,
.tal-stage-CLOSED { background: #166534; }
.tal-stage-CLOSED_LOST,
.tal-stage-REJECTED { background: #64748b; }

.tal-lang-switch {
  display: inline-flex;
  gap: 2px;
  border: 1px solid var(--tal-border, #ece8e3);
  border-radius: 999px;
  padding: 2px;
  background: var(--tal-surface, #fff);
}
.tal-lang-switch button {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
  color: var(--tal-muted, #797683);
  min-width: 44px;
}
.tal-lang-switch button.active {
  background: var(--tal-accent, #0d6e67);
  color: #fff;
}
.tal-lang-slot { margin: 8px 0; }
