/* AI Learning Platform — professional studio UI */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');



:root {
  --ink: #0f172a;
  --ink-soft: #334155;
  --paper: #f1f5f9;
  --paper-deep: #e2e8f0;
  --card: #ffffff;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --muted: #64748b;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #eff6ff;
  --accent-ring: rgba(37, 99, 235, .18);
  --coral: #2563eb;
  --ok: #15803d;
  --ok-soft: #ecfdf5;
  --warn: #b45309;
  --warn-soft: #fffbeb;
  --bad: #b91c1c;
  --bad-soft: #fef2f2;
  --sidebar-w: 300px;
  --header-h: 60px;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 3px rgba(15, 23, 42, .06), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-lg: 0 4px 6px rgba(15, 23, 42, .04), 0 20px 40px rgba(15, 23, 42, .08);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  margin: 0;
  background: var(--paper);
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; }

/* ---- Header ---- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: rgba(255, 255, 255, .92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 16px;
  padding: 0 24px;
}

.brand {
  grid-column: 1;
  justify-self: start;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.logo-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37, 99, 235, .35);
}

.logo-mark svg { display: block; }

.brand-text { min-width: 0; }

.brand-text h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--ink);
  line-height: 1.2;
}

.brand-meta {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.header-spacer { display: none; }

.site-nav {
  grid-column: 2;
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-pills {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: #f1f5f9;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.nav-pill {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s, color .15s, box-shadow .15s;
  white-space: nowrap;
}

.nav-pill:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, .65);
}

.nav-pill.nav-active {
  background: #fff;
  color: var(--ink);
  font-weight: 600;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
}

.nav-util {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.nav-ghost,
.site-nav button.gear {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s, color .15s;
}

.nav-ghost:hover,
.site-nav button.gear:hover {
  background: var(--paper);
  color: var(--ink);
}

.site-nav a,
.site-nav button,
.gear {
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background .15s, color .15s;
}

.site-nav a:hover,
.site-nav button:hover,
.gear:hover {
  background: var(--paper);
  color: var(--ink);
}

.nav-primary {
  background: var(--accent) !important;
  color: #fff !important;
  box-shadow: 0 1px 2px rgba(37, 99, 235, .25);
}

.nav-primary:hover {
  background: var(--accent-hover) !important;
  color: #fff !important;
}

.site-nav .nav-tab.nav-active {
  background: var(--paper);
  color: var(--ink);
  font-weight: 600;
}

.inline-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.inline-link:hover { text-decoration: underline; }

.rag-save-lib-opt {
  font-size: 12px;
  color: var(--ink-soft);
  gap: 8px;
  align-items: flex-start;
  line-height: 1.4;
}
.rag-save-lib-opt input { margin-top: 2px; flex-shrink: 0; }

.rag-library-page .workspace-body { padding-top: 0; }
.rag-library-lead { margin: 4px 0 0; max-width: 70ch; }
.rag-library-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}
.rag-library-layout--folders {
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
}
.rag-folder-card { margin: 0; position: sticky; top: 8px; }
.rag-folder-tree {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: min(42vh, 420px);
  overflow: auto;
  margin-bottom: 8px;
}
.rag-folder-divider {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 8px 4px;
}
.rag-folder-hint { margin: 8px 0 0; font-size: 12px; line-height: 1.4; }
.rag-folder-row {
  display: flex;
  align-items: center;
  gap: 2px;
  border-radius: 8px;
  border: 1px solid transparent;
  position: relative;
}
.rag-folder-row.sel {
  background: rgba(13, 95, 91, .08);
  border-color: rgba(13, 95, 91, .25);
}
.rag-folder-item {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
}
.rag-folder-row.sel .rag-folder-item { font-weight: 600; }
.rag-folder-item:hover { background: var(--paper, #f8fafc); }
.rag-folder-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rag-folder-nest {
  color: var(--muted);
  font-size: 12px;
  flex: none;
}
.rag-folder-item .rag-f-count {
  margin-left: auto;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  flex: none;
}
.rag-folder-menu-wrap { position: relative; flex: none; }
.rag-folder-more {
  width: 30px;
  height: 28px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  font-size: 14px;
  letter-spacing: 0.05em;
  line-height: 1;
}
.rag-folder-more:hover,
.rag-folder-row.sel .rag-folder-more { background: rgba(15, 23, 42, .06); color: #0f172a; }
.rag-folder-menu {
  position: absolute;
  right: 0;
  top: 100%;
  z-index: 40;
  min-width: 160px;
  padding: 6px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--line, #e2e8f0);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .12);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.rag-folder-menu[hidden] { display: none !important; }
.rag-folder-menu button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 8px 10px;
  border-radius: 7px;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
}
.rag-folder-menu button:hover { background: #f1f5f9; }
.rag-folder-menu button.danger { color: #b91c1c; }
.rag-folder-menu button.danger:hover { background: #fee2e2; }
.rag-folder-editor {
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line, #e2e8f0);
  background: #f8fafc;
}
.rag-folder-editor--active {
  border-color: rgba(13, 95, 91, .35);
  background: #f0fdfa;
}
.rag-folder-editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.rag-folder-editor-help {
  margin: 8px 0 0;
  font-size: 12px;
  line-height: 1.4;
}
.rag-folder-editor .rag-folder-select { margin: 0 0 8px; }
.rag-folder-editor input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line, #e2e8f0);
  font: inherit;
  box-sizing: border-box;
}
.rag-folder-new { margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--line); }
.rag-folder-new .rag-folder-select { margin-bottom: 8px; }
.rag-folder-select {
  width: 100%;
  margin: 0 0 12px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 13px;
}
.rag-lib-group { margin-bottom: 10px; }
.rag-lib-group-head {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px 10px 0 0;
  background: var(--paper, #f8fafc);
  font-size: 12px;
  cursor: pointer;
  margin: 0;
}
.rag-lib-group-head input { margin-top: 2px; flex-shrink: 0; }
.rag-lib-group .rag-lib-source-row {
  border-radius: 0;
  border-top: none;
}
.rag-lib-group .rag-lib-source-row:last-child { border-radius: 0 0 10px 10px; }
.rag-lib-group-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 12px 0 6px;
}
.rag-lib-group-title:first-child { margin-top: 0; }
.rag-lib-item .rag-move-select,
.rag-lib-item .rag-add-folder-select {
  max-width: 160px;
  font-size: 12px;
}
.rag-folder-chips {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px;
}
.rag-folder-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 2px 8px; border-radius: 6px;
  background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe;
}
.rag-folder-chip--muted {
  background: #f1f5f9; color: #64748b; border-color: #e2e8f0;
}
.rag-folder-chip-x {
  border: 0; background: transparent; cursor: pointer;
  color: inherit; font-size: 14px; line-height: 1; padding: 0 2px;
  opacity: .7;
}
.rag-folder-chip-x:hover { opacity: 1; }  max-width: 140px;
  font-size: 11px;
  padding: 4px 6px;
}
.rag-library-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.rag-library-main .rag-library-list-card { margin: 0; }

@media (max-width: 1024px) {
  .rag-library-layout,
  .rag-library-layout--folders { grid-template-columns: 1fr; }
  .rag-folder-card { position: static; }
}
.rag-library-list-card .rag-lib-list-page { max-height: min(52vh, 520px); }
.rag-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.rag-upload-grid .card { margin: 0; height: 100%; }
.rag-upload-grid textarea { min-height: 100px; }

@media (max-width: 1024px) {
  .rag-library-layout { grid-template-columns: 1fr; }
  .rag-upload-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .rag-upload-grid { grid-template-columns: 1fr; }
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, .35);
  backdrop-filter: blur(4px);
}
.login-overlay[hidden] { display: none !important; }
.login-overlay .card-login {
  width: min(420px, 100%);
  margin: 0;
  box-shadow: var(--shadow-lg);
}

.workspace-panel[hidden] { display: none !important; }

.app-shell--library,
body.app-view-library .app-shell {
  grid-template-columns: minmax(0, 1fr) !important;
}

.app-shell--library .sidebar,
body.app-view-library .sidebar {
  display: none !important;
}

.app-shell--library .workspace,
body.app-view-library .workspace {
  grid-column: 1 / -1;
  width: 100%;
  max-width: none;
  padding: 24px clamp(20px, 3vw, 48px) 48px;
  box-sizing: border-box;
}

.app-shell--library #detail,
body.app-view-library #detail {
  display: none !important;
}

.app-shell--library #ragLibraryView,
body.app-view-library #ragLibraryView {
  display: flex !important;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
}

.account {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 0;
  padding-left: 16px;
  border-left: 1px solid var(--line);
}

.account[hidden] { display: none !important; }

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

.who-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex: none;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--accent-ring);
}

.who-text { min-width: 0; line-height: 1.25; }

.who-name {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 160px;
}

.who-role {
  display: block;
  font-size: 11px;
  color: var(--muted);
  text-transform: capitalize;
}

.logout {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.logout:hover { background: var(--paper); color: var(--ink); border-color: var(--line-strong); }

/* ---- App shell ---- */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: calc(100vh - var(--header-h));
  align-items: start;
}

.sidebar {
  padding: 20px 16px 40px 20px;
  border-right: 1px solid var(--line);
  background: #fafbfc;
  min-height: calc(100vh - var(--header-h));
  position: sticky;
  top: var(--header-h);
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
}

.workspace {
  padding: 24px 28px 48px;
  min-width: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(37, 99, 235, .06), transparent),
    var(--paper);
}

.workspace-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: calc(100vh - var(--header-h) - 72px);
  display: flex;
  flex-direction: column;
}

.workspace-head {
  padding: 22px 28px 0;
  border-bottom: 1px solid transparent;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.workspace-del {
  flex: none;
  margin: 2px 0 0;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--bad);
  background: #fff;
  border: 1px solid #fecaca;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.workspace-del:hover { background: var(--bad-soft); }

.workspace-head h2 {
  margin: 0 0 4px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -.025em;
  color: var(--ink);
  line-height: 1.3;
}

.workspace-body {
  padding: 20px 28px 28px;
  flex: 1;
}

.workspace-panel.is-loading .workspace-head h2 { color: var(--muted); }

.workspace-loading {
  text-align: center;
  padding: 28px 24px 32px;
  max-width: 420px;
  margin: 0 auto;
}

.workspace-loading .spin {
  width: 28px;
  height: 28px;
  margin: 0 auto 12px;
  border: 3px solid var(--accent-ring);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: aga-spin .7s linear infinite;
}

.workspace-loading .ws-load-title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink);
}

.workspace-loading .ws-load-hint {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* ---- Cards & blocks ---- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
}

.card:last-child { margin-bottom: 0; }

.card-head {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.card-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}

.card-head .card-sub {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.sidebar-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 14px;
  overflow: hidden;
}

.block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(#fff, #fafbfc);
  border-bottom: 1px solid var(--line);
}

.block-head h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}

.count-badge {
  font-size: 11px;
  font-weight: 600;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 2px 9px;
  border-radius: 999px;
}

.block-body { padding: 10px 12px 12px; max-height: 280px; overflow-y: auto; }

.card-login { border-color: var(--accent-ring); background: linear-gradient(180deg, #fff 0%, var(--accent-soft) 120%); }

.card-login h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  text-transform: none;
  letter-spacing: -.02em;
  margin: 0 0 12px;
  border: none;
  padding: 0;
}

.card-compact { padding: 16px 18px; }

.card-compact .card-head { margin-bottom: 12px; padding-bottom: 10px; }

#loginCard[hidden] { display: none !important; }

h2 {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}

label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-soft);
  margin: 14px 0 6px;
}

label:first-of-type { margin-top: 0; }

input[type=text],
input[type=email],
input[type=password],
input[type=number],
input[type=url],
input[type=file],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px; }
.pw-eye {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  padding: 6px 8px;
  cursor: pointer;
  color: var(--muted);
  border-radius: 6px;
}
.pw-eye:hover { color: var(--ink); background: var(--paper); }

button {
  padding: 9px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: background .15s, border-color .15s, color .15s;
}

button:hover { background: var(--paper); color: var(--ink); }

button.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(37, 99, 235, .2);
}

button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }

button.approve {
  background: var(--ok);
  color: #fff;
  border-color: var(--ok);
}

button:disabled { opacity: .45; cursor: not-allowed; }

.row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}

.muted { color: var(--muted); font-size: 12px; line-height: 1.45; }

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.form-section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 10px;
}

.cta-row {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

/* ---- Create course (main workspace) ---- */
.new-course-btn {
  width: 100%;
  margin: 0 0 6px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 650;
}
.sidebar-create-hint { margin: 0 0 14px; font-size: 12px; }

.create-page {
  min-height: calc(100vh - var(--header-h) - 72px);
}
.create-page .create-head { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.create-lead { margin: 6px 0 0; max-width: 62ch; font-size: 14px; line-height: 1.45; }
.create-body { padding: 20px 24px 40px; }
.create-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.9fr);
  gap: 22px;
  align-items: start;
}
.create-block {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px 22px 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.create-block:last-child { margin-bottom: 0; }
.create-block-basics {
  position: static;
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}
.create-block-title {
  margin: 0 0 14px;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.01em;
}
.create-block-title .muted { font-weight: 500; font-size: 13px; }
.create-block-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}
.create-block-head .create-block-title { margin: 0; }
.create-block-sub { margin: 0 0 14px; font-size: 13px; }
.create-lesson-prompt {
  display: block;
  width: 100%;
  min-height: 120px;
  resize: vertical;
  font-size: 15px !important;
  line-height: 1.45;
  padding: 14px 16px !important;
  margin-bottom: 6px;
  border-radius: 12px;
  box-sizing: border-box;
}
.create-prompt-hint { margin: 0 0 14px; font-size: 12px; }
.lesson-prompt-card {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.lesson-prompt-label { margin: 0 0 6px; font-size: 12px; }
.lesson-prompt-preview {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  max-height: 160px;
  overflow: auto;
}
.create-topic {
  font-size: 16px !important;
  padding: 12px 14px !important;
  margin-bottom: 14px;
}
.create-basics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}
.create-basics-grid .field-hint { display: block; margin-top: 4px; font-size: 11px; }
.create-footer-cta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 8px;
  padding: 18px 22px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  position: sticky;
  bottom: 12px;
  z-index: 3;
}
.create-footer-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.create-footer-copy strong {
  font-size: 14px;
  color: var(--ink);
}
.create-submit {
  padding: 12px 22px !important;
  font-size: 15px !important;
  min-height: 44px;
}
.create-subhead { margin: 18px 0 10px; }
.create-page .stylegrid {
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 12px;
  max-height: 340px;
  overflow-y: auto;
  padding: 2px;
}
.create-page .stylecard .name { font-size: 12.5px; padding: 8px 10px 2px; }
.create-page .stylecard .blurb { font-size: 11px; padding: 0 10px 10px; min-height: 28px; }
.create-page .swatch.style-thumb { height: 96px; }
.create-page .pal-pack-grid {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  max-height: 200px;
}
.create-details {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper, #f8fafc);
  padding: 0;
}
.create-details summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  user-select: none;
}
.create-details summary::-webkit-details-marker { display: none; }
.create-details summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 8px;
  color: var(--muted);
  transition: transform .12s;
}
.create-details[open] summary::before { transform: rotate(90deg); }
.create-details .tplgrid,
.create-details .create-learn-row {
  padding: 0 14px 14px;
}
.create-page .tplgrid {
  max-height: 280px;
  overflow-y: auto;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.create-learn-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}
.create-source-group {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.create-lib-actions { gap: 4px; flex-wrap: wrap; margin: 0; }
.create-file-row,
.create-url-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-top: 6px;
}
.create-file-row > div { flex: 1; min-width: 120px; }
.create-url-row input { flex: 1; min-width: 160px; }
.create-file-actions { margin-top: 8px; gap: 8px; flex-wrap: wrap; }
.create-page .rag-check-list { max-height: 220px; }
.create-save-lib { margin-top: 16px; display: flex; }

@media (max-width: 1100px) {
  .create-layout { grid-template-columns: 1fr; }
  .create-block-basics { position: static; }
  .create-basics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .create-basics-grid { grid-template-columns: 1fr; }
  .create-learn-row { grid-template-columns: 1fr; }
  .create-body { padding: 16px; }
}

.yt-preview {
  margin-top: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.yt-embed-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 10px;
  overflow: hidden;
  background: #0f172a;
}
.yt-embed-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}
.yt-caption-preview {
  margin-top: 10px;
  padding: 10px;
  border-radius: 10px;
  background: var(--panel, #f4f6f9);
  border: 1px solid var(--line);
}
.yt-caption-preview pre {
  margin: 0;
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 12px;
  line-height: 1.45;
  font-family: var(--mono, ui-monospace, Consolas, monospace);
  color: var(--ink);
}
.source-text-details {
  margin-top: 8px;
  border-top: 1px solid var(--line);
  padding-top: 7px;
}
.source-text-details summary {
  width: fit-content;
  cursor: pointer;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
}
.source-text-details pre {
  max-height: 320px;
  margin: 8px 0 0;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: 12px/1.5 var(--mono, ui-monospace, Consolas, monospace);
  color: var(--ink);
}
button.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft, var(--muted));
}
button.ghost:hover { background: var(--panel, #f4f6f9); }

a.filelink { color: var(--accent); font-size: 13px; font-weight: 500; text-decoration: none; }
a.filelink:hover { text-decoration: underline; }

/* ---- Style & template pickers ---- */
.stylegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; margin-top: 4px; }

.palrow { display: flex; flex-wrap: wrap; gap: 7px; margin: 4px 0 8px; }

/* Canva-style 5-swatch palette packs */
.pal-pack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
  padding: 2px;
}
.pal-strip {
  display: flex;
  width: 100%;
  height: 36px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 999px;
  overflow: hidden;
  cursor: pointer;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .08);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
.pal-strip:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(15, 23, 42, .12); }
.pal-strip.sel {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(13, 95, 91, .22);
}
.pal-swatch { flex: 1; height: 100%; min-width: 0; }
.pal-strip-auto {
  align-items: center;
  justify-content: center;
  background: linear-gradient(90deg, #f8fafc, #e2e8f0 40%, #cbd5e1 70%, #94a3b8);
}
.pal-auto-label {
  font-size: 12px;
  font-weight: 700;
  color: #0f172a;
  text-shadow: 0 1px 0 rgba(255,255,255,.7);
}

.sw {
  width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid var(--line); cursor: pointer; padding: 0;
  transition: transform .1s, box-shadow .1s;
}
.sw:hover { transform: scale(1.1); }
.sw.sel { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--accent); }
.sw.autochip {
  width: auto; border-radius: 999px; padding: 0 12px;
  font-size: 11px; font-weight: 600; background: #fff; color: var(--ink); height: 28px;
}
.sw.groundsw { border-radius: 7px; }

.stylecard {
  position: relative; border: 1.5px solid var(--line); border-radius: 10px;
  padding: 0; overflow: hidden; cursor: pointer; background: #fff; text-align: left;
  transition: transform .12s, border-color .12s, box-shadow .12s;
}
.stylecard:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.stylecard.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring); }
.learnedbadge {
  display: inline-block; font-size: 9px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 999px; background: var(--paper-deep); color: var(--muted);
}
.delstyle {
  position: absolute; top: 6px; right: 6px; width: 20px; height: 20px;
  line-height: 19px; text-align: center; border-radius: 50%;
  background: rgba(255,255,255,.95); border: 1px solid var(--line); font-size: 11px; color: var(--muted);
}
.delstyle:hover { background: var(--bad); border-color: var(--bad); color: #fff; }
.swatch { height: 56px; display: flex; align-items: flex-end; padding: 0; position: relative; overflow: hidden; background: #f1f5f9; }
.swatch.style-thumb { height: 84px; align-items: stretch; }
.swatch.style-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  transition: opacity .15s;
}
.swatch.style-thumb svg { width: 100%; height: 100%; display: block; }
.swatch .aa { font-weight: 800; font-size: 18px; line-height: 1; padding: 6px 8px; }
.swatch .chip { position: absolute; top: 6px; right: 6px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(255,255,255,.9); }

.rag-lib-list { max-height: 180px; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.rag-lib-item {
  display: flex; align-items: flex-start; gap: 8px; padding: 8px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 12px;
}
.rag-lib-item .rag-meta { flex: 1; min-width: 0; }
.rag-lib-item .rag-kind {
  display: inline-block; font-size: 9px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; padding: 2px 6px; border-radius: 999px; background: var(--paper-deep); color: var(--muted);
}
.rag-check-list { display: flex; flex-direction: column; gap: 6px; max-height: 160px; overflow: auto; }
.rag-check-list label {
  display: flex; gap: 8px; align-items: flex-start; padding: 8px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; font-size: 12px; cursor: pointer;
}
.rag-check-list label:hover { border-color: var(--accent); }
.yt-url-list { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.yt-url-chip {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: 8px; font-size: 12px; background: #fff;
}
.yt-url-chip button { margin-left: auto; }
.file-chip { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; background: #fff; }
.file-chip--ready { border-color: #86efac; background: #f0fdf4; }
.file-chip--lib { border-color: var(--accent); background: var(--accent-soft, #e4f2f1); }
.file-chip .file-meta { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip button { margin-left: auto; flex: none; }
.rag-lib-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
.rag-refresh-btn { font-size: 11px; padding: 4px 8px; }
.rag-source-summary { margin: 8px 0 0; font-size: 12px; line-height: 1.45; }
.rag-upload-ok {
  margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; font-size: 12px;
  background: #ecfdf5; border: 1px solid #86efac; color: #166534;
}
.rag-lib-item--new { animation: ragFlash 1.2s ease; }
@keyframes ragFlash { from { background: #ecfdf5; } to { background: transparent; } }
.stylecard .name { font-size: 11px; font-weight: 600; color: var(--ink); padding: 5px 8px 1px; }
.stylecard .blurb { font-size: 10px; color: var(--muted); padding: 0 8px 6px; line-height: 1.3; min-height: 22px; }
.stylecard.auto .swatch { background: repeating-linear-gradient(45deg, #eef2ff, #eef2ff 8px, #eff6ff 8px, #eff6ff 16px); }
.stylecard.auto .aa { color: var(--accent); font-size: 14px; }

.tplgrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px; margin-top: 6px; max-height: 260px; overflow: auto; padding: 2px;
}
.tplcard { border: 1.5px solid var(--line); border-radius: 10px; padding: 0; overflow: hidden; cursor: default; background: #fff; text-align: left; }
.tplcard .thumb { display: block; width: 100%; aspect-ratio: 16/9; background: #f8fafc; }
.tplcard .name { font-size: 10.5px; font-weight: 600; color: var(--ink-soft); padding: 6px 8px 8px; line-height: 1.25; }
.tplcard.new { outline: 2px solid var(--accent); outline-offset: -2px; }
.tplmodal { position: fixed; inset: 0; background: rgba(15, 23, 42, .4); z-index: 60; display: flex; align-items: center; justify-content: center; padding: 18px; backdrop-filter: blur(4px); }
.tplmodal .box { background: #fff; border-radius: 16px; width: min(920px, 96vw); max-height: 90vh; overflow: auto; padding: 22px; box-shadow: var(--shadow-lg); }
.tplmodal .tplgrid { max-height: none; }
.tplcard.pickable { cursor: pointer; transition: transform .12s, border-color .12s; }
.tplcard.pickable:hover { transform: translateY(-2px); border-color: var(--accent); }
.tplcard.pickable.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-ring); }

/* ---- Workflow ---- */
.stepper {
  display: flex; gap: 0; margin: 0 28px 16px;
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: #fafbfc;
}
.stepper[hidden] { display: none !important; }
.stepper .st {
  flex: 1; padding: 11px 8px; text-align: center; font-size: 11px; font-weight: 500;
  color: var(--muted); border-right: 1px solid var(--line); background: transparent;
  cursor: pointer; font-family: inherit; transition: background .12s;
}
.stepper .st:hover { background: var(--paper); }
.stepper .st:last-child { border-right: none; }
.stepper .st.done { color: var(--ok); background: var(--ok-soft); }
.stepper .st.now { color: #fff; background: var(--accent); font-weight: 600; }

.acc {
  border: 1px solid var(--line); border-radius: var(--radius);
  margin: 12px 0; background: #fff; overflow: hidden;
}
.acc-head {
  width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; background: #fff; border: none; cursor: pointer;
  font-family: inherit; text-align: left;
}
.acc-head:hover { background: #fafbfc; }
.acc-title { font-size: 14px; color: var(--ink); font-weight: 600; flex: none; }
.acc-badge { font-size: 11px; color: var(--muted); background: var(--paper); border-radius: 999px; padding: 3px 10px; font-weight: 500; }
.acc-now { font-size: 10px; color: #fff; background: var(--accent); border-radius: 999px; padding: 3px 10px; font-weight: 600; }
.acc-chevron { margin-left: auto; color: var(--muted); transition: transform .18s; font-size: 12px; }
.acc.open .acc-chevron { transform: rotate(180deg); }
.acc.open .acc-head { border-bottom: 1px solid var(--line); background: #fafbfc; }
.acc-body { display: none; padding: 16px 18px; }
.acc.open .acc-body { display: block; }
.acc.open { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }

.outline-item, .script-line, .quiz-card, .doc-item {
  border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 14px; margin: 8px 0; background: #fff;
}
.quiz-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.quiz-card-head label { margin: 0; font-weight: 650; }
.quiz-card-num {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--ink, #1a1a2e);
  color: #fff;
  font-size: 13px;
  font-weight: 750;
}
.quiz-opt-num {
  flex: 0 0 auto;
  width: 1.25em;
  font-size: 12px;
  font-weight: 700;
}
.outline-item--edit { cursor: default; }
.outline-drag { cursor: grab !important; }
.outline-drag:active { cursor: grabbing !important; }
.outline-item--edit.outline-dragging { opacity: .55; }
.outline-item--edit.outline-drop {
  border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent);
  background: var(--accent-soft);
}
.outline-row { display: flex; gap: 10px; align-items: flex-start; }
.outline-idx {
  flex: 0 0 auto; width: 24px; height: 24px; margin-top: 8px;
  border-radius: 999px; background: var(--paper-deep, #eef1f5); color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.outline-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.outline-fields .outline-title {
  width: 100%; font-weight: 650; font-size: 14px;
}
.outline-fields .outline-goal {
  width: 100%; min-height: 52px; resize: vertical;
  font-size: 12.5px; line-height: 1.4; color: var(--ink-soft, #3a4a63);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fafbfc;
}
.outline-fields .outline-goal:focus {
  outline: 2px solid rgba(37, 99, 235, .18); border-color: #93b4fd; background: #fff;
}
.outline-controls {
  flex: 0 0 auto; display: flex; flex-direction: column; gap: 4px; align-items: stretch;
}
.outline-btn {
  min-width: 32px; padding: 4px 8px !important; font-size: 12px !important;
  line-height: 1.2; color: var(--muted) !important;
}
.outline-btn:disabled { opacity: .35; cursor: not-allowed; }
.outline-btn-del:hover:not(:disabled) { color: var(--bad, #b91c1c) !important; border-color: #fecaca !important; }
.outline-actions { margin: 10px 0 4px; align-items: center; flex-wrap: wrap; gap: 8px; }
.script-line.dirty { border-color: #fbbf24; background: var(--warn-soft); }
.script-line.narr-warn-line { border-color: #f59e0b; }
.narr-warn {
  display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 999px;
  background: var(--warn-soft); color: var(--warn); margin-left: 6px; font-weight: 600;
}

.voice-pick { display: flex; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; }
.voice-pick button {
  flex: 1; min-width: 140px; text-align: left; padding: 12px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: #fff; cursor: pointer;
}
.voice-pick button .vp-title { display: block; font-size: 13px; font-weight: 600; color: var(--ink); }
.voice-pick button .vp-sub { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.35; }
.voice-pick button.active { border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); }
.voice-pick button:hover { background: var(--paper); }
.voice-pick button.active:hover { background: var(--accent-soft); }

.badge { display: inline-block; font-size: 10px; padding: 2px 8px; border-radius: 999px; margin-left: 6px; font-weight: 600; vertical-align: 1px; }
.badge.grounded { background: var(--ok-soft); color: var(--ok); }
.badge.general { background: var(--warn-soft); color: var(--warn); }

.state {
  display: inline-block; font-size: 10px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px; background: var(--paper-deep); color: var(--muted);
  text-transform: lowercase;
}
.state.AWAITING_SCRIPT_APPROVAL { background: var(--warn-soft); color: var(--warn); }
.state.APPROVED, .state.VOICED, .state.PUBLISHED { background: var(--ok-soft); color: var(--ok); }

.course {
  padding: 10px 12px; border: 1px solid transparent; border-radius: var(--radius-sm);
  margin: 4px 0; cursor: pointer; background: transparent;
  display: flex; align-items: center; gap: 10px;
  transition: background .12s, border-color .12s;
}
.course:hover { background: var(--paper); border-color: var(--line); }
.course.active { background: var(--accent-soft); border-color: var(--accent); outline: none; }
.course.loading { opacity: .92; pointer-events: none; }
.course.loading .meta b::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 8px;
  vertical-align: -2px;
  border: 2px solid var(--accent-ring);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: aga-spin .7s linear infinite;
}
.course .sw { width: 32px; height: 32px; border-radius: 8px; flex: none; border: 1px solid rgba(0,0,0,.06); }
.course .meta { min-width: 0; flex: 1; }
.course .meta b { display: block; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 3px; }
.course .del {
  flex: none; margin: 0; padding: 5px 10px; font-size: 11px;
  background: #fff; color: var(--bad); border-color: #fecaca; opacity: .72;
  transition: opacity .12s, background .12s;
}
.course:hover .del, .course.active .del { opacity: 1; }
.course .del:hover { background: var(--bad-soft); }

.voice-ref-library { border-top: 1px solid var(--line); padding-top: 10px; }
.voice-ref-item {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--paper);
}
.voice-ref-item.on { border-color: var(--accent); background: var(--accent-soft); }
.voice-ref-meta { min-width: 0; flex: 1; }
.voice-ref-meta b { display: block; font-size: 13px; color: var(--ink); }
.voice-ref-meta .muted { font-size: 11px; }
.voice-ref-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.voice-ref-actions .del { opacity: 1; }

textarea { min-height: 72px; resize: vertical; }

/* ---- Empty workspace hero ---- */
.empty-hero {
  text-align: center;
  padding: 48px 32px 56px;
  max-width: 520px;
  margin: 0 auto;
}

.empty-hero-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 16px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-ring);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.empty-hero h3 {
  margin: 0 0 8px;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.02em;
}

.empty-hero p {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.empty-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  text-align: left;
}

.empty-step {
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

.empty-step-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}

.empty-step strong {
  display: block;
  font-size: 12px;
  color: var(--ink);
  margin-bottom: 2px;
}

.empty-step span {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

/* ---- Toasts & overlays ---- */
#msg {
  position: fixed; bottom: 20px; right: 20px; color: #fff;
  padding: 14px 18px; border-radius: var(--radius); font-size: 13px;
  display: none; max-width: min(420px, 92vw); box-shadow: var(--shadow-lg);
  z-index: 40; line-height: 1.45; white-space: pre-wrap; font-weight: 500;
}
#msg.info { background: var(--ink); }
#msg.ok { background: var(--ok); }
#msg.err { background: var(--bad); }
#msg.busy { background: var(--accent); display: flex; align-items: center; gap: 10px; }

#busy {
  position: fixed; inset: 0; background: rgba(241, 245, 249, .75);
  display: none; align-items: center; justify-content: center;
  z-index: 35; backdrop-filter: blur(4px);
}
#busy.open { display: flex; }
#busy .panel {
  background: #fff; border: 1px solid var(--line); border-radius: 16px;
  padding: 28px 32px; box-shadow: var(--shadow-lg);
  min-width: min(360px, 90vw); text-align: center;
}
#busy .spin {
  width: 32px; height: 32px; border: 3px solid var(--line);
  border-top-color: var(--accent); border-radius: 50%;
  margin: 0 auto 14px; animation: aga-spin .7s linear infinite;
}
#busy .label { color: var(--ink); font-size: 16px; font-weight: 600; margin: 0 0 6px; }
#busy .hint { color: var(--muted); font-size: 13px; margin: 0; }
#busy .busy-progress { margin-top: 14px; text-align: left; }
#busy .busy-progress-track {
  height: 8px; border-radius: 999px; background: var(--line);
  overflow: hidden;
}
#busy .busy-progress-fill {
  height: 100%; width: 0%; border-radius: 999px;
  background: var(--accent); transition: width .25s ease;
}
#busy .busy-progress-text {
  margin: 8px 0 0; font-size: 13px; font-weight: 600; color: var(--ink);
  text-align: center;
}
@keyframes aga-spin { to { transform: rotate(360deg); } }

body.is-busy { cursor: progress; }
body.is-busy button:not(.gear):not(.logout):not(.pw-eye) { pointer-events: none; }

#drawer {
  position: fixed; inset: 0 0 0 auto; width: min(440px, 94vw);
  background: #fff; border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg); transform: translateX(105%);
  /* Reason: must sit above sticky .site-header (z-index 50) or the title is clipped under the nav. */
  transition: transform .22s ease; z-index: 60; padding: 0 24px 28px;
  overflow: auto; display: flex; flex-direction: column;
}
#drawer.open { transform: none; }
#drawer .drawer-head {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 20px 0 14px; margin: 0 0 4px;
  background: #fff; border-bottom: 1px solid var(--line);
}
#drawer h2 {
  margin: 0; font-size: 18px; text-transform: none;
  letter-spacing: -.02em; color: var(--ink);
}
#drawer .drawer-cancel {
  border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  border-radius: 999px; padding: 8px 14px; font-size: 13px; font-weight: 600;
  cursor: pointer; flex: none;
}
#drawer .drawer-cancel:hover { background: var(--paper); color: var(--ink); border-color: var(--line-strong); }
#drawer .drawer-foot {
  position: sticky; bottom: 0; z-index: 2;
  margin-top: 16px; padding: 14px 0 4px;
  background: linear-gradient(to top, #fff 70%, rgba(255,255,255,0));
  gap: 8px; flex-wrap: wrap;
}
#overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, .25); display: none; z-index: 55; }
#overlay.open { display: block; }

/* ---- Cute confirm dialog ---- */
.confirm-modal {
  position: fixed; inset: 0; z-index: 80;
  display: flex; align-items: center; justify-content: center;
  padding: 20px; pointer-events: none;
}
.confirm-modal[hidden] { display: none !important; }
.confirm-modal.open { pointer-events: auto; }
.confirm-backdrop {
  position: absolute; inset: 0;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(5px);
  opacity: 0; transition: opacity .2s ease;
}
.confirm-modal.open .confirm-backdrop { opacity: 1; }
.confirm-card {
  position: relative;
  width: min(380px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 24px 20px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  transform: translateY(12px) scale(.96);
  opacity: 0;
  transition: transform .22s cubic-bezier(.22, 1, .36, 1), opacity .2s ease;
}
.confirm-modal.open .confirm-card {
  transform: translateY(0) scale(1);
  opacity: 1;
}
.confirm-illu { margin: 0 auto 14px; width: 56px; height: 56px; }
.confirm-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -.02em;
}
.confirm-body {
  margin: 0 0 22px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--muted);
}
.confirm-actions {
  display: flex; gap: 10px; justify-content: center; flex-wrap: wrap;
}
.confirm-cancel {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
}
.confirm-cancel:hover { background: var(--paper); color: var(--ink); }
.confirm-ok {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 16px var(--accent-ring);
}
.confirm-ok:hover { background: var(--accent-hover); }
.confirm-ok.danger {
  background: #dc2626;
  box-shadow: 0 6px 16px rgba(220, 38, 38, .22);
}
.confirm-ok.danger:hover { background: #b91c1c; }

.gear { border: 1px solid var(--line); background: #fff; }

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .app-shell--library .workspace { padding: 16px; max-width: none; }
  .sidebar {
    position: static; max-height: none; min-height: 0;
    border-right: none; border-bottom: 1px solid var(--line);
  }
  .workspace { padding: 16px; }
  .workspace-panel { min-height: 400px; }
  .empty-steps { grid-template-columns: 1fr; }
  .site-header {
    padding: 0 12px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    height: auto;
    min-height: var(--header-h);
    padding-bottom: 10px;
  }
  .brand { grid-column: 1; grid-row: 1; }
  .account {
    grid-column: 2; grid-row: 1;
    border-left: 0; padding-left: 0;
  }
  .site-nav {
    grid-column: 1 / -1; grid-row: 2;
    justify-self: stretch;
    flex-wrap: wrap;
    justify-content: center;
    padding-top: 4px;
  }
  .nav-pill { padding: 7px 10px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .acc-chevron, #drawer, .stylecard { transition: none; }
  #busy .spin { animation: none; border-top-color: var(--accent); }
}
