:root {
  color-scheme: dark;
  --bg: #07121a;
  --panel: #0b1a24;
  --panel-2: #10232e;
  --line: rgba(196, 222, 234, .13);
  --text: #f4f8fa;
  --muted: #8ea3af;
  --cyan: #60d8ed;
  --gold: #ffc857;
  --blue: #5865f2;
  --green: #43d394;
  --red: #ff7272;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); }
body { margin: 0; color: var(--text); background: radial-gradient(circle at 80% 0, rgba(38, 111, 143, .16), transparent 34%), var(--bg); }
button, input, textarea, select { font: inherit; }
a { color: inherit; text-decoration: none; }
button, a { -webkit-tap-highlight-color: transparent; }

.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 50% 25%, rgba(88,101,242,.2), transparent 34%), radial-gradient(circle at 10% 90%, rgba(96,216,237,.13), transparent 30%), #061119; }
.auth-card { width: min(100%, 480px); display: grid; gap: 20px; border: 1px solid var(--line); border-radius: 28px; padding: clamp(28px, 5vw, 48px); background: rgba(10,27,37,.96); box-shadow: 0 28px 90px rgba(0,0,0,.48); }
.setup-card { width: min(100%, 590px); }
.auth-brand, .panel-brand { display: flex; align-items: center; gap: 12px; font-weight: 850; }
.auth-brand img { width: 44px; height: 44px; object-fit: contain; }
.auth-card h1 { margin: 0; font-size: clamp(2.25rem, 7vw, 3.4rem); line-height: .95; letter-spacing: -.055em; }
.auth-card > p, .welcome-panel p, .view-actions p, .upload-card p { margin: 0; color: var(--muted); line-height: 1.65; }
.auth-card > small { color: #617683; text-align: center; }
.eyebrow { color: var(--cyan); font-size: .7rem; font-weight: 850; letter-spacing: .16em; }
.auth-form, .editor-form { display: grid; gap: 16px; }
label { display: grid; gap: 7px; color: #aec0ca; font-size: .78rem; font-weight: 760; letter-spacing: .04em; }
label small { color: #6f8591; font-weight: 500; letter-spacing: 0; }
input, textarea, select { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: #0a1821; padding: 12px 14px; color: var(--text); outline: none; transition: border-color .18s ease, box-shadow .18s ease; }
textarea { resize: vertical; line-height: 1.55; }
input:focus, textarea:focus, select:focus { border-color: rgba(96,216,237,.58); box-shadow: 0 0 0 3px rgba(96,216,237,.1); }
.primary-button, .secondary-button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; border: 0; border-radius: 12px; padding: 0 20px; font-weight: 850; cursor: pointer; }
.primary-button { background: linear-gradient(135deg, #ffd16a, #ffb92e); color: #10202a; box-shadow: 0 10px 30px rgba(255,190,60,.15); }
.primary-button:hover { filter: brightness(1.05); transform: translateY(-1px); }
.secondary-button { border: 1px solid var(--line); color: #c4d2d9; background: #0c1a23; }
.alert { border: 1px solid var(--line); border-radius: 12px; padding: 13px 15px; line-height: 1.5; }
.alert p { margin: 0; }
.alert.error { border-color: rgba(255,114,114,.35); color: #ffc0c0; background: rgba(255,114,114,.08); }
.alert.success { border-color: rgba(67,211,148,.35); color: #a6f2cf; background: rgba(67,211,148,.08); }
.setup-warning { color: var(--gold) !important; font-weight: 760; }

.panel-page { min-height: 100vh; display: grid; grid-template-columns: 250px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: grid; grid-template-rows: auto 1fr auto; gap: 42px; border-right: 1px solid var(--line); padding: 28px 20px; background: rgba(5,16,23,.94); backdrop-filter: blur(18px); }
.panel-brand { display: grid; grid-template-columns: 38px 1fr; gap: 0 10px; }
.panel-brand img { grid-row: 1 / 3; width: 38px; height: 38px; object-fit: contain; }
.panel-brand span { align-self: end; font-size: 1.05rem; }
.panel-brand small { align-self: start; color: #67808c; font-size: .57rem; font-weight: 850; letter-spacing: .12em; }
.sidebar nav { display: grid; align-content: start; gap: 6px; }
.sidebar nav a { display: flex; min-height: 48px; align-items: center; gap: 13px; border-radius: 12px; padding: 0 14px; color: #8299a6; font-weight: 720; transition: .18s ease; }
.sidebar nav a span { color: #4d6875; font-size: .65rem; font-weight: 850; }
.sidebar nav a:hover, .sidebar nav a.active { color: #fff; background: rgba(96,216,237,.1); }
.sidebar nav a.active span { color: var(--cyan); }
.sidebar-bottom { display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 18px; }
.sidebar-bottom a, .sidebar-bottom button { width: 100%; border: 0; background: transparent; padding: 9px 5px; color: #8299a6; text-align: left; cursor: pointer; }
.panel-main { min-width: 0; padding: 28px clamp(20px, 4vw, 62px) 70px; }
.panel-header { display: flex; min-height: 78px; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 34px; }
.panel-header h1 { margin: 6px 0 0; font-size: clamp(1.8rem, 4vw, 2.8rem); line-height: 1; letter-spacing: -.045em; }
.admin-chip { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 999px; padding: 7px 13px 7px 7px; background: rgba(255,255,255,.025); }
.admin-chip > span { display: grid; width: 37px; height: 37px; place-items: center; border-radius: 50%; background: rgba(96,216,237,.12); color: var(--cyan); font-weight: 850; }
.admin-chip div { display: grid; gap: 2px; }
.admin-chip strong { font-size: .78rem; }
.admin-chip small { color: #708792; font-size: .68rem; }
.nav-toggle { display: none; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: white; padding: 10px; }
.welcome-panel { display: flex; align-items: end; justify-content: space-between; gap: 30px; overflow: hidden; border: 1px solid rgba(96,216,237,.18); border-radius: 26px; padding: clamp(28px,5vw,54px); background: radial-gradient(circle at 88% 5%, rgba(88,101,242,.22), transparent 36%), linear-gradient(130deg,#0c202b,#0a1821); }
.welcome-panel h2 { max-width: 710px; margin: 10px 0 14px; font-size: clamp(2.2rem,5vw,4.7rem); line-height: .96; letter-spacing: -.065em; }
.welcome-panel p { max-width: 630px; }
.welcome-panel .primary-button { flex: 0 0 auto; }
.metric-grid { display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 12px; margin: 18px 0; }
.metric-grid article { display: grid; min-height: 150px; align-content: space-between; border: 1px solid var(--line); border-radius: 18px; padding: 20px; background: var(--panel); }
.metric-grid span, .metric-grid small { color: var(--muted); font-size: .75rem; }
.metric-grid strong { font-size: clamp(2rem,4vw,3.25rem); letter-spacing: -.055em; }
.metric-grid .accent-metric { border-color: rgba(255,200,87,.26); background: linear-gradient(145deg,rgba(255,200,87,.1),var(--panel)); }
.split-grid { display: grid; grid-template-columns: 1.35fr .65fr; gap: 18px; }
.surface { border: 1px solid var(--line); border-radius: 20px; background: rgba(11,26,36,.94); }
.surface-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding: 22px 24px; }
.surface-heading h2 { margin: 5px 0 0; font-size: 1.3rem; }
.surface-heading a { color: var(--cyan); font-size: .78rem; font-weight: 760; }
.compact-list { display: grid; }
.compact-list > a { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; border-bottom: 1px solid rgba(255,255,255,.055); padding: 15px 24px; }
.compact-list > a:last-child { border-bottom: 0; }
.compact-list div { display: grid; gap: 3px; }
.compact-list small, .flow-list small { color: var(--muted); }
.flow-list { display: grid; gap: 20px; margin: 0; padding: 24px; list-style: none; }
.flow-list li { display: flex; align-items: center; gap: 13px; }
.flow-list li > span { display: grid; width: 34px; height: 34px; flex: 0 0 auto; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--cyan); font-weight: 800; }
.flow-list div { display: grid; gap: 3px; }
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #70818a; box-shadow: 0 0 0 5px rgba(112,129,138,.08); }
.status-dot.published { background: var(--green); box-shadow: 0 0 0 5px rgba(67,211,148,.1); }
.status-dot.draft { background: var(--gold); box-shadow: 0 0 0 5px rgba(255,200,87,.1); }
.status-dot.coming_soon { background: var(--cyan); box-shadow: 0 0 0 5px rgba(96,216,237,.1); }
.status-dot.archived, .status-dot.trash { background: var(--red); }
.view-actions { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.editor-card { margin-bottom: 18px; }
.editor-form { padding: 24px; }
.field-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.field-grid.three { grid-template-columns: repeat(3,minmax(0,1fr)); }
.form-actions { display: flex; gap: 10px; padding-top: 4px; }
.table-card { overflow: hidden; }
.filter-row { display: flex; gap: 8px; overflow-x: auto; border-bottom: 1px solid var(--line); padding: 14px 18px; }
.filter-row a { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; padding: 7px 12px; color: var(--muted); font-size: .76rem; font-weight: 750; }
.data-table { display: grid; }
.table-row { display: grid; grid-template-columns: minmax(240px,1fr) 100px 100px auto; align-items: center; gap: 16px; border-bottom: 1px solid rgba(255,255,255,.055); padding: 16px 20px; }
.table-row:last-child { border-bottom: 0; }
.record-main { display: flex; align-items: center; gap: 13px; }
.record-main div { display: grid; gap: 3px; }
.record-main small { color: var(--muted); }
.status-label { width: fit-content; border: 1px solid var(--line); border-radius: 999px; padding: 5px 9px; color: var(--muted); font-size: .68rem; font-weight: 800; text-transform: uppercase; }
.status-label.published { border-color: rgba(67,211,148,.27); color: #83e8b8; }
.status-label.draft { border-color: rgba(255,200,87,.27); color: #ffd77f; }
.status-label.coming_soon { border-color: rgba(96,216,237,.34); color: var(--cyan); }
.row-actions { display: flex; align-items: center; justify-content: end; gap: 7px; }
.row-actions form { margin: 0; }
.row-actions a, .row-actions button { border: 1px solid var(--line); border-radius: 9px; background: transparent; padding: 7px 9px; color: #afc0c9; font-size: .72rem; cursor: pointer; }
.upload-card { display: grid; grid-template-columns: .8fr 1.2fr; align-items: end; gap: 28px; padding: 24px; margin-bottom: 18px; }
.upload-card h2 { margin: 7px 0 9px; }
.upload-form { display: grid; grid-template-columns: .8fr 1.4fr auto; gap: 10px; }
.upload-form input, .upload-form select { min-width: 0; }
.media-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; }
.media-card { display: block; overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); transition: border-color .18s ease, transform .18s ease, box-shadow .18s ease; }
.media-card:hover, .media-card:focus-visible { border-color: rgba(96,216,237,.48); transform: translateY(-3px); box-shadow: 0 16px 36px rgba(0,0,0,.24); outline: none; }
.media-preview { display: grid; aspect-ratio: 16/10; place-items: center; overflow: hidden; background: #061018; color: var(--cyan); font-size: 1.2rem; font-weight: 900; }
.media-preview img { width: 100%; height: 100%; object-fit: cover; }
.media-card > div:last-child { display: grid; gap: 6px; padding: 14px; }
.media-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .82rem; }
.media-card small { color: var(--muted); font-size: .7rem; }
.media-open-hint { color: var(--cyan); font-size: .72rem; font-weight: 750; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
.home-welcome { display: grid; min-height: clamp(280px, 45vh, 520px); align-content: center; border-bottom: 1px solid var(--line); }
.home-welcome h2 { max-width: 1050px; margin: 18px 0 0; font-size: clamp(4rem, 10vw, 9.5rem); line-height: .84; letter-spacing: -.085em; }
.home-metrics { grid-template-columns: repeat(6,minmax(0,1fr)); }
.media-controls { display: grid; grid-template-columns: 1fr 1.4fr auto; align-items: center; gap: 22px; margin: 0 0 18px; border: 1px solid var(--line); border-radius: 18px; padding: 14px 16px; background: rgba(11,26,36,.86); }
.media-controls > div { display: grid; gap: 8px; }
.media-controls > div > span { color: var(--muted); font-size: .67rem; font-weight: 850; letter-spacing: .1em; text-transform: uppercase; }
.media-controls nav { display: flex; flex-wrap: wrap; gap: 7px; }
.media-controls a { border: 1px solid var(--line); border-radius: 999px; padding: 7px 11px; color: var(--muted); font-size: .73rem; font-weight: 780; }
.media-controls a.active { border-color: rgba(96,216,237,.42); background: rgba(96,216,237,.1); color: var(--cyan); }
.media-controls > strong { color: var(--muted); font-size: .76rem; white-space: nowrap; }
.media-empty, .workspace-empty { display: grid; min-height: 170px; align-content: center; gap: 6px; border: 1px dashed var(--line); border-radius: 16px; padding: 26px; color: var(--muted); }
.media-empty { grid-column: 1 / -1; }
.media-empty strong, .workspace-empty strong { color: var(--text); }

.project-workspace { margin-bottom: 18px; border: 1px solid rgba(96,216,237,.18); border-radius: 24px; padding: clamp(22px,3vw,34px); background: radial-gradient(circle at 100% 0,rgba(88,101,242,.14),transparent 36%),rgba(10,25,35,.9); }
.workspace-heading { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.workspace-heading h2 { margin: 8px 0 0; font-size: clamp(1.8rem,4vw,3rem); letter-spacing: -.055em; }
.workspace-heading p, .editor-section-heading p { margin: 0; color: var(--muted); }
.workspace-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.workspace-project-card { display: grid; min-height: 245px; align-content: space-between; gap: 28px; border: 1px solid var(--line); border-radius: 18px; padding: 22px; background: rgba(5,16,23,.55); transition: transform .18s ease,border-color .18s ease; }
.workspace-project-card:hover { transform: translateY(-3px); border-color: rgba(96,216,237,.36); }
.workspace-project-card > div:first-child { display: grid; gap: 12px; }
.workspace-project-card strong { font-size: 1.35rem; }
.workspace-project-card p { margin: 0; color: var(--muted); line-height: 1.55; }
.stage-label { width: fit-content; border-radius: 999px; padding: 6px 9px; background: rgba(96,216,237,.1); color: var(--cyan); font-size: .65rem; font-weight: 850; text-transform: uppercase; }
.stage-label.paused { background: rgba(255,114,114,.1); color: #ff9999; }
.project-progress { display: grid; gap: 10px; }
.project-progress span { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.project-progress small { color: var(--muted); }
.project-progress i { display: block; height: 7px; overflow: hidden; border-radius: 999px; background: rgba(255,255,255,.07); }
.project-progress i b { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg,var(--cyan),#7397ff); }
.project-editor .editor-form { gap: 22px; }
.editor-section { display: grid; gap: 16px; border: 1px solid var(--line); border-radius: 17px; padding: 20px; background: rgba(5,16,23,.32); }
.editor-section-heading { display: flex; align-items: center; gap: 13px; }
.editor-section-heading > span { display: grid; width: 38px; height: 38px; flex: 0 0 auto; place-items: center; border-radius: 50%; background: rgba(96,216,237,.1); color: var(--cyan); font-size: .68rem; font-weight: 850; }
.editor-section-heading > div { display: grid; gap: 3px; margin-right: auto; }
.editor-section-heading h3 { margin: 0; font-size: 1rem; }
.project-notes-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; }
.compact-button { min-height: 38px; padding: 0 14px; font-size: .75rem; }
.todo-list { display: grid; gap: 9px; }
.todo-row { display: grid; grid-template-columns: 132px minmax(0,1fr) 42px; align-items: center; gap: 9px; }
.todo-check { display: flex; min-height: 48px; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; background: #0a1821; }
.todo-check input { width: 17px; min-height: 17px; accent-color: var(--cyan); }
.todo-check span { font-size: .69rem; }
.todo-row > button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: transparent; color: #ff9f9f; cursor: pointer; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .media-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .upload-card, .upload-form { grid-template-columns: 1fr 1fr; }
  .home-metrics { grid-template-columns: repeat(3,minmax(0,1fr)); }
  .project-notes-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .panel-page { display: block; }
  .sidebar { position: fixed; z-index: 50; width: min(82vw,280px); transform: translateX(-105%); transition: transform .22s ease; box-shadow: 20px 0 60px rgba(0,0,0,.45); }
  .nav-open .sidebar { transform: translateX(0); }
  .panel-main { padding: 20px 16px 50px; }
  .nav-toggle { display: inline-grid; }
  .panel-header > div:first-of-type { margin-right: auto; }
  .admin-chip div { display: none; }
  .welcome-panel, .view-actions { align-items: start; flex-direction: column; }
  .metric-grid, .split-grid, .media-grid { grid-template-columns: 1fr 1fr; }
  .field-grid, .field-grid.three, .upload-card, .upload-form { grid-template-columns: 1fr; }
  .media-controls, .workspace-grid { grid-template-columns: 1fr; }
  .workspace-heading { align-items: start; flex-direction: column; }
  .todo-row { grid-template-columns: 1fr 42px; }
  .todo-check { grid-column: 1 / -1; }
  .table-row { grid-template-columns: 1fr auto; }
  .table-row > b, .table-row > .status-label { justify-self: end; }
  .row-actions { grid-column: 1 / -1; justify-content: start; }
}

@media (max-width: 500px) {
  .metric-grid, .media-grid { grid-template-columns: 1fr; }
  .panel-header { align-items: start; }
  .welcome-panel { padding: 26px 20px; }
  .home-welcome { min-height: 250px; }
  .editor-section-heading { align-items: flex-start; flex-wrap: wrap; }
}
