:root {
  --navy: #001a57;
  --cream: #fcfaf8;
  --paper: #ffffff;
  --yellow: #ffe0aa;
  --olive: #5c6941;
  --line: rgba(0, 26, 87, .14);
  --soft: rgba(0, 26, 87, .05);
  --muted: rgba(0, 26, 87, .62);
  --danger: #a3241b;
  --ok: #3f6b2f;
  --font: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --r: 8px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--navy); background: var(--cream); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.boot { padding: 40px; color: var(--muted); }

/* ---------- auth screens ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: 100%; max-width: 400px; background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 32px; }
.auth-card .mark { width: 44px; margin-bottom: 18px; }
.auth-card h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -.01em; }
.auth-card p.lead { margin: 0 0 22px; color: var(--muted); }

/* ---------- layout ---------- */
.app { min-height: 100vh; }
.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--navy); color: var(--cream); padding: 22px 16px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.side .brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; margin: 0 6px 22px; }
.side .brand img { width: 28px; }
.side .who { font-size: 13px; opacity: .75; margin: 0 6px 18px; line-height: 1.35; }
.side .who b { display: block; opacity: 1; font-weight: 600; font-size: 14px; color: var(--cream); }
.side .navlink { display: flex; align-items: center; gap: 10px; text-decoration: none; padding: 9px 10px; border-radius: 7px; font-weight: 500; opacity: .86; }
.side .navlink:hover { background: rgba(255, 255, 255, .08); opacity: 1; }
.side .navlink.active { background: var(--yellow); color: var(--navy); opacity: 1; }
.side .sep { height: 1px; background: rgba(255, 255, 255, .14); margin: 14px 6px; }
.side .bottom { margin-top: auto; display: flex; flex-direction: column; gap: 2px; }
.side .small { font-size: 13px; }
.main { padding: 28px clamp(18px, 3vw, 44px) 80px; max-width: 1180px; width: 100%; }
.topbar { display: none; }

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 50; inset: 0 auto 0 0; width: 270px; transform: translateX(-100%); transition: transform .25s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; background: var(--navy); color: var(--cream); position: sticky; top: 0; z-index: 40; }
  .topbar button { background: none; border: 0; color: inherit; font-weight: 600; cursor: pointer; padding: 6px; }
}

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { margin: 0; font-size: clamp(26px, 3vw, 34px); letter-spacing: -.02em; line-height: 1.05; }
.page-head .sub { color: var(--muted); margin-top: 6px; font-size: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.status { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); display: inline-block; }
.dot.draft { background: #d9932b; }
.dot.saving { background: var(--muted); }

/* sticky publish bar */
.publish-bar { position: sticky; top: 0; z-index: 20; background: var(--cream); padding: 12px 0; margin: -12px 0 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); }
@media (max-width: 860px) { .publish-bar { top: 52px; } }

/* ---------- buttons ---------- */
.btn { border: 1px solid var(--line); background: var(--paper); border-radius: 7px; padding: 8px 14px; cursor: pointer; font-weight: 500; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; line-height: 1.2; white-space: nowrap; }
.btn:hover { border-color: var(--navy); }
.btn.primary { background: var(--navy); color: var(--cream); border-color: var(--navy); }
.btn.primary:hover { background: #0b2a73; }
.btn.primary:disabled { opacity: .45; cursor: default; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--soft); border-color: transparent; }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled, .btn:disabled:hover { opacity: .4; cursor: default; border-color: var(--line); background: var(--paper); }
.btn.ghost:disabled { background: transparent; border-color: transparent; }
.btn.block { width: 100%; justify-content: center; padding: 11px 14px; }
.linkish { background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; color: var(--muted); font-size: 13px; }

/* ---------- forms ---------- */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 22px; margin-bottom: 18px; }
.card h2 { margin: 0 0 4px; font-size: 18px; letter-spacing: -.01em; }
.card .hint { color: var(--muted); font-size: 13.5px; margin: 0 0 16px; }
.field { margin-bottom: 16px; }
.field:last-child { margin-bottom: 0; }
.field label, .label { display: block; font-weight: 600; font-size: 13.5px; margin-bottom: 6px; }
.field .help { display: block; font-weight: 400; color: var(--muted); font-size: 12.5px; margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=number], textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 7px; padding: 9px 11px; background: var(--paper); transition: border-color .15s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(0, 26, 87, .08); }
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
textarea.tall { min-height: 280px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .row { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; cursor: pointer; }
.check input { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--navy); }
.error { color: var(--danger); font-size: 13.5px; margin: 10px 0 0; min-height: 1em; }

/* ---------- images ---------- */
.single-img + .help { display: none; }
#p1 { margin-bottom: 22px; }
.single-img { display: flex; gap: 16px; align-items: center; }
.single-img .frame { width: 140px; height: 140px; border-radius: 8px; background: var(--soft); display: grid; place-items: center; overflow: hidden; flex: none; border: 1px solid var(--line); }
.single-img .frame.wide { width: 220px; height: 124px; }
.single-img .frame img { width: 100%; height: 100%; object-fit: cover; }
.single-img .frame .empty { font-size: 12px; color: var(--muted); text-align: center; padding: 8px; }
.single-img .btns { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--paper); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; position: relative; display: flex; flex-direction: column; }
.tile.dragging { opacity: .35; }
.tile.over { outline: 2px dashed var(--navy); outline-offset: 2px; }
.tile .pic { aspect-ratio: 1; background: var(--soft); position: relative; cursor: grab; overflow: hidden; }
.tile .pic img { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); object-fit: contain; pointer-events: none; }
.tile.uploading .pic { display: grid; place-items: center; }
.tile .num { position: absolute; top: 6px; left: 6px; background: rgba(0, 26, 87, .82); color: #fff; font-size: 11px; font-weight: 600; border-radius: 10px; padding: 1px 7px; }
.tile .tools { display: flex; justify-content: space-between; align-items: center; padding: 4px; gap: 2px; }
.tile .tools button { border: 0; background: none; cursor: pointer; padding: 5px 7px; border-radius: 5px; font-size: 13px; line-height: 1; }
.tile .tools button:hover { background: var(--soft); }
.tile .tools .rm { color: var(--danger); }
.tile .meta { padding: 0 8px 8px; display: grid; gap: 6px; }
.tile .meta select, .tile .meta input { font-size: 12.5px; padding: 6px 8px; }
.tile.uploading .pic { cursor: default; }
.tile .bar { position: absolute; left: 8px; right: 8px; bottom: 8px; height: 4px; background: rgba(0, 26, 87, .12); border-radius: 2px; overflow: hidden; }
.tile .bar i { display: block; height: 100%; width: 0; background: var(--navy); transition: width .2s; }
.dropzone { border: 1.5px dashed rgba(0, 26, 87, .3); border-radius: 9px; display: grid; place-items: center; text-align: center; padding: 16px; color: var(--muted); font-size: 13px; cursor: pointer; min-height: 150px; background: transparent; }
.dropzone:hover, .dropzone.over { border-color: var(--navy); color: var(--navy); background: var(--soft); }
.dropzone strong { display: block; color: var(--navy); font-size: 14px; margin-bottom: 4px; }

/* ---------- lists ---------- */
.list { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-top: 1px solid var(--line); }
.list-row:first-child { border-top: 0; }
.list-row .thumb { width: 52px; height: 40px; border-radius: 5px; background: var(--soft); overflow: hidden; flex: none; }
.list-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.list-row .grow { flex: 1; min-width: 0; }
.list-row .title { font-weight: 600; }
.list-row .meta { font-size: 12.5px; color: var(--muted); }
.list-row .handle { cursor: grab; color: var(--muted); padding: 4px; user-select: none; }
.list-row.dragging { opacity: .4; }
.list-row.over { box-shadow: inset 0 2px 0 var(--navy); }
.pill { font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 10px; background: var(--soft); white-space: nowrap; }
.pill.admin { background: var(--yellow); }
.pill.off { background: #f3e5d6; }

table.people { width: 100%; border-collapse: collapse; }
table.people th, table.people td { text-align: left; padding: 11px 14px; border-top: 1px solid var(--line); vertical-align: middle; font-size: 14px; }
table.people th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-top: 0; font-weight: 600; }
table.people td .meta { font-size: 12.5px; color: var(--muted); }
@media (max-width: 760px) { table.people .hide-sm { display: none; } }

/* sections editor (about / contact) */
.blocks { display: grid; gap: 12px; }
.block { border: 1px solid var(--line); border-radius: 9px; padding: 14px; background: var(--cream); }
.block .block-tools { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; font-size: 12.5px; color: var(--muted); }

/* ---------- modal + toast ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 100; background: rgba(0, 16, 50, .45); display: grid; place-items: center; padding: 20px; }
.modal { background: var(--paper); border-radius: 14px; width: 100%; max-width: 480px; padding: 26px; box-shadow: 0 20px 60px rgba(0, 0, 0, .25); max-height: calc(100vh - 40px); overflow: auto; }
.modal h2 { margin: 0 0 8px; font-size: 20px; }
.modal p { margin: 0 0 14px; color: var(--muted); }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; flex-wrap: wrap; }
.secret { font-family: ui-monospace, Menlo, monospace; font-size: 18px; background: var(--yellow); padding: 10px 14px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--navy); }
.toast { position: fixed; z-index: 200; left: 50%; bottom: 24px; transform: translate(-50%, 20px); background: var(--navy); color: var(--cream); padding: 11px 18px; border-radius: 8px; font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; max-width: calc(100vw - 32px); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { background: var(--danger); }

.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.notice { background: var(--yellow); border-radius: 9px; padding: 12px 14px; font-size: 14px; margin-bottom: 18px; }
.muted { color: var(--muted); }
.log { font-size: 13.5px; }
.log .list-row { padding: 9px 16px; }
.progress { height: 6px; background: var(--soft); border-radius: 3px; overflow: hidden; margin-top: 12px; }
.progress i { display: block; height: 100%; background: var(--navy); width: 0; transition: width .3s; }

/* roles */
.side .navhead { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; opacity: .55; margin: 14px 10px 4px; }
.side .count { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--yellow); color: var(--navy); font-size: 12px; font-weight: 700; margin-left: 6px; }
.side .navlink.active .count { background: var(--navy); color: var(--yellow); }
.pill.cur { background: #e6ead8; color: var(--navy); text-decoration: none; }
.pill.cur:hover { background: #d8dec4; }
.banner-btn { position: absolute; left: 6px; bottom: 6px; border: 0; border-radius: 10px; padding: 3px 8px; font-size: 11px; font-weight: 600; cursor: pointer; background: rgba(255, 255, 255, .9); color: var(--navy); opacity: 0; transition: opacity .15s; }
.tile:hover .banner-btn, .banner-btn:focus-visible, .banner-btn.on { opacity: 1; }
.banner-btn.on { background: var(--yellow); cursor: default; }
.tile.is-banner { border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy); }
@media (hover: none) { .banner-btn { opacity: 1; } }

.btn.primary:disabled, .btn.primary:disabled:hover { background: var(--navy); color: var(--cream); border-color: var(--navy); opacity: .3; }
#bn { margin-bottom: 22px; }

/* open calls */
.linkrow { text-decoration: none; color: inherit; }
.linkrow:hover { background: var(--soft); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.card-head h2 { margin: 0; }
.card .actions { margin-top: 4px; }
.brief p { margin: 8px 0 0; max-width: 46em; }
.sub-group { padding: 16px 0; border-top: 1px solid var(--line); }
.sub-group:first-child { border-top: 0; padding-top: 4px; }
.sub-head { font-size: 14px; margin-bottom: 6px; }
.sub-text { font-size: 13.5px; color: var(--muted); margin: 0 0 10px; max-width: 52em; white-space: pre-line; }
.pool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.pool-tile { position: relative; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); padding: 0; cursor: pointer; text-align: left; overflow: hidden; display: flex; flex-direction: column; transition: border-color .15s, box-shadow .15s; }
.pool-tile .pic { aspect-ratio: 1; background: var(--soft); position: relative; display: block; }
.pool-tile .pic img { position: absolute; inset: 6px; width: calc(100% - 12px); height: calc(100% - 12px); object-fit: contain; }
.pool-tile .sel { position: absolute; top: 6px; right: 6px; min-width: 24px; height: 24px; padding: 0 8px; border-radius: 12px; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--navy); color: var(--cream); }
.pool-tile .sel.add { background: rgba(255, 255, 255, .92); color: var(--navy); font-weight: 600; opacity: 0; transition: opacity .15s; }
.pool-tile:hover .sel.add, .pool-tile:focus-visible .sel.add { opacity: 1; }
.pool-tile .cap { font-size: 12px; padding: 6px 8px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pool-tile.on { border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy); }
.pool-tile:disabled { cursor: default; }
@media (hover: none) { .pool-tile .sel.add { opacity: 1; } }
.check input[type=radio] { margin-top: 3px; width: 16px; height: 16px; accent-color: var(--navy); }

.modal .warn { color: var(--navy); background: #fbeee0; border-radius: 8px; padding: 10px 12px; }

/* numbers sit above the image */
.tile .num { z-index: 3; box-shadow: 0 0 0 2px var(--paper); }
.tile .pic { z-index: 1; }
/* automatic fields */
.auto { border: 1px dashed var(--line); border-radius: 7px; padding: 9px 11px; background: var(--cream); min-height: 40px; font-size: 14px; }
/* banner crop */
.crop-row { display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap; }
.crop { position: relative; border-radius: 8px; background-size: cover; background-repeat: no-repeat; cursor: grab; touch-action: none; box-shadow: inset 0 0 0 1px var(--line); user-select: none; }
.crop.dragging { cursor: grabbing; }
.crop.desktop { width: 320px; aspect-ratio: 16 / 10; }
.crop.phone { width: 96px; aspect-ratio: 9 / 19.5; }
.crop span { position: absolute; left: 8px; bottom: 8px; font-size: 11px; font-weight: 600; background: rgba(0, 26, 87, .78); color: #fff; padding: 2px 7px; border-radius: 9px; pointer-events: none; }
@media (max-width: 520px) { .crop.desktop { width: 100%; } }
/* messages */
.msgs .msg { padding: 14px 16px; border-top: 1px solid var(--line); cursor: pointer; }
.msgs .msg:first-child { border-top: 0; }
.msgs .msg:hover { background: var(--soft); }
.msg-top { display: flex; align-items: center; gap: 10px; }
.msg-title { flex: 1; min-width: 0; font-weight: 500; }
.msg.unread .msg-title { font-weight: 700; }
.msg.unread .msg-top::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--navy); flex: none; }
.msg-top .meta { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.msg-body { display: none; padding: 10px 0 2px; font-size: 14px; max-width: 46em; }
.msg-body p { margin: 0 0 10px; }
.msg.open .msg-body { display: block; }
.secret.link { font-size: 13px; word-break: break-all; }
