/* Alex Pyle Music — admin area */

:root {
    --bg: #f5f5ef;
    --panel: #fff;
    --text: #2c3a3a;
    --muted: #6b7b7a;
    --line: #dfe3dc;
    --teal: #557473;
    --teal-dark: #3f5958;
    --green: #77a78a;
    --green-soft: #e3efe7;
    --warn: #9a6a00;
    --warn-soft: #fbf0d4;
    --danger: #b3261e;
    --radius: 8px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.55 'Quicksand', system-ui, sans-serif; }
a { color: var(--teal); }
h1 { font-size: 28px; font-weight: 600; margin: 0 0 6px; }
h2 { font-size: 20px; font-weight: 600; margin: 0 0 12px; }
.mt { margin-top: 36px; }
.muted { color: var(--muted); margin-top: 0; }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
img { max-width: 100%; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

/* Top bar */
.topbar { background: var(--teal); color: #fff; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; padding: 12px 24px; }
.topbar__brand { color: #fff; text-decoration: none; font-weight: 600; font-size: 18px; }
.topbar__brand span { font-weight: 400; opacity: .75; }
.topbar__nav { display: flex; flex: 1; flex-wrap: wrap; align-items: center; gap: 4px; }
.topbar__nav a, .linklike { color: #fff; text-decoration: none; padding: 6px 12px; border-radius: 6px; font: inherit; font-size: 15px; background: none; border: 0; cursor: pointer; }
.topbar__nav a:hover, .linklike:hover { background: rgba(255,255,255,.12); }
.topbar__nav a.is-active { background: rgba(255,255,255,.2); }
.topbar__nav form { margin: 0; }
.topbar__spacer { flex: 1; }
.topbar__toggle { display: none; margin-left: auto; background: none; border: 1px solid rgba(255,255,255,.5); color: #fff; border-radius: 6px; padding: 4px 12px; font: inherit; }
@media (max-width: 900px) {
    .topbar__toggle { display: block; }
    .topbar__nav { display: none; flex-basis: 100%; flex-direction: column; align-items: stretch; }
    .topbar__nav.is-open { display: flex; }
    .topbar__spacer { display: none; }
    .linklike { text-align: left; width: 100%; }
}

.admin-main { max-width: 1100px; margin: 0 auto; padding: 32px 20px 80px; }
.auth-main { min-height: 100vh; display: grid; place-items: center; padding: 20px; }

.flash { background: var(--green-soft); border: 1px solid var(--green); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 24px; }
.auth-main .flash { position: fixed; top: 20px; left: 50%; transform: translateX(-50%); }
.notice { background: var(--warn-soft); border: 1px solid #e8cf8a; border-radius: var(--radius); padding: 14px 18px; margin: 20px 0; }

/* Buttons */
.btn { display: inline-block; background: var(--teal); color: #fff; border: 0; border-radius: 6px; padding: 10px 20px; font: 600 15px/1.3 inherit; font-family: inherit; text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--teal-dark); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn--small { padding: 6px 12px; font-size: 14px; }
.btn--block { width: 100%; }
.btn--ghost { background: transparent; color: var(--teal); border: 1px solid var(--line); }
.btn--ghost:hover { background: var(--green-soft); }
.btn--danger { background: transparent; color: var(--danger); border: 1px solid #ecc5c2; }
.btn--danger:hover { background: #fbeceb; }
.icon-btn { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; width: 32px; height: 30px; cursor: pointer; font-size: 15px; color: var(--teal); }
.icon-btn:hover:not(:disabled) { background: var(--green-soft); }
.icon-btn:disabled { opacity: .3; cursor: default; }

/* Page layout */
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head p { margin: 0; max-width: 640px; }
.crumbs { margin: 0 0 8px; }
.crumbs a { text-decoration: none; }
.empty { background: var(--panel); border: 1px dashed var(--line); border-radius: var(--radius); padding: 30px; text-align: center; color: var(--muted); }

/* Dashboard */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin: 28px 0 36px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.tile__main { text-decoration: none; color: var(--text); }
.tile__count { display: block; font-size: 34px; font-weight: 600; color: var(--teal); line-height: 1; }
.tile__label { color: var(--muted); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel__head { display: flex; justify-content: space-between; align-items: baseline; }
.badge { display: inline-block; background: #e8a33d; color: #fff; border-radius: 999px; font-size: 12px; font-weight: 600; padding: 1px 8px; margin-left: 4px; vertical-align: middle; }

/* Tags */
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #e7e7e1; color: #555; }
.tag--plain { background: #eef0ec; font-weight: 500; }
.tag--green { background: var(--green-soft); color: #2f6a47; }
.tag--warn { background: var(--warn-soft); color: var(--warn); }

/* Photo grid */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; }
.photo-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; }
.photo-card__img { position: relative; display: block; aspect-ratio: 4 / 3; background: #eee; }
.photo-card__img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-card__img .tag { position: absolute; top: 8px; left: 8px; }
.photo-card.is-hidden img { opacity: .45; }
.photo-card__caption { margin: 10px 12px 4px; font-size: 14px; flex: 1; }
.photo-card__actions { display: flex; align-items: center; gap: 6px; padding: 10px 12px 12px; flex-wrap: wrap; }
.photo-card__actions form { margin: 0; }
.photo-card__actions .btn--ghost { margin-left: auto; }

/* Lists */
.list { display: flex; flex-direction: column; gap: 10px; }
.list-row { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: flex; gap: 16px; align-items: center; }
.list-row.is-hidden { background: #fafaf7; }
.list-row.is-hidden .list-row__thumb img { opacity: .45; }
.list-row__thumb { flex: none; width: 120px; aspect-ratio: 16 / 9; background: #e9ebe6; border-radius: 4px; overflow: hidden; }
.list-row__thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.list-row__body { flex: 1; min-width: 0; }
.list-row__title { font-weight: 600; text-decoration: none; }
.list-row__excerpt { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.list-row__actions { display: flex; gap: 6px; align-items: center; }
.list-row__actions form { margin: 0; }
.move { display: flex; flex-direction: column; gap: 4px; }
.photo-card .move { flex-direction: row; }
.move form { margin: 0; }
@media (max-width: 640px) {
    .list-row { flex-wrap: wrap; }
    .list-row__thumb { width: 90px; }
    .list-row__actions { width: 100%; justify-content: flex-end; }
}

/* Tables */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.panel .table-wrap { border: 0; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th, .table td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }
.table tr.is-unread td { font-weight: 600; }
.table tr.is-hidden td { color: var(--muted); }
.table .actions { display: flex; gap: 6px; justify-content: flex-end; }
.table .actions form { margin: 0; }

/* Forms */
.form-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; max-width: 720px; margin-top: 16px; }
.field { margin-bottom: 20px; }
.field > label, .field .label { display: block; font-weight: 600; margin-bottom: 6px; }
.req { color: var(--danger); }
.field input[type=text], .field input[type=email], .field input[type=password], .field input[type=url], .field input[type=date], .field textarea {
    width: 100%; padding: 10px 12px; border: 1px solid #c9cfc6; border-radius: 6px; font: inherit; background: #fff; color: var(--text);
}
.field input:focus, .field textarea:focus { outline: 2px solid var(--green); outline-offset: 0; border-color: var(--green); }
.field input[type=file] { display: block; width: 100%; padding: 14px; border: 2px dashed #c9cfc6; border-radius: var(--radius); background: #fafaf7; font: inherit; }
.field--check label { display: flex; gap: 10px; align-items: center; font-weight: 500; cursor: pointer; }
.field--check input { width: 18px; height: 18px; accent-color: var(--teal); }
.inline-check { display: flex; gap: 8px; align-items: center; margin: 8px 0 12px; font-weight: 500; }
.help { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
.error { color: var(--danger); font-size: 14px; margin: 6px 0 0; font-weight: 600; }
.has-error input, .has-error textarea { border-color: var(--danger) !important; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
@media (max-width: 560px) { .field-row { grid-template-columns: 1fr; } }
.form-actions { display: flex; gap: 16px; align-items: center; margin-top: 8px; }
.segmented { display: flex; flex-wrap: wrap; gap: 8px; }
.segmented label { display: flex; align-items: center; gap: 8px; border: 1px solid #c9cfc6; border-radius: 6px; padding: 8px 14px; cursor: pointer; font-weight: 500; }
.segmented label:has(input:checked) { border-color: var(--teal); background: var(--green-soft); }
.segmented input { accent-color: var(--teal); }
.preview { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.preview img { height: 90px; border-radius: 4px; }
.edit-preview { display: block; max-height: 360px; max-width: 100%; border-radius: var(--radius); margin-bottom: 20px; background: #000; }
.edit-preview--small { max-height: 160px; margin-bottom: 4px; }
.danger-zone { max-width: 720px; margin-top: 24px; text-align: right; }
.danger-zone form { display: inline; }

.details { display: grid; grid-template-columns: 130px 1fr; gap: 8px 16px; margin: 0 0 20px; }
.details dt { color: var(--muted); font-weight: 600; }
.details dd { margin: 0; }
.message-body { background: var(--bg); border-radius: 6px; padding: 16px 18px; margin-bottom: 20px; white-space: normal; }

.pagination { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; color: var(--muted); }
.pagination .disabled { opacity: .4; }

/* Login */
.auth-card { width: min(400px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 32px; box-shadow: 0 10px 30px rgba(0,0,0,.05); }
.auth-card h1 { color: var(--teal); }
.auth-card__foot { text-align: center; margin: 20px 0 0; font-size: 14px; }
