/* Oxford Speedway — Club CMS */
:root {
  --navy: #0b1834;
  --navy-2: #122650;
  --navy-3: #1b3470;
  --blue: #2a56d6;
  --blue-soft: #e8eefc;
  --yellow: #ffcc00;
  --bg: #f4f5f9;
  --panel: #ffffff;
  --ink: #0b1834;
  --ink-2: #3a4663;
  --line: #dde1ea;
  --red: #d9342b;
  --red-soft: #fdeceb;
  --green: #1f9d55;
  --green-soft: #e6f6ed;
  --amber: #b7791f;
  --amber-soft: #fdf3dc;
  --cond: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --body: 'Barlow', system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font-family: var(--body); font-size: 16px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 4px solid var(--line); border-top-color: var(--blue); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------- auth screens */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth__side { background: var(--navy); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth__side h1 { font-family: var(--cond); font-weight: 700; font-size: 64px; line-height: .95; text-transform: uppercase; margin: 0; }
.auth__side h1 span { color: var(--yellow); }
.auth__side p { color: #e3e9f6; font-size: 18px; max-width: 36ch; }
.auth__side svg.track { position: absolute; right: -30%; bottom: -10%; width: 110%; opacity: .5; }
.auth__main { display: grid; place-items: center; padding: 32px 20px; }
.auth__form { width: 100%; max-width: 400px; }
.auth__form h2 { font-family: var(--cond); font-size: 36px; text-transform: uppercase; margin: 0 0 6px; }
.auth__form p.lead { color: var(--ink-2); margin: 0 0 24px; }
.gate { display: grid; grid-template-columns: repeat(4, 1fr); height: 4px; }
.gate i:nth-child(1) { background: #e1251b; } .gate i:nth-child(2) { background: #1f5fd6; } .gate i:nth-child(3) { background: #fff; } .gate i:nth-child(4) { background: #ffcc00; }
@media (max-width: 800px) { .auth { grid-template-columns: 1fr; } .auth__side { padding: 28px 20px; min-height: 180px; } .auth__side h1 { font-size: 40px; } .auth__side p { display: none; } }

/* ---------------- shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side { background: var(--navy); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side__brand { display: flex; align-items: center; gap: 10px; padding: 20px 20px 16px; text-decoration: none; color: #fff; }
.side__brand svg { width: 36px; height: 36px; flex-shrink: 0; }
.side__brand b { font-family: var(--cond); font-size: 22px; line-height: 1; text-transform: uppercase; display: block; }
.side__brand small { font-family: var(--cond); font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: var(--yellow); }
.side nav { padding: 8px 12px; display: grid; gap: 2px; }
.side__label { font-family: var(--cond); font-weight: 700; font-size: 12px; letter-spacing: .2em; text-transform: uppercase; color: var(--yellow); padding: 16px 10px 6px; }
.side nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 8px; color: #fff; text-decoration: none; font-weight: 500; }
.side nav a:hover { background: var(--navy-2); }
.side nav a.is-active { background: var(--yellow); color: var(--navy); font-weight: 700; }
.side nav a svg { width: 19px; height: 19px; flex-shrink: 0; }
.side nav a .count { margin-left: auto; background: var(--red); color: #fff; font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px; }
.side__user { margin-top: auto; padding: 16px 20px 20px; border-top: 1px solid rgba(255,255,255,.14); }
.side__user b { display: block; color: #fff; }
.side__user span { font-size: 14px; color: #e3e9f6; text-transform: capitalize; }
.side__user .links { display: flex; gap: 14px; margin-top: 10px; font-size: 14px; }
.side__user a, .side__user button { color: #fff; background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; font-size: 14px; }

.topbar { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.is-open { transform: none; box-shadow: 0 0 0 100vmax rgba(5,11,26,.5); }
  .topbar { display: flex; align-items: center; gap: 12px; background: var(--navy); color: #fff; padding: 10px 16px; position: sticky; top: 0; z-index: 30; }
  .topbar button { background: none; border: 0; color: #fff; padding: 6px; cursor: pointer; }
  .topbar b { font-family: var(--cond); font-size: 20px; text-transform: uppercase; }
}

.main { min-width: 0; padding: 28px 32px 64px; }
@media (max-width: 640px) { .main { padding: 20px 16px 48px; } }
.pagebar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.pagebar h1 { font-family: var(--cond); font-size: 36px; line-height: 1; text-transform: uppercase; margin: 0; }
.pagebar p { margin: 4px 0 0; color: var(--ink-2); }
.pagebar__actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn--primary:hover { background: var(--navy-3); border-color: var(--navy-3); }
.btn--yellow { background: var(--yellow); border-color: var(--yellow); color: var(--navy); }
.btn--yellow:hover { background: #ffd83d; border-color: #ffd83d; }
.btn--danger { color: var(--red); border-color: #f2c4c1; }
.btn--danger:hover { background: var(--red-soft); border-color: var(--red); }
.btn--ghost { border-color: transparent; background: transparent; }
.btn--sm { padding: 5px 10px; font-size: 14px; }
.btn--block { width: 100%; }
.btn svg { width: 16px; height: 16px; }

.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field > label, .field > .label { font-weight: 600; font-size: 15px; }
.field small { color: var(--ink-2); font-size: 14px; }
.input, select.input, textarea.input { width: 100%; padding: 10px 12px; border: 1px solid #c8cedb; border-radius: 8px; background: #fff; }
.input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
textarea.input { resize: vertical; min-height: 90px; line-height: 1.5; }
.check { display: flex; align-items: center; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--navy); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; align-items: start; }
.grid2 .span2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }
.err { background: var(--red-soft); color: var(--red); border-radius: 8px; padding: 10px 12px; margin-bottom: 14px; font-weight: 500; }

/* ---------------- panels, tables */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.panel__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.panel__head h2 { font-family: var(--cond); font-size: 22px; text-transform: uppercase; margin: 0; }
.panel__body { padding: 20px; }
.panel + .panel { margin-top: 20px; }

.tablewrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; font-family: var(--cond); font-size: 14px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); padding: 12px 16px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfd; }
.table .title { font-weight: 600; color: var(--ink); text-decoration: none; }
.table .title:hover { text-decoration: underline; }
.table .muted { color: var(--ink-2); font-size: 14px; }
.table .actions { text-align: right; white-space: nowrap; }
.thumb { width: 64px; height: 40px; border-radius: 6px; object-fit: cover; background: var(--bg); display: block; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 13px; font-weight: 700; text-transform: capitalize; white-space: nowrap; }
.badge--published, .badge--completed, .badge--active { background: var(--green-soft); color: var(--green); }
.badge--review, .badge--postponed, .badge--live { background: var(--amber-soft); color: var(--amber); }
.badge--draft, .badge--scheduled, .badge--inactive { background: #eef0f5; color: var(--ink-2); }
.badge--cancelled { background: var(--red-soft); color: var(--red); }
.badge--admin { background: var(--navy); color: #fff; }
.badge--editor { background: var(--blue-soft); color: var(--blue); }
.badge--media { background: #fff6cc; color: #7a5b00; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); padding: 0 12px; overflow-x: auto; }
.tabs button, .tabs a { background: none; border: 0; border-bottom: 3px solid transparent; padding: 12px 12px 10px; font-weight: 600; color: var(--ink-2); cursor: pointer; text-decoration: none; white-space: nowrap; }
.tabs .is-active { color: var(--ink); border-bottom-color: var(--yellow); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.toolbar .input { width: auto; min-width: 160px; padding: 7px 10px; }
.empty { padding: 40px 20px; text-align: center; color: var(--ink-2); }

/* ---------------- dashboard */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; text-decoration: none; color: var(--ink); display: block; }
.stat b { display: block; font-family: var(--cond); font-size: 44px; line-height: 1; }
.stat span { color: var(--ink-2); font-weight: 600; }
.stat--alert { border-color: var(--yellow); box-shadow: inset 4px 0 0 var(--yellow); }
.dash { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
.dash .panel + .panel { margin-top: 0; }
.dash__col { display: grid; gap: 20px; }
@media (max-width: 1100px) { .dash { grid-template-columns: 1fr; } .stats { grid-template-columns: repeat(2, 1fr); } }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list a { color: var(--ink); font-weight: 600; text-decoration: none; }
.list a:hover { text-decoration: underline; }
.list small { color: var(--ink-2); display: block; font-size: 14px; }
.banner { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; background: #fff6cc; border: 1px solid #f3dc7a; border-radius: 12px; padding: 14px 18px; margin-bottom: 20px; }
.banner p { margin: 0; color: #5e4600; font-weight: 500; }

/* ---------------- post editor */
.editor { display: grid; grid-template-columns: 1fr 320px; gap: 20px; align-items: start; }
@media (max-width: 1100px) { .editor { grid-template-columns: 1fr; } }
.editor__title { font-family: var(--cond); font-weight: 700; font-size: 34px; line-height: 1.1; border: 0; background: transparent; padding: 4px 0; width: 100%; text-transform: none; }
.editor__title:focus { outline: none; box-shadow: inset 0 -2px 0 var(--yellow); }
.mdbar { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px; border: 1px solid #c8cedb; border-bottom: 0; border-radius: 8px 8px 0 0; background: #f8f9fc; align-items: center; }
.mdbar button { background: none; border: 0; padding: 6px 10px; border-radius: 6px; font-weight: 700; cursor: pointer; font-size: 14px; }
.mdbar button:hover { background: #e7eaf2; }
.mdbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.mdbar .spacer { flex: 1; }
.mdbar .mode.is-active { background: var(--navy); color: #fff; }
.mdarea { border-radius: 0 0 8px 8px !important; min-height: 420px !important; font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 15px; }
.mdpreview { border: 1px solid #c8cedb; border-radius: 0 0 8px 8px; padding: 8px 24px; min-height: 420px; background: #fff; font-size: 17px; line-height: 1.65; }
.mdpreview img { max-width: 100%; border-radius: 8px; }
.mdpreview blockquote { border-left: 5px solid var(--yellow); margin: 1em 0; padding-left: 16px; font-weight: 600; font-size: 20px; }
.mdpreview .embed { position: relative; aspect-ratio: 16/9; } .mdpreview iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.statusline { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.stack { display: grid; gap: 8px; }
.note { font-size: 14px; color: var(--ink-2); background: var(--bg); border-radius: 8px; padding: 10px 12px; margin: 0 0 14px; }

/* ---------------- image field + media */
.imgfield { display: grid; gap: 8px; }
.imgfield__preview { border: 1px dashed #c8cedb; border-radius: 8px; aspect-ratio: 16/9; background: var(--bg) center / cover no-repeat; display: grid; place-items: center; color: var(--ink-2); font-size: 14px; }
.imgfield__preview.has { border-style: solid; }
.imgfield__btns { display: flex; gap: 6px; flex-wrap: wrap; }
.dropzone { border: 2px dashed #c8cedb; border-radius: 12px; padding: 28px; text-align: center; color: var(--ink-2); background: #fff; margin-bottom: 20px; }
.dropzone.is-over { border-color: var(--blue); background: var(--blue-soft); }
.mediagrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.mediaitem { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.mediaitem img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: var(--bg); }
.mediaitem div { padding: 8px 10px; font-size: 13px; display: grid; gap: 6px; }
.mediaitem .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mediaitem button.pick { border: 0; padding: 0; background: none; cursor: pointer; text-align: left; }
.mediaitem button.pick:hover img { outline: 3px solid var(--yellow); outline-offset: -3px; }

/* ---------------- repeater */
.repeater { display: grid; gap: 8px; }
.repeater__row { display: grid; grid-template-columns: 1fr 110px 1.4fr auto; gap: 8px; }
@media (max-width: 640px) { .repeater__row { grid-template-columns: 1fr 1fr; } }

/* ---------------- modal */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(5, 11, 26, .55); display: grid; place-items: center; padding: 20px; }
.modal__box { background: #fff; border-radius: 14px; width: 100%; max-width: 640px; max-height: calc(100vh - 40px); display: flex; flex-direction: column; box-shadow: 0 30px 80px -20px rgba(0,0,0,.5); }
.modal__box--wide { max-width: 980px; }
.modal__head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal__head h2 { font-family: var(--cond); font-size: 24px; text-transform: uppercase; margin: 0; }
.modal__body { padding: 20px; overflow-y: auto; }
.modal__foot { display: flex; justify-content: space-between; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.modal__foot .right { display: flex; gap: 8px; margin-left: auto; }
.x { background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; padding: 4px 8px; border-radius: 6px; }
.x:hover { background: var(--bg); }

/* ---------------- toasts */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 80; display: grid; gap: 8px; }
.toast { background: var(--navy); color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: 0 12px 30px -10px rgba(0,0,0,.4); font-weight: 500; max-width: 360px; animation: up .2s ease-out; }
.toast--error { background: var(--red); }
@keyframes up { from { transform: translateY(8px); opacity: 0; } }
