:root {
  color-scheme: light;
  --navy: #102642;
  --navy-soft: #193858;
  --blue: #1667d9;
  --blue-hover: #0f57bd;
  --surface: #ffffff;
  --canvas: #f3f6fa;
  --text: #162033;
  --muted: #718096;
  --line: #dfe6ee;
  --success: #16855b;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--canvas); }
button, input, select, textarea { font: inherit; }
a { color: inherit; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.sidebar {
  min-height: 100vh;
  padding: 30px 22px;
  color: white;
  background: var(--navy);
  display: flex;
  flex-direction: column;
}
.brand { color: white; text-decoration: none; font-size: 26px; font-weight: 900; letter-spacing: .08em; }
.brand-caption { color: #acc2da; font-size: 13px; margin-top: 4px; }
.sidebar-create { margin-top: 30px; padding: 12px 15px; border-radius: 9px; color: white; background: var(--blue); text-align: center; text-decoration: none; font-weight: 800; }
.sidebar-create:hover, .sidebar-create.active { background: #2879e7; }
.sidebar nav { display: grid; gap: 8px; margin-top: 44px; }
.nav-item { border-radius: 10px; padding: 12px 14px; text-decoration: none; }
.nav-item.active { background: var(--blue); font-weight: 700; }
.nav-item.disabled { color: #96abc2; cursor: default; display: flex; justify-content: space-between; gap: 8px; }
.nav-item small { color: #7390ad; }
.sidebar-footer { margin-top: auto; padding-top: 24px; display: grid; gap: 7px; border-top: 1px solid #2a4766; }
.role-badge { color: #a8bed5; font-size: 13px; }
.text-button { padding: 0; border: 0; color: #d4e0ec; background: transparent; cursor: pointer; }

.workspace { padding: 36px 42px 52px; }
.topbar, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: 30px; }
h2 { margin-bottom: 0; font-size: 22px; }
.eyebrow { margin-bottom: 7px; color: var(--blue); font-weight: 800; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.primary-button, .secondary-button {
  border-radius: 9px;
  padding: 11px 17px;
  border: 1px solid transparent;
  font-weight: 700;
  text-decoration: none;
}
.primary-button { color: white; background: var(--blue); }
.primary-button:not(:disabled):hover { background: var(--blue-hover); }
.primary-button:disabled { opacity: .55; cursor: not-allowed; }
.secondary-button { color: var(--blue); border-color: #b9d1f0; background: #f7fbff; }

.stage-banner {
  margin-top: 28px;
  padding: 18px 21px;
  border: 1px solid #cfe4db;
  border-radius: 12px;
  background: #f0faf6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.stage-banner p { margin: 0; color: #48665b; }
.status-dot { width: 9px; height: 9px; margin-right: 8px; border-radius: 50%; display: inline-block; background: var(--success); }

.metric-grid { margin-top: 22px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.metric-card, .content-card { background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 4px 18px rgb(16 38 66 / 5%); }
.metric-card { padding: 20px; }
.metric-card span { color: var(--muted); font-size: 14px; }
.metric-card strong { display: block; margin-top: 11px; font-size: 30px; }
.content-card { margin-top: 22px; padding: 24px; }
.readiness-list { margin-top: 22px; border-top: 1px solid var(--line); }
.readiness-list div { padding: 15px 2px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; }
.readiness-list strong { color: var(--success); }
.readiness-list .planned { color: var(--muted); }

.login-page { min-height: 100vh; padding: 24px; display: grid; place-items: center; background: linear-gradient(145deg, var(--navy), var(--navy-soft)); }
.login-card { width: min(420px, 100%); padding: 38px; border-radius: 16px; background: white; box-shadow: 0 24px 70px rgb(0 0 0 / 25%); }
.brand-mark { margin-bottom: 30px; color: var(--navy); font-size: 26px; font-weight: 900; letter-spacing: .08em; }
.login-card form { display: grid; gap: 10px; }
.login-card label { margin-top: 8px; color: #3f4d61; font-size: 14px; font-weight: 700; }
.login-card input { width: 100%; padding: 11px 12px; border: 1px solid #cbd5e0; border-radius: 8px; }
.login-card .primary-button { margin-top: 16px; }
.alert { margin: 16px 0; padding: 12px; border-radius: 8px; color: #8f2f2f; background: #fff0f0; }

.message-stack { position: fixed; z-index: 30; top: 18px; right: 22px; display: grid; gap: 8px; }
.message { max-width: 440px; padding: 13px 17px; border: 1px solid #b9dacd; border-radius: 9px; color: #175e45; background: #effaf6; box-shadow: 0 8px 25px rgb(16 38 66 / 12%); }
.message.error { color: #8f2f2f; border-color: #efc5c5; background: #fff0f0; }

.page-tabs, .direction-tabs { margin-top: 25px; display: flex; align-items: center; gap: 7px; border-bottom: 1px solid var(--line); }
.page-tabs a, .page-tabs span, .direction-tabs button { padding: 12px 15px; border: 0; border-bottom: 3px solid transparent; color: var(--muted); background: transparent; text-decoration: none; font-weight: 700; }
.page-tabs a.active, .direction-tabs button.active { color: var(--blue); border-bottom-color: var(--blue); }
.page-tabs span { color: #a1acba; }
.page-tabs small { display: block; margin-top: 2px; font-size: 10px; font-weight: 500; }
.direction-tabs { margin-top: 20px; overflow-x: auto; }
.direction-tabs button { white-space: nowrap; cursor: pointer; }

.list-card { padding: 0; overflow: hidden; }
.filters { padding: 18px 22px; display: flex; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); }
.filters label { color: var(--muted); font-size: 14px; font-weight: 700; }
.filters select { min-width: 230px; }
select, textarea, input[type="text"], input[type="email"], input[type="password"] { width: 100%; padding: 10px 11px; border: 1px solid #cbd5e0; border-radius: 8px; color: var(--text); background: white; }
select:focus, textarea:focus, input:focus, .semantic-editor:focus { outline: 3px solid rgb(22 103 217 / 13%); border-color: var(--blue); }
.data-table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th, .data-table td { padding: 15px 18px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.data-table th { color: var(--muted); background: #f8fafc; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.data-table td { font-size: 14px; }
.table-title { color: var(--text); font-weight: 800; text-decoration: none; }
.table-title:hover { color: var(--blue); }
.empty-cell { padding: 42px !important; color: var(--muted); text-align: center !important; }
.row-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.row-actions a, .row-actions button { padding: 0; border: 0; color: var(--blue); background: transparent; text-decoration: none; cursor: pointer; font-size: 13px; }
.row-actions form { margin: 0; }
.row-actions .danger-link { color: #bb3d3d; }
.status-pill { display: inline-flex; align-items: center; padding: 5px 9px; border-radius: 20px; font-size: 12px; font-weight: 800; }
.status-pill.neutral { color: #516274; background: #edf1f5; }
.status-pill.success { color: #167052; background: #e8f7f1; }
.status-pill.muted { color: #738092; background: #edf1f5; }

.editor-layout { margin-top: 22px; display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(300px, .8fr); gap: 20px; align-items: start; }
.editor-column, .preview-column { display: grid; gap: 20px; }
.form-card { margin-top: 0; }
.form-grid.two-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.field-group { margin-top: 18px; display: grid; gap: 7px; }
.field-group:first-child { margin-top: 0; }
.field-group label { color: #3f4d61; font-size: 13px; font-weight: 800; }
.field-group label span { color: #d34848; }
.field-group small { color: var(--muted); line-height: 1.4; }
.errorlist { margin: 0; padding: 0; color: #b33333; list-style: none; font-size: 13px; }
.editor-toolbar { padding: 7px; display: flex; gap: 5px; flex-wrap: wrap; border: 1px solid #cbd5e0; border-bottom: 0; border-radius: 9px 9px 0 0; background: #f8fafc; }
.editor-toolbar button { min-width: 34px; padding: 6px 8px; border: 1px solid transparent; border-radius: 5px; color: #425168; background: transparent; cursor: pointer; }
.editor-toolbar button:hover { border-color: #bfd2e8; background: white; }
.toolbar-divider { width: 1px; margin: 3px 2px; background: #d6dee8; }
.semantic-editor { min-height: 240px; padding: 15px; border: 1px solid #cbd5e0; border-radius: 0 0 9px 9px; background: white; line-height: 1.55; overflow-y: auto; }
.semantic-editor p, .semantic-preview p { margin-bottom: 12px; }
.semantic-editor ul, .semantic-editor ol, .semantic-preview ul, .semantic-preview ol { padding-left: 24px; }
.section-heading.compact { align-items: flex-start; }
.upload-zone { margin-top: 18px; padding: 24px; border: 2px dashed #bfd0e2; border-radius: 11px; display: grid; gap: 5px; color: var(--blue); background: #f8fbff; text-align: center; cursor: pointer; }
.upload-zone span { color: var(--muted); font-size: 13px; }
.upload-zone input { margin: 9px auto 0; max-width: 380px; }
.media-grid { margin-top: 16px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.media-card { min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; display: grid; gap: 7px; background: white; }
.media-card img, .media-card video { width: 100%; height: 135px; border-radius: 7px; object-fit: cover; background: #e7edf4; }
.media-card strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.media-card small { color: var(--muted); }
.compact-upload { color: var(--blue); font-size: 12px; cursor: pointer; }
.compact-upload input { width: 100%; margin-top: 4px; font-size: 11px; }
.delete-check { color: #9b3d3d; font-size: 12px; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }
.preview-card, .channels-card { margin-top: 0; }
.preview-card { position: sticky; top: 20px; }
.preview-card h2 { margin-top: 13px; overflow-wrap: anywhere; }
.semantic-preview { margin-top: 20px; color: #2c3748; line-height: 1.55; overflow-wrap: anywhere; }
.preview-empty, .channels-card p { margin: 18px 0 0; color: var(--muted); line-height: 1.5; }
.channel-placeholder { margin-top: 18px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.channel-placeholder span { padding: 9px; border-radius: 8px; color: #8190a3; background: #f0f3f7; text-align: center; font-size: 12px; font-weight: 800; }

.settings-layout { margin-top: 22px; display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .55fr); gap: 20px; align-items: start; }
.settings-layout .content-card { margin-top: 0; }
.settings-layout .section-heading { padding: 22px; }
.settings-form-card { position: sticky; top: 20px; }
.settings-form-card form { margin-top: 22px; }
.count-badge { min-width: 30px; padding: 5px 9px; border-radius: 20px; color: var(--blue); background: #eaf3ff; text-align: center; font-weight: 800; }
.subline { margin-top: 3px; display: block; color: var(--muted); }
.checkbox-field { grid-template-columns: auto 1fr; align-items: center; }
.checkbox-field label { grid-column: 2; grid-row: 1; }
.checkbox-field input { grid-column: 1; grid-row: 1; }
.disabled-feature { margin-top: 18px; padding: 13px; border-radius: 8px; display: grid; gap: 3px; color: #788596; background: #f0f3f6; }
.disabled-feature span { font-size: 12px; }

@media (max-width: 900px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { min-height: auto; padding: 20px; }
  .sidebar nav { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 22px; }
  .sidebar-footer { margin-top: 24px; }
  .workspace { padding: 26px 20px 40px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .editor-layout, .settings-layout { grid-template-columns: 1fr; }
  .preview-card, .settings-form-card { position: static; }
}

@media (max-width: 560px) {
  .topbar, .section-heading, .stage-banner { align-items: stretch; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr; }
  .sidebar nav { grid-template-columns: 1fr; }
  .form-grid.two-columns, .media-grid { grid-template-columns: 1fr; }
  .page-tabs { align-items: stretch; overflow-x: auto; }
  .page-tabs a, .page-tabs span { white-space: nowrap; }
}
