:root {
  --navy: #0b2a5b; --blue: #1550a8; --sky: #e8f0fc; --gold: #f5b700;
  --ink: #14213d; --text: #1f2a3d; --muted: #64748b; --line: #e3e8f0; --bg: #f3f5f9; --card: #fff;
  --ok: #15803d; --warn: #b45309; --bad: #b91c1c;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--sans); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; overflow-x: hidden; }
a { color: var(--blue); }
h1 { font-size: 1.6rem; margin: 0 0 4px; color: var(--ink); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 1.1rem; margin: 0 0 12px; color: var(--ink); }
h3 { font-size: 1rem; margin: 0 0 10px; color: var(--ink); }
p { margin: 0 0 10px; }
code { background: #eef2f7; padding: 1px 5px; border-radius: 4px; font-size: .88em; }
code.block { display: block; padding: 10px; word-break: break-all; font-size: .78rem; line-height: 1.5; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.err { color: var(--bad); }
.r { text-align: right; }
.nowrap { white-space: nowrap; }
.inline { display: inline; }
.dim { opacity: .55; }

/* Top bar */
.a-top { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 14px; padding: 0 16px; min-height: 58px; position: sticky; top: 0; z-index: 20; flex-wrap: wrap; box-shadow: 0 2px 0 var(--blue); }
.a-brand { display: flex; align-items: center; gap: 9px; color: #fff; text-decoration: none; font-weight: 800; white-space: nowrap; }
.a-brand em { font-style: normal; font-size: .68rem; text-transform: uppercase; letter-spacing: 1px; background: var(--gold); color: var(--navy); padding: 2px 6px; border-radius: 4px; }
.a-nav { display: none; width: 100%; flex-direction: column; padding: 6px 0 10px; order: 3; }
.nav-open .a-nav { display: flex; }
.a-nav a { color: rgba(255,255,255,.85); text-decoration: none; padding: 10px 12px; border-radius: 8px; font-weight: 600; font-size: .92rem; }
.a-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.a-nav a.active { background: rgba(255,255,255,.14); color: #fff; }
.a-nav a.a-new { color: var(--gold); }
.a-user { display: none; order: 4; width: 100%; gap: 14px; align-items: center; padding-bottom: 12px; flex-wrap: wrap; }
.nav-open .a-user { display: flex; }
.a-user a, .a-user .linkish { color: rgba(255,255,255,.85); text-decoration: none; font-size: .88rem; }
.a-user small { opacity: .65; }
.linkish { background: none; border: 0; cursor: pointer; font: inherit; padding: 0; }
.a-burger { margin-left: auto; background: rgba(255,255,255,.1); color: #fff; border: 0; border-radius: 8px; width: 42px; height: 40px; font-size: 1.2rem; cursor: pointer; }
@media (min-width: 1080px) {
  .a-top { flex-wrap: nowrap; }
  .a-nav, .a-user { display: flex !important; width: auto; padding: 0; order: initial; }
  .a-nav { flex-direction: row; gap: 2px; }
  .a-user { margin-left: auto; padding: 0; }
  .a-burger { display: none; }
}
.a-main { max-width: 1240px; margin: 0 auto; padding: 22px 16px 60px; }

/* Layout */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head.compact { margin-bottom: 12px; }
.cols { display: grid; gap: 18px; }
@media (min-width: 980px) { .cols { grid-template-columns: 1.6fr 1fr; align-items: start; } .cols.even { grid-template-columns: 1fr 1fr; } }
.card { background: var(--card); border-radius: 12px; box-shadow: 0 1px 2px rgba(15,30,60,.06), 0 4px 14px rgba(15,30,60,.05); padding: 18px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow: hidden; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.row-between h2 { margin: 0; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; }
.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 18px; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }
.stat { background: #fff; border-radius: 12px; padding: 14px 16px; box-shadow: 0 1px 2px rgba(15,30,60,.06); border-top: 3px solid var(--blue); }
.stat b { display: block; font-size: 1.7rem; color: var(--navy); line-height: 1.1; }
.stat span { color: var(--muted); font-size: .82rem; font-weight: 600; }
.stat-warn { border-top-color: var(--gold); }
.empty { text-align: center; color: var(--muted); padding: 30px 16px; margin: 0; }
.tips { margin: 0; padding-left: 18px; color: var(--muted); font-size: .9rem; }
.tips li { margin-bottom: 6px; }
.toplist { margin: 0; padding-left: 20px; }
.toplist li { margin-bottom: 8px; }
.pager { text-align: center; }
.pager a, .pager b { padding: 4px 9px; }

/* Forms */
label { display: block; font-weight: 600; font-size: .88rem; color: var(--ink); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=datetime-local], select, textarea {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 9px; font: inherit; font-weight: 400; background: #fff; color: var(--text);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(21,80,168,.14); }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 500; margin: 10px 0; }
label.check input { width: 18px; height: 18px; margin: 0; }
.stack > * + * { margin-top: 14px; }
.stack fieldset { border: 0; padding: 0; margin-left: 0; margin-right: 0; }
.stack fieldset > * + * { margin-top: 12px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar select, .toolbar input { width: auto; margin: 0; }
.toolbar input[type=search] { flex: 1; min-width: 160px; }
.toolbar label.check { margin: 0; }
.settings-form { max-width: 760px; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; background: var(--blue); color: #fff; border: 0; border-radius: 9px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--navy); }
.btn-ghost { background: #fff; color: var(--blue); box-shadow: inset 0 0 0 1.5px var(--line); }
.btn-ghost:hover { background: var(--sky); }
.btn-danger { background: #fff; color: var(--bad); box-shadow: inset 0 0 0 1.5px #f3caca; }
.btn-danger:hover { background: #fdecec; }
.btn-danger-text { color: var(--bad); }
.btn-sm { padding: 6px 10px; font-size: .82rem; border-radius: 7px; }
.btn-block { width: 100%; }
.btn-col { display: grid; gap: 8px; margin-top: 14px; }

/* Tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .7px; color: var(--muted); padding: 10px 14px; background: #f8fafc; border-bottom: 1px solid var(--line); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td a { text-decoration: none; }
.tbl td a:hover { text-decoration: underline; }
.card:not(.flush) .tbl td, .card:not(.flush) .tbl th { padding-left: 0; padding-right: 8px; }
.tbl.small { font-size: .84rem; }
.table-scroll { overflow-x: auto; }
.hide-m { display: none; }
@media (min-width: 760px) { .hide-m { display: table-cell; } }
.tbl select { width: auto; margin: 0; padding: 6px 8px; font-size: .85rem; }

.pill { display: inline-block; font-size: .7rem; font-weight: 800; letter-spacing: .4px; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; background: #eef2f7; color: var(--muted); vertical-align: middle; }
.pill-live { background: #dcfce7; color: var(--ok); }
.pill-review { background: #fef3c7; color: var(--warn); }
.pill-scheduled { background: #dbeafe; color: var(--blue); }
.pill-draft { background: #eef2f7; color: var(--muted); }
.pill-fail { background: #fee2e2; color: var(--bad); }
.pill-feat { background: var(--gold); color: var(--navy); }

.flash { padding: 12px 16px; border-radius: 10px; margin: 0 0 16px; font-weight: 600; }
.flash-success { background: #dcfce7; color: #14532d; }
.flash-error { background: #fee2e2; color: #7f1d1d; }

/* Dropdown menu */
details.menu { position: relative; display: inline-block; }
details.menu summary { list-style: none; cursor: pointer; }
details.menu summary::-webkit-details-marker { display: none; }
details.menu > div { position: absolute; right: 0; top: calc(100% + 4px); background: #fff; border-radius: 10px; box-shadow: 0 10px 30px rgba(15,30,60,.18); padding: 6px; min-width: 200px; z-index: 10; text-align: left; }
details.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 10px; border-radius: 7px; font: inherit; cursor: pointer; }
details.menu button:hover { background: var(--sky); }
details.menu button.danger { color: var(--bad); }

/* Auth */
.admin-guest .a-main { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--navy), var(--blue)); max-width: none; }
.auth { width: 100%; max-width: 420px; }
.auth .card { padding: 28px; }
.auth .muted a, .auth > p a { color: inherit; }
.auth > p { color: rgba(255,255,255,.8); }
.auth > p a { color: #fff; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.auth-brand b { display: block; font-size: 1.1rem; color: var(--ink); }
.auth-brand span { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

/* Editor */
.editor-layout { display: grid; gap: 18px; }
@media (min-width: 1080px) { .editor-layout { grid-template-columns: 1fr 330px; align-items: start; } .editor-side { position: sticky; top: 78px; } }
.title-input { font-size: 1.6rem !important; font-weight: 800 !important; padding: 14px !important; border-radius: 12px !important; }
.excerpt-input { margin-top: 10px !important; font-size: 1rem; }
.editor-wrap { margin-top: 12px; background: #fff; border-radius: 12px; box-shadow: 0 1px 2px rgba(15,30,60,.06); }
.editor-wrap .ql-toolbar.ql-snow { border: 0; border-bottom: 1px solid var(--line); position: sticky; top: 58px; background: #fff; z-index: 5; }
.editor-wrap .ql-container.ql-snow { border: 0; font-family: var(--sans); font-size: 1.05rem; }
.editor-wrap .ql-editor { min-height: 420px; line-height: 1.7; padding: 18px 20px; }
.editor-wrap .ql-editor img { max-width: 100%; border-radius: 8px; }
.editor-wrap .ql-editor h2 { font-size: 1.5rem; }
.editor-wrap .ql-editor h3 { font-size: 1.25rem; }
.editor-wrap .ql-editor blockquote { border-left: 4px solid var(--gold); padding-left: 14px; font-style: italic; }
.editor-side .card h3 { margin-bottom: 12px; }
.editor-side details summary { cursor: pointer; }
.editor-side details[open] summary { margin-bottom: 12px; }
.img-drop { position: relative; border: 2px dashed var(--line); border-radius: 10px; min-height: 120px; display: grid; place-items: center; text-align: center; overflow: hidden; cursor: pointer; background: #f8fafc; }
.img-drop:hover { border-color: var(--blue); }
.img-drop img { width: 100%; display: block; }
.img-drop p { margin: 0; padding: 18px; color: var(--ink); font-weight: 600; }
.img-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.editor-side label + label, .editor-side .img-drop + p + label { margin-top: 12px; }

/* Players */
.pl-cell { display: flex; align-items: center; gap: 10px; }
.pl-cell img, .pl-ph { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; object-position: 50% 10%; flex: none; background: var(--blue); }
.pl-ph { display: grid; place-items: center; color: #fff; font-weight: 800; }
img.flag { width: 20px; height: 14px; object-fit: cover; border-radius: 2px; vertical-align: -2px; }
.pl-photo { width: 160px; height: 160px; object-fit: cover; object-position: 50% 10%; border-radius: 12px; background: var(--blue); }
.show-m { display: inline; }
@media (min-width: 760px) { .show-m { display: none; } }
/* Toolbar sticks under the admin bar while scrolling (wrapper must not clip, or sticky breaks) */
.editor-wrap .ql-toolbar.ql-snow { border-radius: 12px 12px 0 0; }
.editor-wrap .ql-container.ql-snow { border-radius: 0 0 12px 12px; }
.tbl tr.unread td { background: #f5f9ff; }

/* Email signature editor */
.sig-grid { display: grid; gap: 18px; align-items: start; }
@media (min-width: 1000px) { .sig-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); } }
.sig-form { margin: 0; }
.sig-preview { padding: 0; overflow: hidden; }
.sig-preview-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line, #e5e9f0); }
.sig-preview iframe { display: block; width: 100%; min-height: 520px; border: 0; background: #eef2f8; }
.row-gap { display: flex; flex-wrap: wrap; gap: 10px; }

/* Matchday sections */
.md-next { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; padding: 14px 18px; margin-bottom: 14px; border-left: 4px solid #f5b700; }
.md-next b { display: block; color: #0b2a5b; }
.md-next small { text-transform: uppercase; letter-spacing: .08em; font-weight: 700; font-size: .7rem; }
.md-add { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.md-edit { display: grid; gap: 18px; align-items: start; }
@media (min-width: 1000px) { .md-edit { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); } .md-prev-card { position: sticky; top: 80px; } }
.md-when { border: 0; padding: 0; margin: 0; }
.md-when legend { font-weight: 600; font-size: .9rem; margin-bottom: 2px; }
.md-when label.check { margin: 6px 0; }
.md-when select { margin-top: 6px; width: 100%; }
.lbl { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; }
.md-editor { min-height: 220px; background: #fff; }
.md-editor .ql-editor { min-height: 220px; font-size: 15px; }
.chip-btn { border: 1px solid #d5dce8; background: #f4f6fa; border-radius: 999px; padding: 3px 10px; font-size: .8rem; cursor: pointer; margin: 2px 2px 0 0; font-family: inherit; color: #1550a8; font-weight: 600; }
.chip-btn:hover { background: #e8f0fc; }
.md-prev-card { padding: 0; overflow: hidden; }
.md-prev { background: #f4f6fa; padding: 18px; }
.md-prev-panel { background: #fff; border-radius: 14px; box-shadow: 0 1px 2px rgba(15,30,60,.06), 0 6px 20px rgba(15,30,60,.06); padding: 20px; max-width: 460px; margin: 0 auto; }
.md-prev-panel h3 { font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif; font-weight: 700; font-size: 1.35rem; color: #14213d; margin: 0 0 10px; }
.md-prev-body { font-size: .95rem; line-height: 1.55; color: #1f2a3d; overflow-wrap: anywhere; }
.md-prev-body p { margin: 0 0 .7em; }
.md-prev-body ul, .md-prev-body ol { padding-left: 1.2em; margin: 0 0 .7em; }
.md-prev-body li[data-list="bullet"] { list-style-type: disc; }
.md-prev-body li[data-list="ordered"] { list-style-type: decimal; }
.md-prev-body a { color: #1550a8; }
.md-prev-body .ql-ui { display: none; }
.md-when select[hidden] { display: none; }

/* Settings tabs (General | Email | Staff) */
.s-tabs { display: flex; gap: 4px; box-shadow: inset 0 -2px 0 #e3e8f0; margin: -4px 0 20px; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.s-tabs a { padding: 10px 16px; font-weight: 600; font-size: .95rem; color: #5d6b82; text-decoration: none; white-space: nowrap; border-radius: 8px 8px 0 0; }
.s-tabs a:hover { color: #0b2a5b; background: #f4f6fa; }
.s-tabs a.active { color: #0b2a5b; box-shadow: inset 0 -3px 0 #f5b700; }
