:root {
  color-scheme: dark;
  --bg: #0a0b0d;
  --panel: rgba(20, 22, 25, 0.88);
  --panel-solid: #141619;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #f4f2eb;
  --muted: #91969d;
  --dim: #646970;
  --acid: #c8ff31;
  --acid-soft: rgba(200, 255, 49, 0.12);
  --orange: #ff7a45;
  --cyan: #63d8ff;
  --danger: #ff6b70;
  --radius: 18px;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(rgba(255,255,255,.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.018) 1px, transparent 1px),
    var(--bg);
  background-size: 48px 48px;
  overflow-x: hidden;
}

button, input { font: inherit; }
textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--acid); outline-offset: 3px; }
.hidden { display: none !important; }

.ambient { position: fixed; border-radius: 999px; filter: blur(120px); opacity: .16; pointer-events: none; }
.ambient-one { width: 480px; height: 480px; right: -170px; top: 150px; background: var(--acid); }
.ambient-two { width: 420px; height: 420px; left: -250px; top: 620px; background: #4e7cff; opacity: .1; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  height: 76px; padding: 0 4vw;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 11, 13, .78); backdrop-filter: blur(22px);
}
.brand { color: var(--text); text-decoration: none; display: flex; align-items: center; gap: 13px; letter-spacing: -.02em; }
.brand b { font-size: 15px; letter-spacing: .11em; }
.brand em { color: var(--muted); font-style: normal; font-size: 14px; letter-spacing: .07em; }
.brand-mark { width: 30px; height: 30px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; transform: skewY(-10deg); }
.brand-mark i { display: block; background: var(--acid); border-radius: 2px; }
.brand-mark i:nth-child(2) { opacity: .58; transform: translateY(4px); }
.brand-mark i:nth-child(3) { opacity: .28; transform: translateY(8px); }
.top-actions { display: flex; align-items: center; gap: 18px; }
.main-nav { display: flex; align-items: center; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.025); }
.nav-tab { border: 0; background: transparent; color: var(--muted); padding: 9px 13px; border-radius: 8px; font-size: 11px; cursor: pointer; white-space: nowrap; text-decoration: none; }
.nav-tab:hover { color: var(--text); }
.nav-tab.active { color: #11140b; background: var(--acid); font-weight: 750; }
.nav-tab span { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: 999px; background: rgba(0,0,0,.16); font-size: 9px; }
.user-switcher { display: grid; gap: 2px; }
.user-switcher > span { color: var(--dim); font-size: 8px; letter-spacing: .08em; text-transform: uppercase; }
.user-switcher select { max-width: 156px; border: 0; background: transparent; color: var(--text); font-size: 11px; outline: 0; cursor: pointer; }
.user-switcher option { background: var(--panel-solid); }
.service-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; letter-spacing: .04em; }
.service-status i { width: 7px; height: 7px; border-radius: 50%; background: #f0b84b; box-shadow: 0 0 12px #f0b84b; }
.service-status.online i { background: var(--acid); box-shadow: 0 0 12px var(--acid); }
.ghost-button, .icon-button {
  border: 1px solid var(--line); background: rgba(255,255,255,.035); border-radius: 11px; cursor: pointer;
}
.ghost-button { padding: 10px 14px; font-size: 12px; color: #d9d9d5; }
.ghost-button span { color: var(--acid); margin-left: 8px; }
.ghost-button:hover, .icon-button:hover { border-color: var(--line-strong); background: rgba(255,255,255,.07); }

main { width: min(1480px, 92vw); margin: 0 auto; }
.hero { padding: 88px 0 52px; position: relative; }
.eyebrow, .section-kicker { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .19em; text-transform: uppercase; }
.eyebrow span { color: var(--acid); }
.hero h1 { font-size: clamp(48px, 6.1vw, 92px); line-height: .96; letter-spacing: -.065em; margin: 23px 0 24px; font-weight: 760; }
.hero h1 span { color: transparent; -webkit-text-stroke: 1px rgba(244,242,235,.58); }
.hero > p { margin: 0 0 36px; color: var(--muted); font-size: 17px; line-height: 1.7; max-width: 700px; }

.search-box {
  min-height: 76px; padding: 9px 10px 9px 22px; display: flex; align-items: center; gap: 15px;
  background: rgba(22,24,27,.94); border: 1px solid var(--line-strong); border-radius: 20px;
  box-shadow: 0 28px 80px rgba(0,0,0,.32);
}
.search-box:focus-within { border-color: rgba(200,255,49,.42); box-shadow: 0 24px 80px rgba(0,0,0,.38), 0 0 0 4px rgba(200,255,49,.04); }
.search-icon { width: 18px; height: 18px; border: 2px solid var(--muted); border-radius: 50%; position: relative; flex: 0 0 auto; }
.search-icon::after { content: ""; width: 7px; height: 2px; background: var(--muted); position: absolute; right: -5px; bottom: -2px; transform: rotate(45deg); border-radius: 1px; }
.search-box input { flex: 1; min-width: 120px; border: 0; background: transparent; color: var(--text); font-size: 15px; outline: 0; }
.search-box input::placeholder { color: #6f747b; }
.mode-switch { display: flex; padding: 4px; border-radius: 12px; background: #0d0e10; border: 1px solid var(--line); }
.mode { border: 0; background: transparent; padding: 9px 12px; color: var(--dim); border-radius: 8px; font-size: 11px; cursor: pointer; white-space: nowrap; }
.mode.active { color: var(--text); background: #25282c; box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.primary-button { border: 0; background: var(--acid); color: #11140b; border-radius: 12px; min-height: 48px; padding: 0 19px; display: inline-flex; align-items: center; justify-content: center; gap: 13px; font-weight: 750; cursor: pointer; }
.primary-button b { opacity: .48; font-size: 10px; }
.primary-button:hover { filter: brightness(1.07); transform: translateY(-1px); }
.primary-button:disabled { opacity: .45; cursor: wait; transform: none; }
.primary-button.wide { width: 100%; margin-top: 8px; }
.primary-button.compact { min-height: 40px; padding: 0 14px; font-size: 11px; }
.quick-searches { margin-top: 18px; display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.quick-searches > span { color: var(--dim); font-size: 11px; margin-right: 5px; }
.quick-searches button { border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 7px 10px; border-radius: 999px; font-size: 11px; cursor: pointer; }
.quick-searches button:hover { border-color: rgba(200,255,49,.35); color: var(--acid); }

.dashboard { display: grid; grid-template-columns: repeat(5, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: rgba(18,20,22,.72); }
.metric { padding: 21px 24px; min-height: 112px; position: relative; border-right: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; align-items: center; }
.metric:last-child { border-right: 0; }
.metric > span { color: var(--muted); font-size: 11px; letter-spacing: .05em; }
.metric strong { grid-row: 1 / 3; grid-column: 2; font-size: 30px; letter-spacing: -.04em; }
.metric small { color: var(--dim); font-size: 10px; align-self: end; }
.accent-metric { background: var(--acid-soft); }
.accent-metric strong { color: var(--acid); font-size: 21px; letter-spacing: .06em; }

.filter-bar { display: flex; gap: 7px; flex-wrap: wrap; margin: -5px 0 18px; }
.filter { border: 1px solid var(--line); background: transparent; color: var(--muted); padding: 8px 11px; border-radius: 999px; font-size: 10px; cursor: pointer; }
.filter:hover { border-color: var(--line-strong); color: var(--text); }
.filter.active { border-color: rgba(200,255,49,.35); background: var(--acid-soft); color: var(--acid); }

.workspace-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; padding: 62px 0 80px; }
.results-panel, .library-panel { min-width: 0; }
.library-panel { position: sticky; top: 96px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(18,20,22,.88); padding: 22px; max-height: calc(100vh - 120px); overflow: auto; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 20px; }
.section-heading.compact { align-items: center; }
.section-heading h2 { font-size: 25px; margin: 6px 0 0; letter-spacing: -.035em; }
.section-meta { color: var(--dim); font-size: 11px; text-align: right; }
.icon-button { width: 34px; height: 34px; color: var(--muted); }
.library-note { color: var(--dim); font-size: 11px; line-height: 1.6; margin: -8px 0 18px; }
.warnings { color: #e3b35d; border: 1px solid rgba(227,179,93,.2); background: rgba(227,179,93,.07); border-radius: 10px; padding: 10px 13px; font-size: 11px; margin-bottom: 14px; }

.result-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.result-card { border: 1px solid var(--line); background: var(--panel); border-radius: 15px; padding: 18px; min-height: 230px; display: flex; flex-direction: column; transition: border-color .2s, transform .2s, background .2s; }
.result-card:hover { border-color: rgba(200,255,49,.28); transform: translateY(-2px); background: rgba(25,28,31,.95); }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
.repo-badge { max-width: 70%; color: var(--muted); font: 10px ui-monospace, SFMono-Regular, Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trust-badge { color: var(--acid); background: var(--acid-soft); padding: 5px 7px; border-radius: 6px; font-size: 9px; letter-spacing: .08em; }
.neutral-badge { color: var(--muted); background: rgba(255,255,255,.04); padding: 5px 7px; border-radius: 6px; font-size: 9px; letter-spacing: .08em; }
.status-badge { display: inline-flex; width: fit-content; padding: 5px 8px; border-radius: 7px; font-size: 9px; letter-spacing: .05em; border: 1px solid var(--line); }
.status-draft { color: #a9adb2; background: rgba(169,173,178,.08); }
.status-pending { color: #f0b84b; background: rgba(240,184,75,.1); border-color: rgba(240,184,75,.22); }
.status-approved { color: var(--acid); background: var(--acid-soft); border-color: rgba(200,255,49,.22); }
.status-changes_requested { color: var(--orange); background: rgba(255,122,69,.1); border-color: rgba(255,122,69,.2); }
.status-rejected { color: var(--danger); background: rgba(255,107,112,.1); border-color: rgba(255,107,112,.2); }
.favorite-button { border: 0; background: transparent; color: var(--dim); font-size: 20px; cursor: pointer; line-height: 1; }
.favorite-button:hover, .favorite-button.active { color: #ff7180; }
.result-card h3 { margin: 0 0 10px; font-size: 17px; line-height: 1.28; letter-spacing: -.025em; overflow-wrap: anywhere; }
.path { color: var(--dim); font: 10px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.description { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.55; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-facts { display: flex; gap: 8px; flex-wrap: wrap; margin: 15px 0; }
.fact { border: 1px solid var(--line); color: var(--muted); border-radius: 7px; padding: 5px 7px; font-size: 9px; }
.card-actions { margin-top: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.card-actions.single-action { grid-template-columns: 1fr; }
.secondary-button, .save-button { border-radius: 9px; min-height: 38px; cursor: pointer; font-size: 11px; font-weight: 650; }
.secondary-button { border: 1px solid var(--line); background: rgba(255,255,255,.025); color: #d3d4d1; }
.secondary-button:hover { border-color: var(--line-strong); }
.save-button { border: 1px solid rgba(200,255,49,.28); background: var(--acid-soft); color: var(--acid); }
.save-button:hover { background: rgba(200,255,49,.18); }
.save-button.saved { color: var(--muted); border-color: var(--line); background: transparent; cursor: default; }

.skeleton { min-height: 230px; border-radius: 15px; border: 1px solid var(--line); background: linear-gradient(100deg, rgba(255,255,255,.025) 20%, rgba(255,255,255,.065) 40%, rgba(255,255,255,.025) 60%); background-size: 240% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position-x: -240%; } }
.empty-state { border: 1px dashed var(--line-strong); padding: 75px 20px; text-align: center; border-radius: var(--radius); color: var(--muted); }
.empty-state h3 { color: var(--text); margin: 20px 0 8px; }
.empty-state p { font-size: 12px; }
.empty-orbit { width: 46px; height: 46px; margin: auto; border: 1px solid var(--line-strong); border-radius: 50%; position: relative; }
.empty-orbit::before { content: ""; position: absolute; inset: 9px; border: 1px solid var(--line-strong); border-radius: 50%; }
.empty-orbit i { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--acid); top: -3px; left: 19px; }

.library-list { display: flex; flex-direction: column; gap: 9px; }
.library-item { background: #101214; border: 1px solid var(--line); border-radius: 12px; padding: 13px; }
.library-title { display: flex; align-items: start; gap: 10px; }
.format-dot { flex: 0 0 auto; width: 25px; height: 25px; border-radius: 7px; display: grid; place-items: center; background: var(--acid-soft); color: var(--acid); font: 9px ui-monospace, monospace; text-transform: uppercase; }
.library-title h4 { margin: 1px 0 5px; font-size: 12px; line-height: 1.3; }
.library-title p { margin: 0; color: var(--dim); font: 9px ui-monospace, monospace; }
.library-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.library-actions span { font-size: 9px; color: var(--dim); }
.library-actions div { display: flex; gap: 7px; }
.library-actions a, .library-actions button { color: var(--muted); border: 0; background: transparent; text-decoration: none; cursor: pointer; font-size: 10px; padding: 2px; }
.library-actions a:hover { color: var(--acid); }
.library-actions button:hover { color: var(--danger); }
.library-empty { padding: 42px 12px; text-align: center; border: 1px dashed var(--line); border-radius: 12px; }
.library-empty span { display: grid; place-items: center; width: 36px; height: 36px; margin: auto; border: 1px solid var(--line); border-radius: 10px; color: var(--acid); }
.library-empty p { margin: 13px 0 4px; font-size: 12px; }
.library-empty small { color: var(--dim); font-size: 10px; }

.user-card { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 13px; background: #101214; }
.avatar { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 12px; background: var(--acid); color: #11140b; font-weight: 800; font-size: 16px; }
.user-card strong { display: block; font-size: 12px; }
.user-card div span { display: block; color: var(--muted); font-size: 9px; margin-top: 4px; }
.role-badge { font-style: normal; color: var(--muted); border: 1px solid var(--line); padding: 5px 7px; border-radius: 7px; font-size: 8px; }
.role-reviewer { color: var(--cyan); border-color: rgba(99,216,255,.25); }
.role-admin { color: var(--acid); border-color: rgba(200,255,49,.25); }
.side-divider { height: 1px; background: var(--line); margin: 18px 0; }
.activity-item { width: 100%; display: grid; grid-template-columns: 8px 1fr; gap: 10px; align-items: start; text-align: left; border: 1px solid var(--line); background: #101214; border-radius: 11px; padding: 12px; color: var(--text); cursor: pointer; }
.activity-item:hover { border-color: var(--line-strong); }
.activity-item strong { display: block; font-size: 11px; line-height: 1.3; }
.activity-item small { display: block; color: var(--dim); font-size: 8px; margin-top: 5px; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 3px; background: var(--muted); }
.status-dot.status-approved { background: var(--acid); }
.status-dot.status-pending { background: #f0b84b; }
.status-dot.status-rejected, .status-dot.status-changes_requested { background: var(--danger); }

footer { width: min(1480px, 92vw); margin: 0 auto; padding: 25px 0 36px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; color: var(--dim); font-size: 9px; letter-spacing: .08em; }
footer p { margin: 0; letter-spacing: 0; }

.drawer-backdrop, .modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.65); backdrop-filter: blur(8px); z-index: 70; }
.drawer { position: fixed; z-index: 80; right: 0; top: 0; width: min(620px, 94vw); height: 100vh; background: #111315; border-left: 1px solid var(--line-strong); transform: translateX(102%); transition: transform .28s ease; overflow: auto; padding: 54px 36px 42px; box-shadow: -30px 0 80px rgba(0,0,0,.45); }
.drawer.open { transform: translateX(0); }
.drawer-close, .modal-close { position: absolute; right: 22px; top: 18px; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--muted); cursor: pointer; font-size: 20px; }
.drawer h2 { font-size: 32px; letter-spacing: -.04em; margin: 10px 0 12px; overflow-wrap: anywhere; }
.drawer-title-row { display: flex; justify-content: space-between; align-items: center; color: var(--dim); font-size: 10px; margin-bottom: 13px; }
.drawer-description { color: var(--muted); font-size: 12px; line-height: 1.65; }
.drawer-loading { color: var(--muted); padding: 80px 0; text-align: center; }
.drawer-source { color: var(--muted); font: 10px/1.5 ui-monospace, monospace; overflow-wrap: anywhere; }
.drawer-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 25px 0; }
.drawer-stat { padding: 13px; background: #0c0e10; border: 1px solid var(--line); border-radius: 10px; }
.drawer-stat span { color: var(--dim); font-size: 9px; }
.drawer-stat strong { display: block; margin-top: 7px; font-size: 14px; color: #e9e8e2; overflow-wrap: anywhere; }
.detail-block { margin-top: 26px; }
.detail-block h3 { font-size: 11px; letter-spacing: .09em; color: var(--muted); text-transform: uppercase; }
.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 6px 8px; border-radius: 7px; background: rgba(255,255,255,.045); border: 1px solid var(--line); color: #bfc2c4; font: 9px ui-monospace, monospace; }
.compact-chips { margin-top: 13px; min-height: 27px; }
.muted-chip { color: var(--dim); }
.drawer-actions { display: grid; grid-template-columns: 1fr auto; gap: 9px; margin-top: 30px; }
.drawer-actions a { display: grid; place-items: center; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); text-decoration: none; padding: 0 17px; font-size: 11px; }
.version-list, .review-history { display: flex; flex-direction: column; gap: 8px; }
.version-item { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); background: #0c0e10; border-radius: 10px; }
.version-item strong { display: inline-block; min-width: 34px; color: var(--acid); font-size: 11px; }
.version-item span { color: var(--text); font-size: 10px; }
.version-item small { display: block; color: var(--dim); font: 8px/1.45 ui-monospace, monospace; margin-top: 5px; }
.version-item button { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 7px; padding: 7px 9px; font-size: 9px; cursor: pointer; }
.version-item button:hover { color: var(--acid); border-color: rgba(200,255,49,.28); }
.review-history > div { padding: 12px; border-left: 2px solid var(--line-strong); background: rgba(255,255,255,.02); }
.review-history p { margin: 8px 0; color: #c6c7c4; font-size: 10px; line-height: 1.5; }
.review-history small, .muted-copy { color: var(--dim); font-size: 9px; }
.drawer-action-stack { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--line); }
.drawer-action-stack button { min-height: 44px; }

.modal-backdrop { display: grid; place-items: center; padding: 20px; }
.modal-card { position: relative; width: min(560px, 100%); background: #151719; border: 1px solid var(--line-strong); border-radius: 20px; padding: 34px; box-shadow: 0 30px 100px rgba(0,0,0,.55); }
.modal-card h2 { margin: 9px 0; font-size: 28px; letter-spacing: -.04em; }
.modal-card > p { color: var(--muted); font-size: 12px; line-height: 1.65; }
.modal-card label span { display: block; color: var(--muted); font-size: 10px; margin: 24px 0 8px; }
.modal-card input { width: 100%; height: 50px; border: 1px solid var(--line); border-radius: 10px; background: #0d0f11; color: var(--text); padding: 0 13px; outline: 0; }
.modal-card textarea, .modal-card select { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: #0d0f11; color: var(--text); padding: 12px 13px; outline: 0; resize: vertical; }
.modal-card select { height: 50px; }
.modal-card input:focus, .modal-card textarea:focus, .modal-card select:focus { border-color: rgba(200,255,49,.42); }
.script-dropzone { margin-top: 22px; min-height: 132px; display: grid; place-items: center; align-content: center; gap: 5px; padding: 20px; border: 1px dashed var(--line-strong); border-radius: 13px; background: rgba(200,255,49,.025); color: var(--muted); text-align: center; cursor: pointer; outline: 0; transition: border-color .18s ease, background .18s ease, transform .18s ease; }
.script-dropzone:hover, .script-dropzone:focus-visible, .script-dropzone.dragging { border-color: rgba(200,255,49,.7); background: rgba(200,255,49,.075); }
.script-dropzone.dragging { transform: scale(1.008); }
.script-dropzone.uploading { pointer-events: none; opacity: .72; }
.script-dropzone-icon { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--acid-soft); color: var(--acid); font-size: 17px; }
.script-dropzone strong { color: var(--text); font-size: 12px; }
.script-dropzone small { color: var(--dim); font-size: 9px; }
.script-dropzone em { margin-top: 5px; color: var(--acid); font-size: 9px; font-style: normal; }
.script-dropzone.error em { color: #ff6f6f; }
.modal-large { width: min(760px, 100%); max-height: 92vh; overflow: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .span-2 { grid-column: 1 / -1; }
.modal-close { right: 16px; top: 16px; }
.toast { position: fixed; left: 50%; bottom: 25px; z-index: 100; transform: translate(-50%, 30px); opacity: 0; pointer-events: none; padding: 12px 17px; border-radius: 10px; background: #e9e8df; color: #171812; font-size: 11px; font-weight: 650; box-shadow: 0 15px 60px rgba(0,0,0,.45); transition: .25s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { background: #ff777b; color: #1a0a0b; }

/* Director console */
.director-workspace { padding: 38px 0 70px; }
.director-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 24px; }
.director-header h1 { margin: 7px 0 4px; font-size: 38px; letter-spacing: -.055em; }
.director-header p { margin: 0; color: var(--muted); font-size: 12px; }
.director-project-actions { display: flex; align-items: end; gap: 8px; }
.director-project-actions label { display: grid; gap: 6px; }
.director-project-actions label span, .generation-strip label span, .shot-fields label span { color: var(--dim); font-size: 8px; letter-spacing: .09em; text-transform: uppercase; }
.director-project-actions select, .generation-strip select, .generation-strip input, .shot-fields input, .shot-fields textarea { border: 1px solid var(--line); border-radius: 9px; background: #101214; color: var(--text); min-height: 42px; padding: 8px 11px; outline: 0; }
.director-empty { min-height: 440px; display: grid; place-items: center; align-content: center; text-align: center; border: 1px dashed var(--line-strong); border-radius: 18px; background: rgba(255,255,255,.018); }
.director-empty strong { font-size: 24px; }
.director-empty p { color: var(--muted); max-width: 600px; line-height: 1.7; }
.director-board { min-height: 720px; display: grid; grid-template-columns: 265px minmax(480px, 1fr) 330px; border: 1px solid var(--line-strong); border-radius: 18px; overflow: hidden; background: #0d0f11; box-shadow: 0 35px 100px rgba(0,0,0,.25); }
.director-scenes, .director-modules { background: #111315; min-width: 0; }
.director-scenes { border-right: 1px solid var(--line); }
.director-modules { border-left: 1px solid var(--line); }
.director-panel-heading { min-height: 70px; padding: 16px 18px; display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.director-panel-heading > span { display: block; color: var(--acid); font: 8px ui-monospace, monospace; letter-spacing: .14em; }
.director-panel-heading > strong { margin-right: auto; font-size: 12px; }
.director-panel-heading > button, .director-panel-heading > i { border: 0; background: transparent; color: var(--muted); font-size: 9px; font-style: normal; cursor: pointer; }
.director-scene { border-bottom: 1px solid var(--line); }
.director-scene-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: stretch; }
.director-scene-select { width: 100%; border: 0; background: transparent; color: var(--text); padding: 13px 8px 13px 14px; display: grid; grid-template-columns: 28px 1fr; text-align: left; cursor: pointer; }
.director-scene-select i { color: var(--dim); font: 9px ui-monospace, monospace; }
.director-scene-select strong { display: block; font-size: 11px; }
.director-scene-select small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--dim); font-size: 8px; line-height: 1.5; margin-top: 5px; }
.director-scene.active .director-scene-row { background: var(--acid-soft); }
.director-shot-list { padding: 0 10px 10px 42px; display: grid; gap: 4px; }
.director-shot-row { display: grid; grid-template-columns: minmax(0, 1fr) 25px; align-items: stretch; }
.director-shot-list .director-shot-select { border: 0; border-left: 1px solid var(--line-strong); background: transparent; color: var(--muted); text-align: left; padding: 7px 8px; font-size: 9px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.director-shot-list .director-shot-select span { color: var(--dim); margin-right: 7px; font-family: ui-monospace, monospace; }
.director-shot-list .director-shot-select.active { border-color: var(--acid); color: var(--text); background: rgba(200,255,49,.04); }
.director-delete-button { border: 0; background: transparent; color: var(--dim); font-size: 8px; cursor: pointer; opacity: .7; }
.director-delete-button:hover, .director-delete-button:focus-visible { color: var(--danger); opacity: 1; background: rgba(255, 88, 88, .08); outline: 1px solid rgba(255, 88, 88, .3); }
.director-scene-row > .director-delete-button { padding: 0 9px; }
.director-add-shot, .director-add-module { margin: 13px; width: calc(100% - 26px); min-height: 38px; border: 1px dashed var(--line-strong); border-radius: 9px; color: var(--muted); background: transparent; cursor: pointer; font-size: 9px; }
.director-stage { padding: 18px; min-width: 0; background: radial-gradient(circle at 50% 15%, rgba(99,216,255,.05), transparent 35%); }
.director-breadcrumb { display: flex; gap: 8px; color: var(--dim); font-size: 9px; margin: 0 0 13px; overflow: hidden; }
.director-breadcrumb strong { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.director-frame { aspect-ratio: 16/9; display: grid; place-items: center; border: 1px solid var(--line-strong); background: linear-gradient(145deg,#171b20,#090b0d); position: relative; overflow: hidden; }
.director-frame::before, .director-frame::after { content: ""; position: absolute; inset: 10%; border: 1px solid rgba(255,255,255,.07); }
.director-frame::after { inset: 0 33%; border-top: 0; border-bottom: 0; }
.frame-safe { text-align: center; z-index: 1; }
.frame-safe span { color: var(--acid); font: 8px ui-monospace, monospace; letter-spacing: .18em; }
.frame-safe strong { display: block; font-size: clamp(18px,2vw,30px); margin-top: 10px; }
.frame-safe p { color: var(--dim); font-size: 9px; }
.shot-fields { display: grid; grid-template-columns: 1fr 120px; gap: 9px; margin-top: 13px; }
.shot-fields label { display: grid; gap: 5px; }
.shot-fields .span-2 { grid-column: 1/-1; }
.shot-fields textarea { resize: vertical; }
.prompt-monitor { margin-top: 13px; border: 1px solid var(--line); background: #090b0c; }
.prompt-monitor > div { padding: 8px 11px; display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); color: var(--acid); font: 8px ui-monospace, monospace; }
.prompt-monitor button { border: 0; background: transparent; color: var(--muted); font-size: 8px; cursor: pointer; }
.prompt-monitor pre { margin: 0; padding: 12px; max-height: 170px; overflow: auto; white-space: pre-wrap; color: #b6bbc0; font: 9px/1.65 ui-monospace, monospace; }
.generation-strip { display: grid; grid-template-columns: minmax(0, 1fr) 120px; gap: 8px; margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }
.generation-strip label { display: grid; gap: 5px; }
.director-workflow-fields { grid-column: 1/-1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.workflow-source-note { min-height: 13px; color: var(--dim); font-size: 8px; line-height: 1.45; }
.generation-buttons { grid-column: 1/-1; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.generation-buttons .primary-button { min-height: 42px; font-size: 10px; }
.director-agent { margin-top: 16px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(135deg, rgba(102, 72, 255, .08), rgba(10, 12, 14, .94) 38%); padding: 14px; }
.director-agent-command { display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 10px; }
.director-agent-command textarea { min-height: 76px; resize: vertical; border: 1px solid var(--line); border-radius: 11px; background: #0d0f11; color: var(--text); padding: 11px 13px; outline: 0; line-height: 1.55; }
.director-agent-command textarea:focus { border-color: #725cff; box-shadow: 0 0 0 3px rgba(114, 92, 255, .12); }
.director-agent-hint { margin: 7px 0 12px; color: var(--dim); font-size: 9px; }
.director-agent-runs { display: grid; gap: 8px; }
.agent-run { border: 1px solid rgba(255,255,255,.08); border-radius: 11px; background: rgba(7,9,10,.75); padding: 10px 11px; }
.agent-run > header { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 9px; align-items: start; }
.agent-run > header p { margin: 1px 0 0; color: var(--text); font-size: 11px; line-height: 1.45; }
.agent-run > header time { color: var(--dim); font-size: 8px; }
.agent-run-status { border-radius: 999px; padding: 3px 7px; background: #23262a; color: var(--muted); font-size: 8px; text-transform: uppercase; }
.agent-run-status.completed { background: rgba(36,178,111,.17); color: #66dfa5; }
.agent-run-status.failed { background: rgba(230,74,74,.16); color: #ff8585; }
.agent-run-status.waiting { background: rgba(239,171,52,.15); color: #f4bd61; }
.agent-run-status.running, .agent-run-status.queued, .agent-run-status.cancelling { background: rgba(90,115,255,.17); color: #91a1ff; }
.agent-run ol { margin: 8px 0 0 22px; padding: 0; color: var(--dim); font-size: 9px; }
.agent-run li { padding: 2px 0; }
.agent-run li.completed { color: #72cfa6; }
.agent-run li.running { color: #aab5ff; }
.agent-run li.waiting, .agent-run-error { color: #eec06b; }
.agent-run-error { margin: 7px 0 0; font-size: 9px; }
.agent-run footer { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; color: var(--dim); font-size: 8px; }
.agent-run footer button { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 7px; padding: 4px 7px; }
.director-module-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.director-module-tabs button { position: relative; min-height: 61px; border: 0; background: #111315; color: var(--muted); text-align: left; padding: 10px 12px; cursor: pointer; }
.director-module-tabs button span { display: block; color: var(--dim); font: 7px ui-monospace, monospace; }
.director-module-tabs button strong { font-size: 10px; }
.director-module-tabs button i { position: absolute; right: 9px; top: 9px; font: 8px ui-monospace, monospace; }
.director-module-tabs button.active { background: var(--acid-soft); color: var(--acid); }
.director-module-list { max-height: 600px; overflow: auto; padding: 10px; }
.director-module-card { border: 1px solid var(--line); background: #0c0e10; padding: 11px; margin-bottom: 8px; }
.director-module-card > div { display: flex; justify-content: space-between; color: var(--dim); font-size: 8px; }
.director-module-card input.module-name, .director-module-card textarea { width: 100%; border: 1px solid var(--line); background: #111315; color: var(--text); padding: 8px; margin-top: 7px; font-size: 9px; resize: vertical; outline: 0; }
.director-module-card input.module-name { font-size: 11px; font-weight: 700; }
.director-module-card > button { margin-top: 8px; border: 0; background: transparent; color: var(--danger); font-size: 8px; cursor: pointer; }
.module-reference span { display: block; color: var(--dim); font-size: 8px; margin-top: 8px; }
.module-empty, .director-job-empty { padding: 28px 14px; color: var(--dim); text-align: center; font-size: 9px; line-height: 1.6; }
.director-jobs { margin-top: 16px; border: 1px solid var(--line-strong); border-radius: 15px; background: #111315; overflow: hidden; }
.director-job { display: grid; grid-template-columns: 92px 1fr auto; gap: 14px; align-items: center; padding: 13px 18px; border-top: 1px solid var(--line); }
.director-job:first-child { border-top: 0; }
.job-status { padding: 6px 8px; text-align: center; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font: 8px ui-monospace, monospace; }
.job-submitted { color: var(--acid); border-color: rgba(200,255,49,.3); }
.job-failed { color: var(--danger); }
.director-job strong { display: block; font-size: 10px; }
.director-job small, .director-job p, .director-job time { color: var(--dim); font-size: 8px; }
.director-job p { margin: 4px 0 0; }
.director-job-actions { display: grid; justify-items: end; gap: 7px; }
.director-job-actions button { border: 0; background: transparent; color: var(--dim); padding: 4px 6px; font-size: 8px; cursor: pointer; }
.director-job-actions button:hover, .director-job-actions button:focus-visible { color: var(--danger); background: rgba(255, 88, 88, .08); outline: 1px solid rgba(255, 88, 88, .3); }

@media (max-width: 1260px) {
  .director-board { grid-template-columns: 220px minmax(420px,1fr); }
  .director-modules { grid-column: 1/-1; border-left: 0; border-top: 1px solid var(--line); }
  .director-module-tabs { grid-template-columns: repeat(6,1fr); }
  .director-module-list { display: grid; grid-template-columns: repeat(2,1fr); gap: 8px; max-height: none; }
}
@media (max-width: 820px) {
  .director-header, .director-project-actions { align-items: stretch; flex-direction: column; }
  .director-board { display: block; }
  .director-scenes { border-right: 0; border-bottom: 1px solid var(--line); }
  .director-stage { padding: 12px; }
  .director-module-tabs { grid-template-columns: repeat(3,1fr); }
  .director-module-list { grid-template-columns: 1fr; }
  .generation-strip { grid-template-columns: 1fr; }
  .director-workflow-fields { grid-template-columns: 1fr; }
  .generation-buttons { grid-column: auto; }
  .director-agent-command { grid-template-columns: 1fr; }
  .director-job { grid-template-columns: 1fr; }
}

@media (max-width: 1040px) {
  .topbar { height: auto; min-height: 76px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .main-nav { order: 3; width: 100%; }
  .nav-tab { flex: 1; }
  .dashboard { grid-template-columns: repeat(3, 1fr); }
  .metric { border-bottom: 1px solid var(--line); }
  .metric:nth-child(3) { border-right: 0; }
  .metric:nth-child(n+4) { border-bottom: 0; }
  .workspace-grid { grid-template-columns: 1fr; }
  .library-panel { position: static; max-height: none; }
  .library-list { display: grid; grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .topbar { padding: 0 20px; }
  .service-status { display: none; }
  .brand em, .user-switcher > span { display: none; }
  .top-actions { gap: 8px; }
  .user-switcher select { max-width: 100px; }
  .primary-button.compact { font-size: 0; min-width: 42px; padding: 0 11px; }
  .primary-button.compact b { font-size: 15px; }
  main { width: min(92vw, 620px); }
  .hero { padding-top: 60px; }
  .hero h1 { font-size: 48px; }
  .search-box { flex-wrap: wrap; padding: 14px; }
  .search-box input { width: calc(100% - 42px); height: 36px; }
  .mode-switch { flex: 1; }
  .mode { flex: 1; }
  .search-box .primary-button { flex: 0 0 110px; }
  .result-grid, .library-list { grid-template-columns: 1fr; }
  .dashboard { grid-template-columns: 1fr 1fr; }
  .metric { padding: 16px; min-height: 92px; }
  .metric strong { font-size: 24px; }
  footer p { display: none; }
  .drawer { padding: 52px 22px 32px; }
  .drawer-grid { grid-template-columns: 1fr 1fr; }
  .drawer-action-stack { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
}
@media (max-width: 460px) {
  .topbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .brand { min-width: 0; }
  .brand b { font-size: 14px; }
  .top-actions { min-width: 0; }
  .top-actions .ghost-button { display: none; }
  .user-switcher select { width: 92px; max-width: 92px; text-overflow: ellipsis; }
  .main-nav { grid-column: 1 / -1; }
  .ghost-button { font-size: 0; }
  .ghost-button span { font-size: 15px; margin: 0; }
  .hero h1 { font-size: 34px; line-height: 1.02; letter-spacing: -.05em; overflow-wrap: anywhere; }
  .hero > p { font-size: 14px; }
  .search-box { gap: 9px; }
  .mode { padding: 9px 7px; }
  .search-box .primary-button { flex-basis: 86px; padding: 0 11px; }
  .dashboard { grid-template-columns: 1fr; }
  .metric { border-right: 0; border-bottom: 1px solid var(--line); }
  .metric:last-child { border-bottom: 0; }
}
