/* matthewchitty.com admin — builds on style.css tokens */
body.adm { min-height: 100vh; display: block; background: var(--bg); }
.adm-shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }

/* Sidebar */
.adm-side { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; gap: 10px;
    padding: 18px 14px; background: var(--bg-alt); border-right: 1px solid var(--line); z-index: 1041; }
.adm-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; text-decoration: none; color: var(--ink); font-weight: 700; line-height: 1.15; }
.adm-brand small { display: block; font: 500 .72rem var(--font-mono); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.adm-brand:hover { color: var(--ink); }
.adm-nav { display: grid; gap: 2px; }
.adm-nav-label { font: 600 .68rem var(--font-mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); padding: 14px 12px 6px; }
.adm-nav a, .adm-side-foot a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; font-weight: 500; font-size: .95rem; min-width: 0; }
.adm-nav a i, .adm-side-foot a i { width: 18px; text-align: center; color: var(--muted); flex-shrink: 0; }
.adm-nav a:hover, .adm-side-foot a:hover { background: var(--chip); color: var(--ink); }
.adm-nav a.active, .adm-side-foot a.active { background: var(--ink); color: var(--bg); }
.adm-nav a.active i, .adm-side-foot a.active i { color: var(--accent); }
.adm-side-foot { margin-top: auto; display: grid; gap: 2px; padding-top: 12px; border-top: 1px solid var(--line); }
.adm-side-foot a { font-size: .88rem; color: var(--muted); }

/* Main column + page header */
.adm-main { min-width: 0; padding: 26px 32px 120px; }
.adm-mobilebar { display: none; }
.adm-top { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.adm-top-text { min-width: 0; flex: 1 1 320px; }
.adm-title { font-size: 1.75rem; margin: 0; font-weight: 800; letter-spacing: -.02em; }
.adm-intro { margin: 6px 0 0; color: var(--muted); max-width: 70ch; }
.adm-crumbs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 6px; padding: 0; list-style: none; font-size: .85rem; color: var(--muted); }
.adm-crumbs a { color: var(--muted); text-decoration: none; }
.adm-crumbs a:hover { color: var(--ink); text-decoration: underline; }
.adm-crumbs li + li::before { content: "/"; margin-right: 6px; opacity: .5; }
.adm-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.adm-iconbtn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }

@media (max-width: 991.98px) {
    .adm-shell { grid-template-columns: 1fr; }
    .adm-side { position: fixed; left: 0; top: 0; width: 272px; transform: translateX(-100%); transition: transform .2s ease; box-shadow: var(--shadow); }
    .adm-side.open { transform: none; }
    .adm-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1040; }
    .adm-main { padding: 0 16px 120px; }
    .adm-mobilebar { display: flex; align-items: center; gap: 12px; position: sticky; top: 0; z-index: 1030; margin: 0 -16px 16px; padding: 10px 16px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
    .adm-brand-sm { padding: 0; }
    .adm-title { font-size: 1.45rem; }
}

/* Toasts */
.adm-toasts { position: fixed; right: 18px; top: 18px; z-index: 2000; display: grid; gap: 10px; width: min(380px, calc(100vw - 36px)); }
.adm-toast { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px 12px 16px; border-radius: 12px; background: var(--surface); color: var(--ink);
    border: 1px solid var(--line); border-left: 4px solid var(--success, #22a06b); box-shadow: 0 16px 40px -18px rgba(0,0,0,.45); animation: admIn .2s ease; font-weight: 500; }
.adm-toast span { flex: 1; }
.adm-toast button { border: 0; background: none; color: var(--muted); font-size: 1.3rem; line-height: 1; padding: 0 2px; }
.adm-toast-danger { border-left-color: var(--danger, #d64545); }
.adm-toast-warning { border-left-color: var(--warning, #e0a800); }
.adm-toast.out { opacity: 0; transform: translateY(-6px); transition: .25s; }
@keyframes admIn { from { opacity: 0; transform: translateY(-8px); } }

/* Sticky save bar (forms with data-guard) */
.adm-savebar { position: sticky; bottom: 14px; z-index: 1020; margin-top: 18px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
    padding: 12px 14px 12px 18px; border-radius: 14px; background: var(--ink); color: var(--bg); box-shadow: 0 18px 40px -16px rgba(0,0,0,.6); }
.adm-savebar .msg { flex: 1; font-weight: 600; display: flex; align-items: center; gap: 8px; min-width: 180px; }
.adm-savebar .msg::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.adm-savebar .btn-ghost { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 35%, transparent); }
.adm-savebar .btn-ghost:hover { background: color-mix(in srgb, var(--bg) 12%, transparent); color: var(--bg); }
.adm-savebar .btn-save { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 700; }
form[data-guard]:not(.is-dirty) .adm-savebar .msg { opacity: .7; }
form[data-guard]:not(.is-dirty) .adm-savebar .msg::before { background: color-mix(in srgb, var(--bg) 50%, transparent); }
kbd.adm-kbd { background: color-mix(in srgb, var(--bg) 15%, transparent); color: inherit; font-size: .75rem; padding: 2px 6px; border-radius: 5px; }

.adm-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px; }
/* Login / first-run setup: one centred card */
.adm-auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 440px); justify-content: center; align-content: center; gap: 12px; padding: 32px 16px;
    background: radial-gradient(60% 50% at 50% 0%, color-mix(in srgb, var(--accent) 10%, transparent), transparent 70%), var(--bg); }
.adm-auth-card { width: 100%; padding: 32px 30px 28px; box-shadow: var(--shadow); }
.adm-auth-card .brand { justify-content: center; width: 100%; margin-bottom: 18px !important; font-size: 1.1rem; }
.adm-auth-card h1 { text-align: center; }
.adm-auth-card h1 + p { text-align: center; }
.adm-auth-card .form-control { padding: 10px 12px; }
.adm-auth-card .btn { padding: 11px 16px; font-weight: 600; margin-top: 4px; }
.adm-auth > .alert { margin: 0; }
.adm-code { background: var(--bg-alt); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: 500 .9rem var(--font-mono); }
.adm-table { --bs-table-bg: transparent; --bs-table-color: var(--ink); --bs-table-border-color: var(--line); }
.adm-table th { font: 600 .72rem var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 12px; }
.adm-table td { padding: 10px 12px; }
.adm-table tr.is-hidden td { opacity: .55; }
.adm-table tr.is-deleted td { opacity: .35; text-decoration: line-through; }
.adm-thumb { width: 72px; height: 45px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.adm-list { list-style: none; margin: 0; padding: 0; }
.adm-list li { padding: 10px 0; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.adm-list li:last-child { border-bottom: 0; }
.adm-list li.unread strong { color: var(--ink); }
.adm-list li.unread::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-top: 8px; }
.adm-inbox li { padding: 0; display: flex; align-items: flex-start; }
.adm-inbox li::before { margin: 20px 0 0 14px; }
.adm-inbox li a { display: grid; gap: 4px; padding: 12px 16px; color: var(--ink); text-decoration: none; flex: 1; min-width: 0; }
.adm-inbox li a:hover { background: var(--bg-alt); }
.adm-checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 16px; }

/* albums */
.adm-albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.adm-album { display: grid; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; text-decoration: none; color: var(--ink); }
.adm-album:hover { border-color: var(--muted); color: var(--ink); }
.adm-album.is-hidden { opacity: .6; }
.adm-album-img { aspect-ratio: 16/10; background: var(--chip); display: block; }
.adm-album-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.adm-album-body { display: grid; gap: 4px; padding: 10px 12px 12px; }
.adm-album-body .tag { justify-self: start; }

/* upload + photo grid */
.dropzone { display: grid; place-items: center; gap: 6px; text-align: center; padding: 28px 16px; border: 2px dashed var(--line); border-radius: 12px; cursor: pointer; background: var(--bg); transition: border-color .15s, background .15s; margin: 0; }
.dropzone i { font-size: 1.8rem; color: var(--accent-text); }
.dropzone:hover, .dropzone.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg)); }
.upload-progress { display: grid; gap: 6px; margin-top: 12px; }
.upload-progress .bar { height: 8px; background: var(--chip); border-radius: 4px; overflow: hidden; }
.upload-progress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.adm-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.adm-photo { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: grab; display: grid; }
.adm-photo img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: var(--chip); }
.adm-photo.dragging { opacity: .4; }
.adm-photo.is-hidden img { opacity: .35; }
.adm-photo.is-cover { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.adm-photo-badges { position: absolute; top: 6px; left: 6px; display: flex; gap: 4px; }
.adm-photo-badges .tag { display: none; }
.adm-photo.is-cover .badge-cover, .adm-photo.is-hidden .badge-hidden { display: inline-block; }
.adm-photo .badge-cover { background: var(--accent); color: var(--accent-ink); }
.adm-caption { border: 0; border-top: 1px solid var(--line); background: transparent; color: var(--ink); padding: 7px 9px; font-size: .85rem; width: 100%; }
.adm-caption:focus { outline: none; background: var(--bg-alt); }
.adm-caption.saved { background: color-mix(in srgb, var(--success) 18%, transparent); }
.adm-photo-tools { display: flex; border-top: 1px solid var(--line); }
.adm-photo-tools > * { flex: 1; display: grid; place-items: center; padding: 7px 0; border: 0; background: transparent; color: var(--muted); font-size: .9rem; text-decoration: none; }
.adm-photo-tools > *:hover { background: var(--chip); color: var(--ink); }
.adm-photo-tools .danger:hover { color: var(--danger); }
.adm-photo.is-cover [data-act="cover"] { color: var(--accent-text); }
.adm-photo.is-hidden [data-act="toggle"] { color: var(--warning); }

/* New album bar at the top of /admin/photos */
.adm-newalbum { display: grid; gap: 12px; }
.adm-newalbum-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.adm-newalbum-head i { color: var(--accent-text); margin-right: 4px; }
.adm-newalbum-fields { display: grid; grid-template-columns: 2fr 1.2fr 1fr auto; gap: 12px; align-items: end; }
.adm-newalbum-fields .btn { white-space: nowrap; padding-inline: 20px; }
.adm-newalbum-fields .form-label { margin-bottom: 4px; font-size: .88rem; }
@media (max-width: 767.98px) { .adm-newalbum-fields { grid-template-columns: 1fr; } }

/* ---------- Row editors (skills, results, testimonials, tiers) ---------- */
.adm-rows { display: grid; gap: 10px; }
.adm-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 14px; align-items: start; padding: 14px 14px 14px 10px;
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px; transition: border-color .15s, opacity .15s; }
.adm-row:hover { border-color: color-mix(in srgb, var(--muted) 45%, var(--line)); }
.adm-row.is-new { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.adm-row.dragging { opacity: .45; }
.adm-row.is-deleted { opacity: .5; background: repeating-linear-gradient(135deg, transparent 0 10px, color-mix(in srgb, var(--danger, #d64545) 6%, transparent) 10px 20px), var(--surface); }
.adm-row.is-deleted .adm-row-fields { pointer-events: none; text-decoration: line-through; }
.adm-grip { cursor: grab; color: var(--muted); display: grid; place-items: center; height: 38px; border-radius: 8px; }
.adm-grip:hover { background: var(--chip); color: var(--ink); }
.adm-row-fields { display: grid; gap: 10px; min-width: 0; }
.adm-row-tools { display: flex; flex-direction: column; gap: 4px; }
.adm-row-tools button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-width: 38px; height: 34px; padding: 0 10px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--muted); font-size: .85rem; }
.adm-row-tools button span { display: none; }
.adm-row-tools button:hover { background: var(--chip); color: var(--ink); }
.adm-row-tools [data-row-act=delete]:hover { color: var(--danger, #d64545); }
.adm-row.is-deleted [data-row-act=delete] { color: var(--ink); border-color: var(--line); }
.adm-row.is-deleted [data-row-act=delete] span { display: inline; }
.adm-f { display: grid; gap: 4px; min-width: 0; }
.adm-f > span, .adm-flabel { font-size: .78rem; font-weight: 600; color: var(--muted); }
.adm-grid { display: grid; gap: 10px; }
.adm-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.adm-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.adm-grid-results { grid-template-columns: 110px minmax(0, 1.3fr) minmax(0, 1fr); }
.adm-grid-skill { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: end; }
@media (max-width: 767.98px) {
    .adm-grid-2, .adm-grid-3, .adm-grid-results, .adm-grid-skill { grid-template-columns: 1fr; }
    .adm-row { grid-template-columns: 1fr; padding: 12px; gap: 8px; }
    .adm-grip { display: none; }
    .adm-row-tools { flex-direction: row; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 8px; }
    .adm-row-tools button span { display: inline; }
    .adm-row-tools [data-row-act=up] span, .adm-row-tools [data-row-act=down] span { display: none; }
}
.adm-rows-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: var(--muted); font-size: .9rem; }
.adm-empty { text-align: center; padding: 36px 20px; color: var(--muted); border: 2px dashed var(--line); border-radius: 14px; }
.adm-empty i { font-size: 1.6rem; display: block; margin-bottom: 8px; color: var(--accent-text); }
.adm-add { width: 100%; margin-top: 10px; padding: 12px; border: 2px dashed var(--line); border-radius: 14px; background: none; color: var(--muted); font-weight: 600; }
.adm-add:hover { border-color: var(--accent); color: var(--ink); background: color-mix(in srgb, var(--accent) 6%, transparent); }

/* Score slider */
.adm-score { display: flex; align-items: center; gap: 12px; }
.adm-score input[type=range] { flex: 1; accent-color: var(--accent); }
.adm-score input[type=number] { width: 92px; text-align: center; }

/* Star rating (radio buttons) */
.adm-stars { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.adm-stars input { position: absolute; opacity: 0; width: 0; height: 0; }
.adm-stars label { cursor: pointer; font-size: 1.35rem; line-height: 1; color: var(--line); padding: 2px; }
.adm-stars input:checked ~ label, .adm-stars label:hover, .adm-stars label:hover ~ label { color: #f5b301; }
.adm-stars input:focus-visible + label { outline: 2px solid var(--accent); border-radius: 4px; }

/* Toggle switches (Bootstrap form-switch, restyled) */
.adm-switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 500; margin: 0; }
.adm-switch input { appearance: none; width: 40px; height: 22px; border-radius: 22px; background: var(--line); position: relative; cursor: pointer; transition: background .15s; flex-shrink: 0; margin: 0; }
.adm-switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.3); }
.adm-switch input:checked { background: var(--accent); }
.adm-switch input:checked::after { transform: translateX(18px); }
.adm-switch input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.adm-switch small { display: block; color: var(--muted); font-weight: 400; }

/* Segmented choice */
.adm-seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.adm-seg input { position: absolute; opacity: 0; }
.adm-seg label { padding: 6px 12px; cursor: pointer; font-size: .88rem; color: var(--muted); }
.adm-seg input:checked + label { background: var(--ink); color: var(--bg); }

/* Form sections */
.adm-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 22px; }
.adm-section + .adm-section { margin-top: 16px; }
.adm-section > h2 { font-size: 1rem; font-weight: 700; margin: 0 0 4px; }
.adm-section > h2 + p { color: var(--muted); font-size: .9rem; margin: 0 0 14px; }
.adm-section.danger { border-color: color-mix(in srgb, var(--danger, #d64545) 40%, var(--line)); }
.form-text { color: var(--muted); }
details.adm-adv { border: 1px solid var(--line); border-radius: 12px; padding: 0 16px; background: var(--bg-alt); }
details.adm-adv > summary { cursor: pointer; padding: 14px 0; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
details.adm-adv > summary::-webkit-details-marker { display: none; }
details.adm-adv > summary::before { content: "▸"; color: var(--muted); transition: transform .15s; }
details.adm-adv[open] > summary::before { transform: rotate(90deg); }
details.adm-adv[open] { padding-bottom: 16px; }

/* Lists */
.adm-search { position: relative; flex: 1 1 240px; max-width: 360px; }
.adm-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.adm-search input { padding-left: 36px; }
.adm-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 14px; }
.adm-toolbar .filters { margin: 0 !important; }
.adm-table tbody tr[data-href] { cursor: pointer; }
.adm-table tbody tr[data-href]:hover td { background: var(--bg-alt); }
.adm-count { font: 600 .72rem var(--font-mono); background: var(--chip); color: var(--muted); padding: 1px 7px; border-radius: 10px; margin-left: 4px; }

/* Dashboard */
.adm-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.adm-stat { display: flex; gap: 14px; align-items: center; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; color: var(--ink); transition: border-color .15s, transform .15s; }
.adm-stat:hover { border-color: var(--muted); transform: translateY(-2px); color: var(--ink); }
.adm-stat i { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-text); font-size: 1.1rem; }
.adm-stat b { display: block; font: 800 1.6rem/1 var(--font-display); }
.adm-stat span { color: var(--muted); font-size: .88rem; }
.adm-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.adm-tile { display: grid; gap: 4px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); text-decoration: none; color: var(--ink); }
.adm-tile:hover { border-color: var(--accent); color: var(--ink); }
.adm-tile i { color: var(--accent-text); font-size: 1.15rem; margin-bottom: 4px; }
.adm-tile strong { font-size: .98rem; }
.adm-tile span { color: var(--muted); font-size: .85rem; }
.adm-h { font-size: 1.05rem; font-weight: 700; margin: 0 0 12px; }
/* save bar hidden until something changes */
form[data-guard] .adm-savebar:not(.show) { display: none; }
.adm-savebar .when-dirty { display: none; }
form.is-dirty .adm-savebar .when-dirty { display: inline; }
form.is-dirty .adm-savebar .when-clean { display: none; }
form[data-guard]:not(.is-dirty) [data-discard] { display: none; }

/* Admin sidebar wordmark */
.adm-brand { gap: 10px; align-items: center; }
.adm-brand .brand-name > span { font-size: 1.12rem; }
.adm-brand-tag { margin-left: auto; font: 600 .62rem var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 3px 6px; }
.adm-brand-sm .brand-name > span { font-size: 1.05rem; }
.adm-auth-card .brand { gap: 12px; }
