:root {
    --ink: #1d2027;
    --muted: #68707f;
    --line: #e2e5ea;
    --panel: #ffffff;
    --page: #f4f5f7;
    --sidebar: #20232a;
    --sidebar-hover: #30343d;
    --accent: #e74b32;
    --accent-dark: #c83a25;
    --focus: #2563eb;
    --success: #198754;
    --warning: #a86200;
    --danger: #bd2c2c;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--page);
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background: var(--page);
    font-size: 15px;
    line-height: 1.5;
}

a {
    color: #275dad;
}

a:hover {
    color: #163f7e;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: .6rem 1rem;
    border: 0;
    border-radius: 6px;
    color: #fff;
    background: var(--accent);
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
}

button:hover,
.button:hover {
    color: #fff;
    background: var(--accent-dark);
}

button:focus-visible,
.reject-action summary:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--focus) 35%, transparent);
    outline-offset: 2px;
}

input,
select,
textarea {
    width: 100%;
    min-height: 40px;
    padding: .55rem .65rem;
    border: 1px solid #c9ced6;
    border-radius: 5px;
    color: var(--ink);
    background: #fff;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

label {
    display: grid;
    gap: .35rem;
    color: #3e4653;
    font-size: .88rem;
    font-weight: 700;
}

.topbar {
    position: sticky;
    z-index: 20;
    top: 0;
    display: flex;
    align-items: center;
    min-height: 64px;
    padding: .65rem 1.25rem;
    color: #fff;
    background: #17191e;
    box-shadow: 0 2px 8px rgb(0 0 0 / 20%);
}

.brand-mark {
    display: inline-flex;
    align-items: baseline;
    gap: .85rem;
    color: #fff;
    text-decoration: none;
}

.brand-word {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.65rem;
    font-weight: 700;
    letter-spacing: .08em;
    line-height: 1;
}

.brand-word span {
    color: var(--accent);
}

.brand-product {
    color: #aeb4bf;
    font-size: .78rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.app-shell {
    display: grid;
    grid-template-columns: 232px minmax(0, 1fr);
    min-height: calc(100vh - 64px);
}

.sidebar {
    min-width: 0;
    padding: 1rem .75rem;
    color: #d8dce3;
    background: var(--sidebar);
}

.sidebar-label {
    margin: .35rem .7rem .55rem;
    color: #8f96a3;
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.sidebar nav {
    display: grid;
    gap: .2rem;
}

.sidebar a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 40px;
    padding: .55rem .7rem;
    border-radius: 5px;
    color: #e9ebef;
    font-weight: 650;
    text-decoration: none;
}

.sidebar a:hover {
    color: #fff;
    background: var(--sidebar-hover);
}

.sidebar .account-links {
    padding-top: 1rem;
    border-top: 1px solid #393d45;
    margin-top: 1rem;
}

.content {
    width: 100%;
    min-width: 0;
    max-width: 1480px;
    padding: 1.6rem clamp(1rem, 2.5vw, 2.5rem) 3rem;
}

.content-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.15rem;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: .3rem;
    font-size: clamp(1.65rem, 2vw, 2.15rem);
    line-height: 1.2;
}

h2 {
    font-size: 1.15rem;
}

.lede,
.muted {
    color: var(--muted);
}

.panel,
section,
.auth-card {
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--panel);
    box-shadow: 0 1px 2px rgb(20 24 32 / 5%);
}

.panel {
    padding: 1rem;
    margin-bottom: 1rem;
}

section {
    padding: 1.15rem;
    margin-top: 1rem;
}

.filter-bar {
    display: grid;
    grid-template-columns: repeat(5, minmax(120px, 1fr)) auto;
    gap: .75rem;
    align-items: end;
}

.table-shell {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: .75rem .8rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    color: #505866;
    background: #f8f9fb;
    font-size: .72rem;
    letter-spacing: .06em;
    text-transform: uppercase;
}

tbody tr:last-child td {
    border-bottom: 0;
}

tbody tr:hover {
    background: #fafbfc;
}

.submission-title {
    font-weight: 700;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: .2rem .55rem;
    border-radius: 999px;
    color: #394150;
    background: #e8ebef;
    font-size: .75rem;
    font-weight: 800;
    white-space: nowrap;
}

.status-new {
    color: #1e4f91;
    background: #e5efff;
}

.status-pending {
    color: #744700;
    background: #fff0c9;
}

.status-paid {
    color: #14613d;
    background: #dff5e9;
}

.status-published {
    color: #27603a;
    background: #dcefe1;
}

.status-rejected,
.status-trash {
    color: #842626;
    background: #f8e1e1;
}

.writer-classification {
    display: block;
    margin-top: 0.25rem;
    color: var(--muted);
    font-size: 0.78rem;
}

.select-all {
    align-items: center;
    display: inline-flex;
    gap: 0.4rem;
    white-space: nowrap;
}

.filter-search {
    min-width: min(18rem, 100%);
}

.filter-context {
    margin: -0.4rem 0 1rem;
}

.destructive-action {
    align-items: center;
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    margin-top: 1rem;
}

.destructive-action p {
    margin: 0.25rem 0 0;
}

.unviewed {
    display: block;
    margin-top: .25rem;
    color: var(--accent-dark);
    font-size: .72rem;
    font-weight: 800;
}

.metadata {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    gap: .75rem;
}

.metadata dl {
    padding: .75rem;
    border: 1px solid var(--line);
    border-radius: 7px;
    margin: 0;
    background: #fff;
}

.metadata dt {
    color: var(--muted);
    font-size: .7rem;
    font-weight: 800;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.metadata dd {
    margin: .2rem 0 0;
    font-weight: 700;
}

.text {
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.action-groups {
    display: grid;
    gap: 1rem;
}

.action-panel {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fafbfc;
}

.action-panel h3 {
    margin-bottom: .75rem;
    font-size: 1rem;
}

.review-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .65rem;
    align-items: end;
}

.review-toolbar form {
    margin: 0;
}

.review-toolbar button,
.reject-action summary {
    width: auto;
    white-space: nowrap;
}

.rank-control {
    display: flex;
    gap: .4rem;
}

.rank-control select {
    width: 72px;
}

.button-success {
    background: var(--success);
}

.payment-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    white-space: nowrap;
}

.payment-actions form {
    margin: 0;
}

.queue-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap;
}

.queue-actions form {
    margin: 0;
}

.submission-title-cell {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
}

.submission-title-cell .js-toggle-preview {
    flex: 0 0 auto;
    padding: 0.35rem 0.55rem;
    font-size: 0.82rem;
}

.queue-preview-row td {
    padding: 0;
    background: #f7f8fa;
}

.queue-preview {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}

.queue-preview article {
    max-width: none;
}

.queue-preview .content-header {
    margin-top: 0;
}

.queue-reject-action {
    position: relative;
}

.queue-reject-action summary {
    color: var(--danger);
    cursor: pointer;
    font-weight: 700;
}

.queue-reject-action form {
    position: absolute;
    z-index: 10;
    top: calc(100% + 0.5rem);
    right: 0;
    width: min(22rem, 70vw);
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 0.65rem;
    background: var(--panel);
    box-shadow: 0 0.8rem 2rem rgb(24 31 43 / 18%);
    white-space: normal;
}

.queue-reject-action textarea {
    min-height: 6rem;
}

.action-status {
    min-height: 1.5rem;
    margin: 0.75rem 0;
    color: var(--success);
    font-weight: 700;
}

.action-status-error {
    color: var(--danger);
}

.button-success:hover {
    background: #126c42;
}

.button-danger {
    background: var(--danger);
}

.button-danger:hover {
    background: #982323;
}

.button-quiet {
    border: 1px solid #c9ced6;
    color: #414956;
    background: #fff;
}

.button-quiet:hover {
    border-color: #aeb5c0;
    color: var(--ink);
    background: #f0f2f5;
}

.trash-action {
    margin-left: auto !important;
}

.trash-action .button-quiet {
    color: var(--danger);
}

.reject-action summary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: .6rem 1rem;
    border: 1px solid #d9a8a8;
    border-radius: 6px;
    color: var(--danger);
    background: #fff;
    font-weight: 700;
    cursor: pointer;
    list-style: none;
}

.reject-action summary::-webkit-details-marker {
    display: none;
}

.reject-action summary:hover {
    background: #fff2f2;
}

.reject-action[open] {
    flex-basis: 100%;
    max-width: 520px;
    padding: .75rem;
    border: 1px solid #e5c1c1;
    border-radius: 7px;
    background: #fff;
}

.reject-action[open] summary {
    margin-bottom: .75rem;
}

.reject-action form,
.schedule-action,
.notes-stack form {
    display: grid;
    gap: .6rem;
}

.reject-action textarea {
    min-height: 90px;
}

.publishing-grid {
    display: grid;
    grid-template-columns: minmax(270px, .6fr) minmax(360px, 1.4fr);
    gap: 1rem;
    align-items: start;
}

.publishing-grid > :only-child {
    grid-column: 1 / -1;
}

.schedule-action,
.notes-stack {
    padding: .85rem;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #fff;
}

.schedule-action button,
.notes-stack button,
.reject-action button {
    justify-self: start;
}

.notes-stack {
    display: grid;
    gap: 1rem;
}

.notes-stack form + form {
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.notice,
[role="status"],
[role="alert"] {
    padding: .75rem .85rem;
    border-radius: 6px;
}

[role="status"] {
    color: #145a38;
    background: #e2f4e9;
}

[role="alert"] {
    color: #842626;
    background: #f8e1e1;
}

.auth-screen {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 2rem 1rem;
    background:
        linear-gradient(rgb(21 23 28 / 82%), rgb(21 23 28 / 94%)),
        radial-gradient(circle at 20% 10%, #5c322d 0, #24272d 45%, #15171b 100%);
}

.auth-wrap {
    width: min(100%, 430px);
}

.auth-wrap > .brand-mark {
    justify-content: center;
    width: 100%;
    margin-bottom: 1.25rem;
}

.auth-card {
    padding: clamp(1.25rem, 4vw, 2rem);
}

.auth-card form {
    display: grid;
    gap: .9rem;
}

.auth-card button {
    width: 100%;
}

.auth-actions {
    margin: 1rem 0 0;
    text-align: center;
}

.cf-turnstile {
    min-height: 65px;
}

@media (max-width: 900px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        overflow-x: auto;
        padding: .65rem;
    }

    .sidebar-label {
        display: none;
    }

    .sidebar nav {
        display: flex;
        width: max-content;
    }

    .sidebar .account-links {
        padding-top: 0;
        border-top: 0;
        margin-top: 0;
        margin-left: .4rem;
    }

    .filter-bar {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}

@media (max-width: 700px) {
    .review-toolbar,
    .review-toolbar form,
    .review-toolbar button,
    .reject-action,
    .reject-action summary {
        width: 100%;
    }

    .trash-action {
        margin-left: 0 !important;
    }

    .reject-action[open] {
        max-width: none;
    }

    .publishing-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 560px) {
    .brand-product {
        display: none;
    }

    .content {
        padding: 1.1rem .75rem 2rem;
    }

    .filter-bar {
        grid-template-columns: 1fr;
    }

    th,
    td {
        padding: .65rem;
    }
}
