/* Admin panel and platform console. One neutral look for every site. */
:root {
  --ink: #1f2933; --muted: #616e7c; --line: #dde2e8; --bg: #f3f5f7; --card: #fff;
  --blue: #2457a6; --blue-d: #1b4280; --red: #b42318; --green: #1e7b34; --amber: #8a5a00;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--blue); }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
code { background: #eef1f4; padding: .05rem .3rem; border-radius: 3px; font-size: .9em; }
:focus-visible { outline: 3px solid #f2b705; outline-offset: 1px; }

.topbar { display: flex; align-items: center; gap: 1rem; background: #1f2933; color: #fff; padding: 0 1rem; height: 48px; }
.topbar form { margin: 0; }
.tb-brand { color: #fff; font-weight: 700; text-decoration: none; font-size: 1.02rem; }
.tb-link { color: #cbd2d9; text-decoration: none; background: none; border: 0; font: inherit; cursor: pointer; padding: 0; }
.tb-link:hover { color: #fff; }
.tb-spacer { flex: 1; }

.shell { display: grid; grid-template-columns: 210px 1fr; min-height: calc(100vh - 48px); }
.side { background: #fff; border-right: 1px solid var(--line); padding: 1rem 0; }
.side a { display: block; padding: .45rem 1.1rem; color: var(--ink); text-decoration: none; }
.side a:hover { background: var(--bg); }
.side a[aria-current] { background: #e7eefb; color: var(--blue-d); font-weight: 600; box-shadow: inset 3px 0 0 var(--blue); }
.side-head { margin: 1rem 1.1rem .3rem; font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.main { padding: 1.5rem 2rem 4rem; max-width: 1100px; min-width: 0; }
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: flex; flex-wrap: wrap; padding: .5rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .side a { padding: .3rem .6rem; }
  .side-head { width: 100%; margin: .5rem .6rem .1rem; }
  .main { padding: 1rem; }
}

.solo { max-width: 440px; margin: 8vh auto; padding: 0 1rem; }
.solo-brand { text-align: center; font-weight: 700; font-size: 1.2rem; color: var(--muted); }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 6px; padding: 1.25rem 1.4rem; margin-bottom: 1.25rem; }
.card.narrow { max-width: 440px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.25rem; }
.row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1.25rem; }
.row3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 1.25rem; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: .5rem; }
.head-row h1 { margin: 0; }
.lead { font-size: 1.02rem; color: #3e4c59; max-width: 75ch; }

label { display: block; font-weight: 600; margin-bottom: .9rem; }
label > input, label > select, label > textarea { margin-top: .3rem; }
input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=color]), select, textarea {
  display: block; width: 100%; padding: .5rem .6rem; border: 1px solid #b9c2cc; border-radius: 4px; font: inherit; font-weight: 400; background: #fff;
}
input[type=color] { display: block; width: 72px; height: 38px; padding: 2px; border: 1px solid #b9c2cc; border-radius: 4px; margin-top: .3rem; }
textarea.mono { font-family: ui-monospace, Consolas, monospace; font-size: .9rem; }
.w-num { width: 70px !important; }
.check { display: flex; gap: .5rem; align-items: center; font-weight: 400; margin-bottom: .4rem; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
legend { font-weight: 600; margin-bottom: .3rem; padding: 0; }
.hint { color: var(--muted); font-size: .88rem; font-weight: 400; margin: .25rem 0 .5rem; display: block; }
.req { color: var(--red); }
.field { margin-bottom: 1.1rem; }
.field > label { margin-bottom: .3rem; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--red) !important; }
.field-error { color: var(--red); font-weight: 600; margin: .25rem 0 0; display: block; font-size: .9rem; }
.ok { background: #e6f4ea; border-left: 4px solid var(--green); padding: .6rem .9rem; }
.error { background: #fdecea; border-left: 4px solid var(--red); padding: .6rem .9rem; }
.muted { color: var(--muted); }
.plain { list-style: none; padding: 0; margin: 0 0 1rem; }
.plain li { padding: .3rem 0; border-bottom: 1px solid var(--line); }
.unread, .unread a { font-weight: 700; }
.todo li { margin-bottom: .35rem; }

.btn { display: inline-block; padding: .5rem 1rem; border-radius: 4px; border: 1px solid #b9c2cc; background: #fff; color: var(--ink); font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.btn:hover { background: #f0f3f6; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.primary:hover { background: var(--blue-d); }
.btn.danger { color: var(--red); border-color: #e4b4ae; }
.btn.danger:hover { background: #fdecea; }
.btn.small { padding: .25rem .6rem; font-size: .85rem; }
.actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; }
.inline-form { display: inline; margin: 0; }
.danger-zone { margin-top: 2rem; }
.search-row { display: flex; gap: .5rem; margin: 0 0 1rem; max-width: 560px; align-items: center; }
.search-row input, .search-row select { margin: 0; }

.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); border-bottom: 2px solid var(--line); padding: .5rem .6rem; }
.tbl td { border-bottom: 1px solid var(--line); padding: .55rem .6rem; vertical-align: top; }
.tbl.card { padding: 0; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.off td { opacity: .55; }
.tbl.list tbody tr:hover { background: #f7f9fb; }
.btns { white-space: nowrap; }
.pill { display: inline-block; padding: .05rem .5rem; border-radius: 3px; font-size: .8rem; font-weight: 600; }
.pill.published { background: #e6f4ea; color: var(--green); }
.pill.draft { background: #fff4d6; color: var(--amber); }
.badge { display: inline-block; background: var(--red); color: #fff; border-radius: 10px; padding: 0 .45rem; font-size: .75rem; font-weight: 700; }

/* Feature switches */
.features td { vertical-align: middle; }
.features .hint { margin: .15rem 0 0; max-width: 46ch; }
.features input:not([type=checkbox]) { margin: 0; }
.path-in { display: flex; align-items: center; gap: .15rem; color: var(--muted); }
.switch { position: relative; display: inline-block; width: 46px; height: 26px; margin: 0; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; background: #c3cad2; border-radius: 26px; cursor: pointer; transition: background .15s; }
.switch span::before { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: transform .15s; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::before { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 3px solid #f2b705; outline-offset: 2px; }

.variants { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.variant { display: grid; grid-template-columns: auto 1fr; gap: .1rem .6rem; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: 6px; cursor: pointer; font-weight: 400; margin-bottom: .6rem; }
.variant input { grid-row: span 2; margin-top: .25rem; }
.variant span { color: var(--muted); font-size: .9rem; }
.variant:has(input:checked) { border-color: var(--blue); background: #f2f6fd; }

.thumb { display: flex; align-items: center; gap: 1rem; margin: .3rem 0 .5rem; }
.thumb img { max-height: 90px; max-width: 220px; border: 1px solid var(--line); border-radius: 4px; background: #fff; }
.linkbox { border-color: #b7cdf0; background: #f2f6fd; }
.copy { font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.sub-data { display: grid; grid-template-columns: minmax(140px, max-content) 1fr; gap: .5rem 1.5rem; }
.sub-data dt { font-weight: 700; }
.sub-data dd { margin: 0; white-space: pre-wrap; }

/* Gallery editing */
.photo-edit { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1rem; }
.photo-edit li { border: 1px solid var(--line); border-radius: 6px; padding: .5rem; }
.photo-edit img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; margin-bottom: .4rem; }
.photo-edit input[type=text], .photo-edit input:not([type]) { margin-bottom: .4rem; font-size: .9rem; }
.photo-edit .check { font-size: .88rem; margin-bottom: .2rem; }
.with-thumb { display: inline-flex; align-items: center; gap: .6rem; }
.mini { width: 44px; height: 44px; object-fit: cover; border-radius: 4px; }

/* Rich text editor */
.rte { border: 1px solid #b9c2cc; border-radius: 4px; background: #fff; }
.rte-bar { display: flex; flex-wrap: wrap; gap: 2px; padding: 4px; border-bottom: 1px solid var(--line); background: #f7f9fb; position: sticky; top: 0; z-index: 2; }
.rte-bar button { border: 1px solid transparent; background: none; padding: .25rem .5rem; border-radius: 3px; cursor: pointer; font: inherit; font-size: .85rem; }
.rte-bar button:hover { background: #e4e9ef; border-color: #cfd6de; }
.rte-bar .sep { width: 1px; background: var(--line); margin: 2px 4px; }
.rte-area { min-height: 260px; padding: .9rem 1rem; outline: none; font-size: 1rem; line-height: 1.6; max-width: none; }
.rte-area:focus { box-shadow: inset 0 0 0 2px #b7cdf0; }
.rte-area h2 { font-size: 1.35rem; margin: 1.2rem 0 .5rem; }
.rte-area h3 { font-size: 1.1rem; margin: 1rem 0 .4rem; }
.rte-area img { max-width: 100%; height: auto; }
.rte-area iframe { max-width: 100%; }
.rte-area table { border-collapse: collapse; }
.rte-area td, .rte-area th { border: 1px solid #b9c2cc; padding: .3rem .5rem; min-width: 60px; }
.rte-area blockquote { border-left: 4px solid #b9c2cc; margin: .5rem 0; padding-left: 1rem; color: var(--muted); }
.rte.html-mode .rte-area { display: none; }
.rte.html-mode .rte-src { display: block; min-height: 300px; border: 0; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.shortcodes { margin-top: .5rem; }
.shortcodes summary { cursor: pointer; font-weight: 600; color: var(--blue); }
.shortcodes ul { margin: .3rem 0; padding-left: 1.2rem; }
