/* ============================================================
   Admin area.

   A separate shell from the marketing site: no navbar, no footer,
   no assistant widget. Someone signing in to publish is not a
   visitor being sold to, and the closing CTA band under a post
   editor would be absurd.

   Uses the same tokens as everything else so it still looks like
   this company's software, not a bolted-on control panel.
   ============================================================ */

.admin-body {
    min-height: 100vh;
    background: var(--bg-alt);
    font-family: var(--font-body);
    color: var(--text-main);
}

/* ---------- sign-in ---------- */
.signin-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem 1.5rem;
    background:
        radial-gradient(1000px 500px at 15% -10%, rgba(0, 150, 199, .30), transparent 60%),
        radial-gradient(800px 420px at 85% 5%, rgba(0, 180, 216, .20), transparent 60%),
        var(--brand-dark);
}

.signin-card {
    width: 100%;
    max-width: 26rem;
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 2.75rem 2.5rem;
    box-shadow: 0 30px 60px -12px rgba(1, 25, 38, .45);
}

.signin-card .logo {
    display: block;
    height: 38px;
    margin: 0 auto 2rem;
}

.signin-card h1 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    line-height: 1.3;
    margin: 0 0 .4rem;
    text-align: center;
}

.signin-card .sub {
    text-align: center;
    font-size: .89rem;
    color: var(--text-light);
    margin: 0 0 2rem;
}

.field { margin-bottom: 1.15rem; }

.field label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    margin-bottom: .45rem;
    color: var(--text-muted);
}

.field input[type="email"],
.field input[type="password"],
.field input[type="text"] {
    width: 100%;
    padding: .8rem .95rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font-body);
    font-size: .95rem;
    color: var(--text-main);
    background: var(--white);
    transition: border-color .2s, box-shadow .2s;
}

.field input:focus {
    outline: none;
    border-color: var(--brand-medium);
    box-shadow: 0 0 0 3px rgba(0, 150, 199, .14);
}

.field input[aria-invalid="true"] {
    border-color: var(--brand-pink);
}

.field-error {
    display: block;
    margin-top: .45rem;
    font-size: .82rem;
    color: var(--brand-pink);
}

.field-row {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-bottom: 1.6rem;
    font-size: .86rem;
    color: var(--text-muted);
}

.field-row input { accent-color: var(--brand-primary); }

.signin-card .btn {
    width: 100%;
    justify-content: center;
    padding: .85rem 1.5rem;
    border-radius: var(--radius-full);
    background: var(--brand-primary);
    color: var(--white);
    font-family: var(--font-body);
    font-size: .95rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
}

.signin-card .btn:hover { background: var(--brand-medium); transform: translateY(-1px); }
.signin-card .btn:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 3px; }

/* A failed sign-in must be obvious without being alarming. */
.alert {
    padding: .85rem 1rem;
    border-radius: var(--radius-md);
    font-size: .87rem;
    line-height: 1.5;
    margin-bottom: 1.5rem;
    background: rgba(239, 71, 111, .08);
    border: 1px solid rgba(239, 71, 111, .28);
    color: #9b1c3c;
}

.signin-foot {
    margin-top: 1.75rem;
    text-align: center;
    font-size: .78rem;
    color: var(--text-light);
    line-height: 1.6;
}

/* ---------- dashboard shell ---------- */
.admin-top {
    background: var(--brand-dark);
    color: var(--white);
    padding: 1rem 0;
}

.admin-top .container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.admin-top img { height: 30px; }

.admin-top nav {
    display: flex;
    gap: 1.5rem;
    margin-left: 1rem;
    font-size: .9rem;
}

.admin-top nav a {
    color: rgba(255, 255, 255, .78);
    text-decoration: none;
    padding: .3rem 0;
    border-bottom: 2px solid transparent;
    transition: var(--transition);
}

.admin-top nav a:hover { color: var(--white); }
.admin-top nav a.on { color: var(--white); border-bottom-color: var(--brand-accent); }

.admin-who {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: .9rem;
    font-size: .84rem;
    color: rgba(255, 255, 255, .7);
}

.admin-who form { margin: 0; }

.admin-who button {
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .2);
    color: var(--white);
    padding: .4rem .9rem;
    border-radius: var(--radius-full);
    font-family: var(--font-body);
    font-size: .8rem;
    cursor: pointer;
    transition: var(--transition);
}

.admin-who button:hover { background: rgba(255, 255, 255, .18); }

.admin-main { padding: 3rem 0 5rem; }

.admin-main h1 {
    font-family: var(--font-heading);
    font-size: 1.65rem;
    margin: 0 0 .5rem;
}

.admin-main .lede {
    color: var(--text-light);
    font-size: .95rem;
    margin: 0 0 2.5rem;
}

@media (max-width: 700px) {
    .admin-top .container { flex-wrap: wrap; gap: .85rem; }
    .admin-top nav { margin-left: 0; order: 3; width: 100%; }
    .signin-card { padding: 2rem 1.5rem; }
}

/* ============================================================
   Articles — list and editor
   ============================================================ */

.admin-head {
    display: flex;
    align-items: flex-start;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.admin-head .grow { flex: 1 1 auto; }
.admin-head h1 { margin-bottom: .35rem; }

.btn-admin {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    padding: .7rem 1.35rem;
    border-radius: var(--radius-full);
    background: var(--brand-primary);
    color: var(--white);
    font-family: var(--font-body);
    font-size: .9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: var(--transition);
}

.btn-admin:hover { background: var(--brand-medium); transform: translateY(-1px); }
.btn-admin:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 3px; }

.btn-quiet {
    background: var(--white);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.btn-quiet:hover { background: var(--bg-alt); color: var(--brand-primary); }

/* Anything that removes or unpublishes reads as a warning, never as a
   primary action sitting next to Save. */
.btn-danger { background: var(--white); color: #9b1c3c; border: 1px solid rgba(239, 71, 111, .4); }
.btn-danger:hover { background: rgba(239, 71, 111, .08); color: #9b1c3c; }

.notice {
    padding: .9rem 1.15rem;
    border-radius: var(--radius-md);
    font-size: .9rem;
    margin-bottom: 1.75rem;
    border: 1px solid;
}

.notice-ok { background: rgba(0, 150, 199, .07); border-color: rgba(0, 150, 199, .3); color: #04506b; }
.notice-err { background: rgba(239, 71, 111, .08); border-color: rgba(239, 71, 111, .3); color: #9b1c3c; }

/* ---------- filter tabs ---------- */
.admin-tabs { display: flex; gap: .5rem; margin-bottom: 1.5rem; }

.admin-tabs a {
    padding: .45rem 1rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border);
    background: var(--white);
    font-size: .85rem;
    color: var(--text-muted);
    text-decoration: none;
    transition: var(--transition);
}

.admin-tabs a:hover { border-color: var(--brand-medium); color: var(--brand-primary); }
.admin-tabs a.on { background: var(--brand-dark); border-color: var(--brand-dark); color: var(--white); }
.admin-tabs a .n { opacity: .6; font-family: var(--font-mono); font-size: .76rem; margin-left: .3rem; }

/* ---------- list ---------- */
.post-list { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }

.post-row {
    display: flex;
    align-items: center;
    gap: 1.15rem;
    padding: 1rem 1.35rem;
    border-bottom: 1px solid var(--border);
}

.post-row:last-child { border-bottom: 0; }
.post-row:hover { background: var(--bg-alt); }

.post-row .thumb {
    width: 62px; height: 40px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--bg-alt);
    flex-shrink: 0;
}

.post-row .meat { flex: 1 1 auto; min-width: 0; }

.post-row .t {
    font-weight: 600;
    font-size: .95rem;
    color: var(--text-main);
    text-decoration: none;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.post-row .t:hover { color: var(--brand-primary); }

.post-row .sub {
    font-family: var(--font-mono);
    font-size: .7rem;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--text-light);
    margin-top: .3rem;
}

.pill {
    font-family: var(--font-mono);
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    padding: .28rem .6rem;
    border-radius: var(--radius-full);
    white-space: nowrap;
}

.pill-live { background: rgba(0, 150, 199, .12); color: #04506b; }
.pill-draft { background: rgba(251, 133, 0, .14); color: #8a4a00; }
.pill-src { background: var(--bg-alt); color: var(--text-light); }

.post-row .acts { display: flex; gap: .5rem; flex-shrink: 0; }
.post-row .acts form { margin: 0; }

.post-row .acts .btn-admin { padding: .45rem .9rem; font-size: .8rem; }

.empty-state { padding: 4rem 1.5rem; text-align: center; color: var(--text-light); }

/* ---------- editor ---------- */
.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 2rem; align-items: start; }

.editor-main, .editor-side {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
}

.editor-side { position: sticky; top: 1.5rem; }
.editor-side h3 { font-family: var(--font-heading); font-size: .95rem; margin: 0 0 1.15rem; }
.editor-side .field label { font-size: .76rem; }

.title-input {
    width: 100%;
    border: 0;
    border-bottom: 2px solid var(--border);
    padding: .4rem 0 .7rem;
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
    background: transparent;
    margin-bottom: 1.25rem;
}

.title-input:focus { outline: none; border-bottom-color: var(--brand-medium); }
.title-input::placeholder { color: #b8c2c9; }

/* toolbar */
.ed-bar {
    display: flex;
    flex-wrap: wrap;
    gap: .3rem;
    padding: .5rem;
    border: 1px solid var(--border);
    border-bottom: 0;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    background: var(--bg-alt);
}

.ed-bar button {
    min-width: 34px;
    height: 32px;
    padding: 0 .55rem;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    background: transparent;
    font-family: var(--font-body);
    font-size: .82rem;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
}

.ed-bar button:hover { background: var(--white); border-color: var(--border); color: var(--brand-primary); }
.ed-bar button:focus-visible { outline: 2px solid var(--brand-accent); outline-offset: 1px; }
.ed-bar .sep { width: 1px; background: var(--border); margin: .2rem .35rem; }

/* the writing surface — mirrors the published prose scale so what is typed
   looks like what will be read */
.ed-surface {
    min-height: 26rem;
    max-height: 60vh;
    overflow-y: auto;
    padding: 1.5rem;
    border: 1px solid var(--border);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    font-size: 1.02rem;
    line-height: 1.75;
    color: var(--text-muted);
}

.ed-surface:focus { outline: none; border-color: var(--brand-medium); box-shadow: 0 0 0 3px rgba(0, 150, 199, .1); }
.ed-surface h2 { font-family: var(--font-heading); font-size: 1.45rem; margin: 2rem 0 .8rem; color: var(--text-main); }
.ed-surface h3 { font-family: var(--font-heading); font-size: 1.13rem; margin: 1.5rem 0 .6rem; color: var(--text-main); }
.ed-surface p { margin: 0 0 1.1rem; }
.ed-surface ul, .ed-surface ol { margin: 0 0 1.1rem; padding-left: 1.3rem; }
.ed-surface li { margin-bottom: .4rem; }
.ed-surface a { color: var(--brand-primary); text-decoration: underline; }
.ed-surface img { max-width: 100%; border-radius: var(--radius-sm); }
.ed-surface blockquote {
    margin: 1.5rem 0; padding-left: 1rem;
    border-left: 3px solid var(--brand-accent);
    font-style: italic; color: var(--text-main);
}
.ed-surface:empty::before { content: attr(data-placeholder); color: #b8c2c9; }

.ed-count {
    margin-top: .6rem;
    font-family: var(--font-mono);
    font-size: .72rem;
    color: var(--text-light);
    text-align: right;
}

.side-actions { display: flex; flex-direction: column; gap: .6rem; margin-top: 1.5rem; }
.side-actions form { margin: 0; }
.side-actions .btn-admin { width: 100%; justify-content: center; }

.side-status {
    padding: .8rem 1rem;
    border-radius: var(--radius-md);
    font-size: .84rem;
    line-height: 1.5;
    margin-bottom: 1.25rem;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    color: var(--text-muted);
}

.slug-preview {
    font-family: var(--font-mono);
    font-size: .74rem;
    color: var(--text-light);
    margin-top: .4rem;
    word-break: break-all;
}

.cat-picker { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }

.cat-picker label {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .35rem .7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-full);
    font-size: .78rem;
    font-weight: 400;
    color: var(--text-muted);
    cursor: pointer;
    margin: 0;
}

.cat-picker label:has(input:checked) {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: var(--white);
}

.cat-picker input { accent-color: var(--brand-accent); margin: 0; }

@media (max-width: 900px) {
    .editor-grid { grid-template-columns: 1fr; }
    .editor-side { position: static; }
    .post-row { flex-wrap: wrap; }
    .post-row .acts { width: 100%; }
}

.feat-preview {
    width: 100%;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    display: block;
    background: var(--bg-alt);
}

/* Compliance flags on the import screen. Deliberately loud: this is the
   check that exists because an unread article nearly went out. */
.flagbox {
    margin-top: .8rem;
    padding: .75rem .9rem;
    border-radius: var(--radius-md);
    background: rgba(251, 133, 0, .07);
    border: 1px solid rgba(251, 133, 0, .3);
    border-left: 3px solid var(--brand-orange);
}

.flaghead {
    font-family: var(--font-mono);
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: #8a4a00;
    margin-bottom: .5rem;
}

.flagline {
    margin: 0 0 .2rem;
    font-size: .86rem;
    line-height: 1.5;
    color: var(--text-main);
    font-style: italic;
}

.flagwhy {
    margin: 0 0 .7rem;
    font-size: .78rem;
    line-height: 1.45;
    color: var(--text-light);
}

.flagbox p:last-child { margin-bottom: 0; }

.userform { margin: 0; }

.userform select,
.field select {
    padding: .5rem .7rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--white);
    font-family: var(--font-body);
    font-size: .85rem;
    color: var(--text-muted);
    cursor: pointer;
}

.field select { width: 100%; padding: .8rem .95rem; font-size: .95rem; }
.userform select:disabled { opacity: .5; cursor: not-allowed; }
