/* Workouts Admin — "chalk & steel": cool grey surfaces, near-black nav,
   one plate-orange accent, mono for identifiers and counts. */

:root {
    --bg: #edeff2;
    --surface: #ffffff;
    --ink: #1a1e24;
    --muted: #66707c;
    --line: #dfe3e8;
    --accent: #d6491a;
    --accent-deep: #b23c13;
    --ok-bg: #e4f3e6;   --ok-line: #9fd3a8;
    --err-bg: #fbe7e5;  --err-line: #eba7a0;
    --radius: 10px;
    --mono: ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font: 15px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--bg);
}

main { max-width: 1040px; margin: 0 auto; padding: 1.4rem 1.5rem 4rem; }

/* ---- nav ---------------------------------------------------------- */

nav {
    position: sticky; top: 0; z-index: 10;
    display: flex; gap: 1.4rem; align-items: center;
    background: var(--ink); color: #fff; padding: .65rem 1.5rem;
}
nav a { color: #aeb8c4; text-decoration: none; padding: .15rem 0; }
nav a:hover { color: #fff; }
nav a[aria-current] { color: #fff; box-shadow: 0 2px 0 var(--accent); }
nav .spacer, .actions .spacer { flex: 1; }
nav .who { color: #77828f; font-size: .85rem; }

.brand, .brand-mark {
    font-weight: 750; letter-spacing: -.02em; font-size: 1.05rem; color: #fff !important;
}
.brand b, .brand-mark b { color: var(--accent); font-weight: 750; }
.brand-mark { display: block; text-align: center; font-size: 1.5rem; color: var(--ink) !important; margin-bottom: 1rem; }
.brand-mark b { color: var(--accent); }

/* ---- page header --------------------------------------------------- */

.page-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .3rem .8rem; margin: .4rem 0 1.1rem; }
.page-head h1 { margin: 0; font-size: 1.7rem; font-weight: 800; letter-spacing: -.02em; }
.page-head .button { margin-left: auto; }
.eyebrow {
    flex-basis: 100%; margin: 0;
    font: 600 .72rem var(--mono); text-transform: uppercase; letter-spacing: .14em; color: var(--muted);
}
h2 { font-size: .95rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
     color: var(--muted); margin: 1.6rem 0 .7rem; }
h2:first-of-type { margin-top: 0; }

/* ---- feedback ------------------------------------------------------ */

.flash, .error { padding: .55rem .9rem; border-radius: var(--radius); margin: 0 0 1rem; }
.flash { background: var(--ok-bg); border: 1px solid var(--ok-line); }
.error { background: var(--err-bg); border: 1px solid var(--err-line); }
.muted { color: var(--muted); }
.empty { padding: 2.5rem 0; text-align: center; }

.count { margin: .2rem 0 .6rem; color: var(--muted); font-size: .9rem; }
code, .slug { font: .82rem var(--mono); color: var(--muted); }
.name .slug { display: block; margin-top: .1rem; }

/* ---- toolbar / filters --------------------------------------------- */

.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.toolbar input[type=search], .toolbar input[name=name] { flex: 1; min-width: 180px; }

/* ---- table --------------------------------------------------------- */

table {
    width: 100%; border-collapse: collapse;
    background: var(--surface); border-radius: var(--radius);
    overflow: hidden; box-shadow: 0 1px 2px rgb(26 30 36 / .06);
}
th, td { text-align: left; padding: .55rem .8rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); background: #f6f7f9; }
tbody tr:hover td, tr:hover td { background: #fafbfc; }
td.thumb { width: 64px; }
td.thumb img, td.thumb video { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; display: block; }
td.name a { font-weight: 600; color: var(--ink); text-decoration: none; }
td.name a:hover { color: var(--accent-deep); }
td.row-end { text-align: right; }

.pill {
    display: inline-block; padding: .1rem .6rem; border-radius: 99px;
    font: 600 .78rem var(--mono); text-decoration: none;
    background: hsl(var(--h, 210) 45% 92%); color: hsl(var(--h, 210) 55% 28%);
}
.tag {
    display: inline-block; margin: .1rem .25rem .1rem 0; padding: .05rem .5rem;
    border-radius: 99px; background: #eef1f4; color: var(--muted); font-size: .78rem;
}
.tag.more { background: transparent; border: 1px dashed var(--line); }

/* ---- forms --------------------------------------------------------- */

.card {
    background: var(--surface); padding: 1.3rem 1.4rem; border-radius: var(--radius);
    border: 1px solid var(--line); box-shadow: 0 1px 2px rgb(26 30 36 / .06);
    margin-bottom: 1.2rem;
}
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: .4rem .9rem; }

label { display: flex; flex-direction: column; gap: .25rem; margin-bottom: .8rem; font-weight: 600; font-size: .88rem; }
input, select, textarea, button, .button {
    font: inherit; font-size: .95rem; padding: .45rem .65rem;
    border: 1px solid #c6cdd5; border-radius: 8px; background: var(--surface); color: var(--ink);
}
:is(input, select, textarea):focus-visible, .chip input:focus-visible + span {
    outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
textarea { resize: vertical; line-height: 1.5; }

button, .button {
    background: var(--accent); color: #fff; border-color: var(--accent);
    cursor: pointer; text-decoration: none; display: inline-block; font-weight: 650;
    transition: background .12s ease;
}
button:hover, .button:hover { background: var(--accent-deep); }
button:focus-visible, .button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.ghost { background: transparent; color: var(--ink); border-color: #c6cdd5; }
.ghost:hover { background: #f1f3f5; }
.ghost.danger { color: #b02a1c; border-color: #ddb1ab; }
.ghost.danger:hover { background: var(--err-bg); }
button:disabled, .ghost.danger:disabled, .ghost.danger:disabled:hover {
    background: transparent; color: #a7b0ba; border-color: var(--line); cursor: not-allowed;
}

.actions { display: flex; gap: .5rem; align-items: center; margin-top: 1.2rem; }
form.inline { display: flex; gap: .4rem; margin: 0; }

/* ---- muscle chips --------------------------------------------------- */

fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem .9rem .5rem; margin: 0 0 .9rem; }
legend { font-size: .82rem; font-weight: 650; color: var(--muted); padding: 0 .4rem; }

.chip-row { display: flex; gap: .6rem; align-items: baseline; padding: .25rem 0; }
.chip-row-label { flex: 0 0 5.5rem; font: 600 .72rem var(--mono); text-transform: uppercase;
                  letter-spacing: .1em; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }

.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
    display: inline-block; padding: .18rem .7rem; border-radius: 99px;
    border: 1px solid #c6cdd5; background: var(--surface);
    font-size: .84rem; font-weight: 500; cursor: pointer; user-select: none;
    transition: background .1s ease, border-color .1s ease;
}
.chip span:hover { border-color: var(--accent); }
.chip input:checked + span {
    background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600;
}

/* ---- media / demo --------------------------------------------------- */

.media-body { display: flex; flex-wrap: wrap; gap: 1.2rem; align-items: flex-start; }
.preview { max-height: 220px; max-width: 320px; border-radius: 8px; display: block; }
.media-frame:empty {
    display: flex; align-items: center; justify-content: center;
    width: 220px; height: 140px; border: 1px dashed #c6cdd5; border-radius: 8px;
    color: var(--muted); font-size: .85rem;
}
.media-frame:empty::after { content: "No demo yet"; }

label.check { flex-direction: row; align-items: center; gap: .45rem; font-weight: 500; }
label.check input { accent-color: var(--accent); width: 1.05rem; height: 1.05rem; margin: 0; }
label.check:has(input:disabled) { color: #a7b0ba; }
.media-actions { display: flex; flex-direction: column; gap: .6rem; }
.media-actions form { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
input[type=file] { border: 1px dashed #c6cdd5; background: #fafbfc; max-width: 320px; }

/* ---- login / pager --------------------------------------------------- */

.login { max-width: 340px; margin: 12vh auto 0; }
.login .card label { font-weight: 600; }
.login button { width: 100%; margin-top: .3rem; }

.pager { display: flex; gap: .5rem; align-items: center; margin-top: 1rem; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; }
}

@media (max-width: 640px) {
    main { padding: 1rem; }
    .chip-row { flex-direction: column; gap: .25rem; }
    td.muscles { display: none; }
}
