/* Kidwings admin. Same palette as the site, system fonts, calm and dense. */

:root {
  --teal-900: #062f34;
  --teal-800: #0a464e;
  --teal-700: #0d6068;
  --teal-600: #10757f;
  --teal-100: #d3ecef;
  --teal-50: #eef7f8;
  --amber-600: #c96a1f;
  --amber-500: #e8883a;
  --amber-100: #fdeed3;
  --paper: #fbf7f0;
  --white: #fff;
  --ink: #14241f;
  --ink-soft: #40544f;
  --ink-faint: #6e837d;
  --line: #e2dacb;
  --line-soft: #eee8dc;
  --good: #2f9e6b;
  --good-bg: #e4f4ec;
  --bad: #c4483f;
  --bad-bg: #f9e5e3;
  --radius: 10px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--sans); color: var(--ink); background: var(--paper); }
a { color: var(--teal-700); text-underline-offset: 2px; }
a:hover { color: var(--teal-900); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .35em; letter-spacing: -.01em; }
h1 { font-size: 1.65rem; }
h2 { font-size: 1.1rem; }
p { margin: 0 0 .6em; }
img { max-width: 100%; }
code, .mono, pre { font-family: var(--mono); font-size: .86em; }
.muted { color: var(--ink-faint); }
.small { font-size: .85rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.eyebrow { text-transform: uppercase; letter-spacing: .08em; font-size: .72rem; font-weight: 650; color: var(--ink-faint); margin: 0 0 .25em; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: .3em 0; border-bottom: 1px solid var(--line-soft); }
.plain li:last-child { border-bottom: 0; }

/* --- Controls ------------------------------------------------------------- */

input, select, textarea {
  font: inherit; color: inherit; width: 100%;
  padding: .5em .65em; border: 1px solid var(--line); border-radius: 7px; background: var(--white);
}
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus, .rte__area:focus {
  outline: 2px solid var(--teal-600); outline-offset: -1px; border-color: transparent;
}
input[readonly], textarea[readonly], select:disabled { background: #f6f3ec; color: var(--ink-soft); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--teal-700); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  font: 600 .92rem/1 var(--sans); padding: .68em 1.1em; border-radius: 8px; border: 1px solid var(--teal-700);
  background: var(--teal-700); color: #fff; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--teal-800); color: #fff; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn--ghost { background: var(--white); color: var(--teal-700); border-color: var(--line); }
.btn--ghost:hover { background: var(--teal-50); color: var(--teal-800); }
.btn--amber { background: var(--amber-500); border-color: var(--amber-500); color: #2b1604; }
.btn--amber:hover { background: var(--amber-600); border-color: var(--amber-600); color: #fff; }
.btn--danger { background: var(--white); color: var(--bad); border-color: #e9c3bf; }
.btn--danger:hover { background: var(--bad); color: #fff; }
.btn--small { font-size: .82rem; padding: .5em .8em; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; text-decoration: underline; }
.icon-btn { border: 1px solid var(--line); background: var(--white); border-radius: 6px; width: 28px; height: 28px; cursor: pointer; color: var(--ink-soft); }
.icon-btn:hover { background: var(--teal-50); }
.icon-btn--bad:hover { background: var(--bad-bg); color: var(--bad); }

.pill {
  display: inline-block; font-size: .72rem; font-weight: 650; padding: .2em .6em; border-radius: 99px;
  background: var(--line-soft); color: var(--ink-soft); vertical-align: middle;
}
.pill--amber, .pill--queued, .pill--running { background: var(--amber-100); color: #7a3f0e; }
.pill--succeeded, .pill--published { background: var(--good-bg); color: #1d6b47; }
.pill--failed { background: var(--bad-bg); color: #8f2e27; }
.pill--draft { background: #ece9f5; color: #4b3f7a; }
.pill--running::before { content: ""; display: inline-block; width: .55em; height: .55em; margin-right: .35em; border-radius: 50%; background: currentColor; animation: pulse 1s infinite alternate; }
@keyframes pulse { to { opacity: .2; } }

/* --- Shell ------------------------------------------------------------------ */

.shell { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: var(--teal-900); color: #cfe3e5; padding: 18px 12px; position: sticky; top: 0; height: 100vh;
  overflow-y: auto; display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; padding: 0 8px 14px; }
.brand em { font-style: normal; font-weight: 450; color: #8fb9be; }
.brand:hover { color: #fff; }
.nav { display: flex; flex-direction: column; gap: 1px; flex: 1; }
.nav a { color: #cfe3e5; text-decoration: none; padding: 6px 10px; border-radius: 7px; font-size: .92rem; display: flex; justify-content: space-between; align-items: center; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a.on { background: var(--teal-700); color: #fff; }
.nav__group { margin: 14px 10px 4px; font-size: .68rem; text-transform: uppercase; letter-spacing: .1em; color: #6f9ca1; font-weight: 650; }
.me { border-top: 1px solid rgba(255, 255, 255, .1); padding: 12px 10px 0; margin-top: 12px; font-size: .88rem; display: grid; gap: 2px; }
.me a { color: #fff; font-weight: 600; text-decoration: none; }
.me__role { color: #8fb9be; font-size: .8rem; }
.me .linkish { color: #8fb9be; font-size: .8rem; justify-self: start; }

.main { min-width: 0; }
.top {
  display: flex; align-items: center; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--line);
  background: rgba(251, 247, 240, .92); position: sticky; top: 0; z-index: 5; backdrop-filter: blur(6px);
}
.top__crumbs { flex: 1; min-width: 0; font-size: .9rem; color: var(--ink-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top__crumbs strong { color: var(--ink); font-weight: 600; }
.top__crumbs a { color: var(--ink-soft); text-decoration: none; }
.top__crumbs a:hover { text-decoration: underline; }
.top__site { font-size: .88rem; white-space: nowrap; }
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 7px; padding: 4px 9px; font-size: 1.1rem; cursor: pointer; }

.flashes { padding: 16px 28px 0; }
.flash { padding: .7em 1em; border-radius: 8px; background: var(--good-bg); color: #1d5b3f; margin: 0 0 8px; }
.flash--error { background: var(--bad-bg); color: #7d2a24; }
.viewer-note { margin: 16px 28px 0; padding: .55em 1em; border-radius: 8px; background: var(--teal-50); color: var(--teal-800); font-size: .9rem; }

.page { padding: 24px 28px 64px; max-width: 1240px; }
.page__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page__head h2 { margin: 0; }
.page__actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 18px; min-width: 0; }
.cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)); gap: 18px; align-items: start; }
.cols > .panel { margin-bottom: 0; }
.cols + .panel, .cols + section { margin-top: 18px; }
.stack { display: grid; gap: 12px; align-content: start; }
.stack .btn { justify-self: start; }
.empty { padding: 40px; text-align: center; color: var(--ink-faint); background: var(--white); border: 1px dashed var(--line); border-radius: var(--radius); }

/* --- Sign-in ------------------------------------------------------------------ */

.card-page { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 30% 20%, var(--teal-100), var(--paper) 55%); }
.card-form { width: min(100%, 380px); background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 28px; display: grid; gap: 14px; box-shadow: 0 20px 50px -30px rgba(6, 47, 52, .4); }
.card-form h1 { font-size: 1.35rem; margin: 0; }
.card-form label { display: grid; gap: 4px; font-weight: 600; font-size: .9rem; }
.card-form .btn { width: 100%; padding: .8em; }

/* --- Dashboard ------------------------------------------------------------------ */

.hello { margin-bottom: 18px; }
.status-card {
  display: flex; justify-content: space-between; gap: 20px; align-items: center; flex-wrap: wrap;
  background: var(--white); border: 1px solid var(--line); border-left: 5px solid var(--good); border-radius: var(--radius);
  padding: 18px 22px; margin-bottom: 18px;
}
.status-card--pending { border-left-color: var(--amber-500); }
.status-card p:last-child { margin-bottom: 0; }
.status-card__big { font-size: 1.15rem; font-weight: 650; }
.status-card__form { display: flex; gap: 8px; flex-wrap: wrap; flex: 1 1 320px; max-width: 520px; }
.status-card__form input { flex: 1 1 200px; width: auto; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: var(--ink); display: grid; }
.tile strong { font-size: 1.7rem; line-height: 1.1; color: var(--teal-700); }
.tile span { color: var(--ink-soft); font-size: .9rem; }
.tile:hover { border-color: var(--teal-600); color: var(--ink); }

.acts { list-style: none; padding: 0; margin: 0 0 .6em; }
.act { display: grid; grid-template-columns: minmax(80px, 130px) 1fr auto auto; gap: 4px 12px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: .9rem; align-items: baseline; }
.act:last-child { border-bottom: 0; }
.act__who { font-weight: 600; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.act time { color: var(--ink-faint); font-size: .82rem; white-space: nowrap; }
.act__rev { font-size: .8rem; }
.act--delete .act__what { color: var(--bad); }

/* --- Lists ------------------------------------------------------------------ */

.search { display: flex; gap: 8px; align-items: center; margin-bottom: 14px; max-width: 640px; }
.search select { width: auto; }
.table-wrap { overflow-x: auto; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); }
.panel .table-wrap { border: 0; }
.table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.table th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); font-weight: 650; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fcfaf5; }
.table__title { font-weight: 600; }
.table__title a { text-decoration: none; }
.table__title a:hover { text-decoration: underline; }
.thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 6px; vertical-align: middle; margin-right: 10px; background: var(--line-soft); }
.thumb--lg { width: 120px; height: 90px; object-fit: contain; }
.grip-col { width: 34px; }
.grip { cursor: grab; color: var(--ink-faint); width: 34px; text-align: center; user-select: none; font-size: 1.1rem; }
tr.dragging { opacity: .5; background: var(--teal-50); }
.pager { display: flex; gap: 16px; justify-content: center; align-items: center; padding: 16px; color: var(--ink-faint); }

/* --- Edit ------------------------------------------------------------------ */

.edit__grid { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 22px; align-items: start; }
.edit__fields {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px;
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px;
}
.edit__side { position: sticky; top: 72px; }
.field { grid-column: 1 / -1; min-width: 0; }
.field--half { grid-column: auto; }
.field__label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 5px; color: var(--ink-soft); }
.field__note { margin: 5px 0 0; font-size: .8rem; color: var(--ink-faint); }
.field__error { margin: 5px 0 0; font-size: .82rem; color: var(--bad); font-weight: 600; }
.field--error input, .field--error textarea, .field--error select { border-color: var(--bad); }
.req { color: var(--bad); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; padding-top: 1.6em; cursor: pointer; }
.stack .check { padding-top: 0; }

.imgfield { display: flex; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: #fdfcf9; }
.imgfield__preview { width: 88px; height: 70px; flex: none; display: grid; place-items: center; background: repeating-conic-gradient(#f1ede4 0 25%, #fff 0 50%) 0 0 / 14px 14px; border-radius: 6px; overflow: hidden; }
.imgfield__preview img { width: 100%; height: 100%; object-fit: contain; }
.imgfield__meta { display: grid; gap: 5px; min-width: 0; }
.imgfield__meta > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-soft); }
.imgfield__actions { display: flex; gap: 6px; flex-wrap: wrap; }

.pairs__rows { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 8px; }
.pairs__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto; gap: 8px; align-items: start; padding: 10px; border: 1px solid var(--line-soft); border-radius: 8px; background: #fdfcf9; }
.pairs__cell { display: grid; gap: 3px; }
.pairs__tools { display: flex; gap: 4px; padding-top: 1.35em; }

.rte { border: 1px solid var(--line); border-radius: 8px; background: var(--white); overflow: hidden; }
.rte__bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 5px; border-bottom: 1px solid var(--line); background: #faf8f3; position: sticky; top: 0; }
.rte__bar button { font: 600 .78rem var(--sans); border: 1px solid transparent; background: none; padding: 5px 8px; border-radius: 5px; cursor: pointer; color: var(--ink-soft); }
.rte__bar button:hover { background: var(--white); border-color: var(--line); }
.rte__bar .rte__src { margin-left: auto; }
.rte__bar button.on { background: var(--teal-700); color: #fff; }
.rte .rte__source { border: 0; border-radius: 0; font-family: var(--mono); font-size: .82rem; min-height: 280px; }
.rte__area { min-height: 220px; max-height: 70vh; overflow-y: auto; padding: 14px 18px; border-radius: 0; }
.prose { font-size: .95rem; line-height: 1.6; }
.prose h2 { font-size: 1.3rem; margin: 1em 0 .4em; }
.prose h3 { font-size: 1.1rem; margin: 1em 0 .35em; }
.prose h4 { font-size: 1rem; margin: 1em 0 .3em; }
.prose figure { margin: 1em 0; }
.prose img { height: auto; border-radius: 6px; max-height: 320px; width: auto; }
.prose svg { width: 1em; height: 1em; }
.prose ul, .prose ol { padding-left: 1.4em; }

.point-picker__stage { position: relative; display: inline-block; max-width: 420px; cursor: crosshair; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.point-picker__stage img { display: block; }
.point-picker__dot { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: var(--amber-500); border: 3px solid #fff; box-shadow: 0 0 0 2px var(--amber-600); pointer-events: none; }

.savebar {
  position: sticky; bottom: 0; z-index: 4; display: flex; justify-content: flex-end; align-items: center; gap: 14px;
  margin: 18px 0; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(255, 255, 255, .95);
  box-shadow: 0 -8px 24px -18px rgba(6, 47, 52, .35);
}
.savebar__msg--dirty { color: var(--amber-600); font-weight: 650; }
.children { margin-top: 8px; }
.children .table td { padding: 6px 10px; }
.danger { margin-top: 26px; padding-top: 18px; border-top: 1px dashed var(--line); }
.hist li { font-size: .82rem; }
.panel.small p { margin-bottom: .35em; }

/* --- Media ------------------------------------------------------------------ */

.media-grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.media-grid a { display: grid; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; color: var(--ink-soft); }
.media-grid a:hover { border-color: var(--teal-600); }
.media-grid img, .media-grid__doc { aspect-ratio: 4 / 3; width: 100%; object-fit: contain; background: repeating-conic-gradient(#f1ede4 0 25%, #fff 0 50%) 0 0 / 16px 16px; display: grid; place-items: center; font-weight: 700; color: var(--bad); }
.media-grid__name { font-size: .78rem; padding: 6px 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-preview { display: grid; place-items: center; background: repeating-conic-gradient(#f1ede4 0 25%, #fff 0 50%) 0 0 / 18px 18px; }
.file-preview img { max-height: 70vh; }
.facts { display: grid; gap: 2px; margin: 0 0 10px; }
.facts dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-faint); margin-top: 8px; }
.facts dd { margin: 0; word-break: break-all; }

.picker { width: min(960px, calc(100vw - 32px)); max-height: calc(100vh - 48px); border: 0; border-radius: 14px; padding: 0; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .45); }
.picker::backdrop { background: rgba(6, 47, 52, .45); }
.picker__head { display: flex; gap: 10px; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--white); z-index: 1; flex-wrap: wrap; }
.picker__head input { flex: 1 1 200px; width: auto; }
.picker__status { padding: 0 16px; margin: 10px 0 0; color: var(--ink-faint); }
.picker__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; padding: 14px 16px; }
.picker__item { display: grid; gap: 4px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); padding: 6px; cursor: pointer; text-align: left; font: .74rem var(--sans); color: var(--ink-soft); }
.picker__item:hover { border-color: var(--teal-600); background: var(--teal-50); }
.picker__item img { aspect-ratio: 4 / 3; width: 100%; object-fit: contain; }
.picker__item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker__foot { padding: 0 16px 16px; text-align: center; }

/* --- Publish, people, revisions ------------------------------------------------ */

.publish-form { display: grid; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.publish-form .btn { justify-self: start; }
.releases li { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pre { white-space: pre-wrap; word-break: break-word; background: #f7f4ed; border-radius: 6px; padding: 10px; max-height: 360px; overflow: auto; margin: 6px 0 0; font-size: .78rem; }
details summary { cursor: pointer; color: var(--teal-700); font-size: .85rem; }
.roles { border: 0; padding: 0; margin: 0; display: grid; gap: 6px; }
.role { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 8px; cursor: pointer; }
.role input { grid-row: span 2; margin-top: 3px; }
.role:has(input:checked) { border-color: var(--teal-600); background: var(--teal-50); }
.linkbox { background: var(--amber-100); border: 1px solid #f1cf9d; border-radius: var(--radius); padding: 14px 16px; margin-bottom: 18px; }
.linkbox__row { display: flex; gap: 8px; }
.linkbox__row input { font-family: var(--mono); font-size: .82rem; }
.diff td:first-child { font-weight: 600; width: 180px; color: var(--ink-soft); }
.diff td { vertical-align: top; }
.diff--changed td { background: #fff8e8; }
.diff--changed td:first-child { box-shadow: inset 3px 0 0 var(--amber-500); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--teal-900); color: #fff; padding: .7em 1.1em; border-radius: 9px; z-index: 50; box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .4); margin: 0; }
.toast--bad { background: var(--bad); }

/* --- Narrow screens ------------------------------------------------------------- */

@media (max-width: 960px) {
  .edit__grid { grid-template-columns: 1fr; }
  .edit__side { position: static; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 30; transform: translateX(-100%); transition: transform .2s; }
  .side--open { transform: none; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .35); }
  .menu-btn { display: block; }
  .top, .flashes, .page { padding-left: 16px; padding-right: 16px; }
  .viewer-note { margin-left: 16px; margin-right: 16px; }
  .edit__fields { grid-template-columns: 1fr; padding: 16px; }
  .field--half { grid-column: 1 / -1; }
  .check { padding-top: 0; }
  .pairs__row { grid-template-columns: 1fr; }
  .pairs__tools { padding-top: 0; }
  .act { grid-template-columns: 1fr auto; }
  .act__who { grid-column: 1 / -1; }
  .top__site { display: none; }
}
