/*
 * CosplayHorror Newsroom Admin
 * Design system and page styles
 *
 * Organization:
 * 01. Design tokens
 * 02. Reset and global defaults
 * 03. Shared typography and controls
 * 04. Authentication and setup
 * 05. Admin shell and navigation
 * 06. Dashboard
 * 07. Article list
 * 08. Article editor
 * 09. Article preview
 * 10. Responsive behavior
 */

/* ==========================================================================
   01. Design tokens
   ========================================================================== */

:root {
    color-scheme: dark;

    /* Surfaces */
    --color-ink: #05070a;
    --color-ink-soft: #080b0f;
    --color-panel: #0b0f14;
    --color-panel-raised: #111821;
    --color-panel-hover: #151e28;
    --color-input: #090d12;

    /* Borders */
    --color-line: #202a35;
    --color-line-strong: #303c49;
    --color-focus-ring: rgba(255, 90, 79, 0.14);

    /* Text */
    --color-text: #f5f1ec;
    --color-text-soft: #d8dee5;
    --color-muted: #9ba6b2;
    --color-faint: #687480;

    /* Brand and states */
    --color-ember: #ff5a4f;
    --color-ember-bright: #ff796f;
    --color-ember-dark: #c72f35;
    --color-amber: #f4a340;
    --color-success: #4bd49a;
    --color-info: #73b7ff;
    --color-danger-soft: #ffb7b2;

    /* Compatibility aliases used by existing markup */
    --ink: var(--color-ink);
    --panel: var(--color-panel);
    --panel-2: var(--color-panel-raised);
    --line: var(--color-line);
    --text: var(--color-text);
    --muted: var(--color-muted);
    --ember: var(--color-ember);
    --ember-bright: var(--color-ember-bright);
    --amber: var(--color-amber);
    --success: var(--color-success);

    /* Typography */
    --font-ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-editorial: Georgia, "Times New Roman", serif;

    /* Layout */
    --content-width: 1180px;
    --editor-width: 1480px;
    --topbar-height: 78px;

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-7: 2rem;
    --space-8: 2.5rem;
    --space-9: 3rem;
    --space-10: 4rem;

    /* Shape and effects */
    --radius-sm: 10px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-pill: 999px;
    --radius: var(--radius-lg);

    --shadow-card: 0 28px 80px rgba(0, 0, 0, 0.5);
    --shadow-shell: 0 34px 90px rgba(0, 0, 0, 0.55);
    --shadow-button: 0 10px 30px rgba(199, 47, 53, 0.23);

    --transition-fast: 160ms ease;
    --transition-base: 220ms ease;
}

/* ==========================================================================
   02. Reset and global defaults
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--color-ink);
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--color-text);
    background:
        radial-gradient(circle at 12% 15%, rgba(255, 90, 79, 0.11), transparent 28%),
        linear-gradient(145deg, #030405 0%, #070a0e 48%, #040608 100%);
    font-family: var(--font-ui);
    line-height: 1.5;
}

body::before {
    position: fixed;
    inset: 0;
    z-index: -1;
    content: "";
    pointer-events: none;
    opacity: 0.16;
    background-image: repeating-linear-gradient(
        0deg,
        transparent 0 3px,
        rgba(255, 255, 255, 0.025) 4px
    );
}

img,
svg {
    display: block;
    max-width: 100%;
}

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

button,
a {
    -webkit-tap-highlight-color: transparent;
}

a {
    color: inherit;
}

::selection {
    color: #fff;
    background: rgba(255, 90, 79, 0.72);
}

:focus-visible {
    outline: 2px solid var(--color-ember-bright);
    outline-offset: 3px;
}

/* ==========================================================================
   03. Shared typography and controls
   ========================================================================== */

.brand-kicker,
.eyebrow {
    color: var(--color-ember-bright);
    font-size: 0.74rem;
    font-weight: 800;
    letter-spacing: 0.19em;
    text-transform: uppercase;
}

.signal {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--color-muted);
    font-size: 0.76rem;
    font-weight: 750;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.signal span {
    width: 8px;
    height: 8px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--color-success);
    box-shadow: 0 0 15px var(--color-success);
}

form {
    display: flex;
    flex-direction: column;
}

label {
    margin: 18px 0 8px;
    color: var(--color-text-soft);
    font-size: 0.85rem;
    font-weight: 700;
}

input,
select,
textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid #2a3541;
    border-radius: var(--radius-md);
    outline: none;
    background: var(--color-input);
    color: var(--color-text);
    padding: 14px 15px;
    transition:
        border-color var(--transition-base),
        box-shadow var(--transition-base),
        background-color var(--transition-base);
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--color-ember);
    background: #0b1016;
    box-shadow: 0 0 0 4px var(--color-focus-ring);
}

input::placeholder,
textarea::placeholder {
    color: #66717d;
    opacity: 1;
}

textarea {
    resize: vertical;
    line-height: 1.55;
}

button,
.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-top: 22px;
    border: 0;
    border-radius: var(--radius-md);
    padding: 14px 18px;
    color: #fff;
    background: linear-gradient(135deg, var(--color-ember), var(--color-ember-dark));
    box-shadow: var(--shadow-button);
    cursor: pointer;
    font-weight: 850;
    text-decoration: none;
    transition:
        filter var(--transition-fast),
        transform var(--transition-fast),
        border-color var(--transition-fast),
        background-color var(--transition-fast);
}

button:hover,
.button-link:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

button:active,
.button-link:active {
    transform: translateY(0);
}

button:disabled,
.button-link[aria-disabled="true"] {
    cursor: not-allowed;
    filter: grayscale(0.3);
    opacity: 0.55;
    transform: none;
}

.button-link.compact {
    min-width: 170px;
    margin: 0;
}

.secondary-button {
    border: 1px solid var(--color-line-strong);
    background: var(--color-panel-raised);
    box-shadow: none;
}

.publish-button {
    background: linear-gradient(135deg, var(--color-ember), var(--color-ember-dark));
}

.alert {
    margin: 18px 0 2px;
    border: 1px solid;
    border-radius: 11px;
    padding: 12px 14px;
    font-size: 0.86rem;
    line-height: 1.45;
}

.alert-error {
    border-color: rgba(255, 90, 79, 0.42);
    background: rgba(255, 90, 79, 0.09);
    color: var(--color-danger-soft);
}

.alert-success {
    border-color: rgba(75, 212, 154, 0.42);
    background: rgba(75, 212, 154, 0.09);
    color: #a7f1d1;
}

.field-help,
.character-count {
    display: block;
    margin: 7px 0 0;
    color: var(--color-muted);
    font-size: 0.72rem;
    line-height: 1.45;
}

/* ==========================================================================
   04. Authentication and setup
   ========================================================================== */

.auth-page {
    display: grid;
    place-items: center;
    padding: 28px;
}

.auth-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
    width: min(1120px, 100%);
    overflow: hidden;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-shell);
}

.auth-brand {
    position: relative;
    display: flex;
    min-width: 0;
    min-height: 680px;
    overflow: hidden;
    flex-direction: column;
    justify-content: center;
    padding: 72px clamp(38px, 5vw, 64px);
    background: linear-gradient(160deg, rgba(22, 27, 34, 0.95), rgba(5, 7, 10, 0.98));
}

.auth-brand::after {
    position: absolute;
    inset: auto -15% -22%;
    height: 52%;
    content: "";
    background: radial-gradient(ellipse, rgba(255, 90, 79, 0.22), transparent 63%);
}

.auth-brand h1 {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 100%;
    margin: 16px 0 0;
    font-size: clamp(2.75rem, 4.7vw, 3.8rem);
    font-weight: 900;
    letter-spacing: -0.085em;
    line-height: 0.9;
    white-space: nowrap;
}

@media (max-width: 1100px) and (min-width: 851px) {
    .auth-brand {
        padding-inline: 40px;
    }

    .auth-brand h1 {
        font-size: clamp(2.65rem, 4.6vw, 3.35rem);
    }
}

.auth-brand h1 span,
.mini-brand span {
    color: var(--color-ember);
}

.brand-subtitle {
    margin: 13px 0 40px;
    color: var(--color-muted);
    font-size: 0.78rem;
    letter-spacing: 0.38em;
    text-transform: uppercase;
}

.brand-copy {
    position: relative;
    z-index: 2;
    max-width: 470px;
    color: #c5cbd2;
    font-size: 1.06rem;
    line-height: 1.75;
}

.skyline {
    display: flex;
    height: 124px;
    align-items: flex-end;
    gap: 7px;
    margin: 18px 0 24px;
    border-bottom: 2px solid rgba(255, 90, 79, 0.5);
    opacity: 0.75;
}

.skyline i {
    display: block;
    width: 12%;
    border: 1px solid #2b3744;
    border-bottom: 0;
    background: linear-gradient(#1f2934, #0b0f14);
}

.skyline i:nth-child(1) { height: 34%; }
.skyline i:nth-child(2) { height: 62%; }
.skyline i:nth-child(3) { height: 45%; }
.skyline i:nth-child(4) { width: 17%; height: 100%; }
.skyline i:nth-child(5) { height: 58%; }
.skyline i:nth-child(6) { height: 75%; }
.skyline i:nth-child(7) { height: 38%; }

.auth-panel {
    display: grid;
    place-items: center;
    min-width: 0;
    padding: 52px;
    background: rgba(7, 10, 14, 0.94);
}

.auth-card {
    width: 100%;
    max-width: 420px;
}

.auth-card h2,
.setup-card h1 {
    margin: 22px 0 8px;
    font-size: 2.25rem;
    letter-spacing: -0.04em;
}

.auth-card > p {
    color: var(--color-muted);
    line-height: 1.55;
}

.security-note {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--color-line);
    font-size: 0.75rem;
}

.setup-shell {
    width: min(560px, 100%);
}

.setup-card {
    max-width: none;
    border: 1px solid var(--color-line);
    border-radius: 24px;
    padding: 38px;
    background: rgba(11, 15, 20, 0.96);
    box-shadow: var(--shadow-card);
}

/* ==========================================================================
   05. Admin shell and navigation
   ========================================================================== */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    min-height: var(--topbar-height);
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
    padding: 0 clamp(22px, 5vw, 72px);
    border-bottom: 1px solid var(--color-line);
    background: rgba(4, 6, 8, 0.88);
    backdrop-filter: blur(15px);
}

.mini-brand {
    flex: 0 0 auto;
    font-size: 1.05rem;
    font-weight: 900;
    letter-spacing: -0.04em;
    text-decoration: none;
}

.mini-brand small {
    display: block;
    margin-top: 2px;
    color: var(--color-muted);
    font-size: 0.46rem;
    letter-spacing: 0.34em;
}

.admin-nav {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.admin-nav a {
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    color: var(--color-muted);
    font-size: 0.82rem;
    font-weight: 800;
    text-decoration: none;
    transition:
        color var(--transition-fast),
        background-color var(--transition-fast);
}

.admin-nav a:hover,
.admin-nav a.active {
    background: var(--color-panel-raised);
    color: var(--color-text);
}

.admin-nav .new-story-link {
    color: #fff;
    background: linear-gradient(135deg, var(--color-ember), var(--color-ember-dark));
}

.topbar form {
    margin: 0;
}

.logout-button {
    margin: 0;
    border: 1px solid var(--color-line-strong);
    padding: 9px 13px;
    background: transparent;
    box-shadow: none;
    font-size: 0.8rem;
}

/* ==========================================================================
   06. Dashboard
   ========================================================================== */

.dashboard-shell {
    width: min(var(--content-width), calc(100% - 40px));
    margin: 0 auto;
    padding: 62px 0 90px;
}

.welcome-panel {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 42px;
    padding-bottom: 40px;
    border-bottom: 1px solid var(--color-line);
}

.welcome-panel h1 {
    margin: 10px 0 8px;
    font-size: clamp(2.1rem, 5vw, 4.35rem);
    letter-spacing: -0.06em;
    line-height: 1;
}

.welcome-panel p {
    max-width: 690px;
    color: var(--color-muted);
    line-height: 1.65;
}

.live-clock {
    min-width: 180px;
    text-align: right;
}

.live-clock span,
.live-clock small {
    display: block;
    color: var(--color-muted);
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.18em;
}

.live-clock strong {
    display: block;
    margin: 5px 0;
    font-size: 1.7rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin-top: 28px;
}

.dashboard-card {
    position: relative;
    min-height: 260px;
    overflow: hidden;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-lg);
    padding: 26px;
    background: linear-gradient(145deg, rgba(17, 24, 33, 0.92), rgba(8, 12, 16, 0.92));
}

.dashboard-card h2 {
    margin: 48px 0 10px;
    font-size: 1.35rem;
}

.dashboard-card p {
    color: var(--color-muted);
    line-height: 1.6;
}

.card-number {
    color: var(--color-faint);
    font-size: 0.73rem;
    font-weight: 800;
    letter-spacing: 0.18em;
}

.accent-card::after {
    position: absolute;
    right: -80px;
    bottom: -90px;
    width: 190px;
    height: 190px;
    border-radius: 50%;
    content: "";
    opacity: 0.18;
    background: var(--color-ember);
    filter: blur(45px);
}

.status-pill {
    position: absolute;
    bottom: 24px;
    left: 26px;
    border: 1px solid rgba(75, 212, 154, 0.25);
    border-radius: var(--radius-pill);
    padding: 7px 10px;
    background: rgba(75, 212, 154, 0.1);
    color: #9cf0c9;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.status-pill.muted {
    border-color: #2a3440;
    background: rgba(169, 178, 188, 0.07);
    color: #a9b2bc;
}

.security-panel {
    display: grid;
    grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
    gap: 30px;
    margin-top: 18px;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-lg);
    padding: 30px;
    background: rgba(9, 13, 18, 0.75);
}

.security-panel h2 {
    margin: 8px 0 0;
}

.security-panel ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.security-panel li {
    border: 1px solid #222c36;
    border-radius: var(--radius-sm);
    padding: 11px 12px;
    color: #cbd2d9;
    font-size: 0.86rem;
}

.security-panel li::before {
    margin-right: 8px;
    content: "✓";
    color: var(--color-success);
    font-weight: 900;
}

/* ==========================================================================
   07. Article list
   ========================================================================== */

.page-heading,
.editor-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 28px;
}

.page-heading h1,
.editor-heading h1 {
    margin: 8px 0 4px;
    font-size: clamp(2.2rem, 5vw, 4rem);
    letter-spacing: -0.055em;
}

.page-heading p {
    margin: 0;
    color: var(--color-muted);
}

.article-table-card,
.form-card {
    border: 1px solid var(--color-line);
    border-radius: var(--radius-lg);
    background: rgba(9, 13, 18, 0.88);
}

.article-list {
    display: flex;
    flex-direction: column;
}

.article-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    border-bottom: 1px solid var(--color-line);
    padding: 20px 22px;
    text-decoration: none;
    transition: background-color var(--transition-fast);
}

.article-row:last-child {
    border-bottom: 0;
}

.article-row:hover {
    background: var(--color-panel-hover);
}

.article-row strong,
.article-row span {
    display: block;
}

.article-row strong {
    font-size: 1rem;
}

.article-row > div > span {
    margin-top: 6px;
    color: var(--color-muted);
    font-size: 0.78rem;
}

.row-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.priority,
.status-chip {
    display: inline-flex !important;
    align-items: center;
    border-radius: var(--radius-pill);
    padding: 6px 8px;
    font-size: 0.62rem !important;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.priority {
    border: 1px solid #33404d;
    color: #d6dde4;
}

.priority-time_sensitive {
    border-color: #8d3532;
    background: #351314;
    color: #ffb2ac;
}

.priority-high {
    border-color: #764716;
    background: #2c1b0b;
    color: #ffd0a0;
}

.priority-low {
    color: #aeb8c2;
}

.status-chip {
    background: rgba(75, 212, 154, 0.1);
    color: #9cf0c9;
}

.status-draft {
    background: #1b232c;
    color: #c2cad3;
}

.status-scheduled {
    background: #10263c;
    color: #acd3ff;
}

.empty-state {
    padding: 70px 28px;
    text-align: center;
}

.empty-state h2 {
    margin: 10px 0;
}

.empty-state p {
    color: var(--color-muted);
}

/* ==========================================================================
   08. Article editor
   ========================================================================== */

.editor-shell {
    width: min(var(--editor-width), calc(100% - 40px));
    margin: 0 auto;
    padding: 38px 0 110px;
}

.editor-heading {
    position: sticky;
    top: var(--topbar-height);
    z-index: 12;
    padding: 18px 0;
    background: linear-gradient(180deg, var(--color-ink) 75%, transparent);
}

.editor-heading h1 {
    max-width: 820px;
    overflow: hidden;
    font-size: clamp(1.75rem, 4vw, 3rem);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.editor-actions {
    display: flex;
    flex: 0 0 auto;
    gap: 10px;
}

.editor-actions button,
.mobile-action-bar button {
    margin: 0;
}

.editor-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 20px;
}

.editor-main,
.editor-sidebar {
    display: flex;
    min-width: 0;
    flex-direction: column;
    gap: 20px;
}

.form-card {
    min-width: 0;
    padding: 24px;
}

.form-card label:first-child {
    margin-top: 0;
}

.field-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.section-title h2 {
    margin: 6px 0 18px;
}

.sticky-card {
    position: sticky;
    top: 170px;
}

.current-status {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    margin-top: 20px;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-md);
    padding: 13px;
}

.current-status span {
    color: var(--color-muted);
    font-size: 0.75rem;
}

.preview-link {
    display: block;
    margin-top: 12px;
    color: var(--color-ember-bright);
    font-size: 0.82rem;
    font-weight: 800;
    text-decoration: none;
}

.preview-link:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.featured-image-preview {
    display: block;
    width: 100%;
    max-height: 220px;
    margin: 16px 0;
    border-radius: var(--radius-md);
    object-fit: cover;
}

.mobile-action-bar {
    display: none;
}

/* Quill editor */
#article-editor {
    min-height: 480px;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    background: #fff;
    color: #171717;
}

.ql-toolbar.ql-snow {
    border-color: #2a3541 !important;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    background: #eef1f4;
}

.ql-container.ql-snow {
    border-color: #2a3541 !important;
    font-size: 1rem;
}

.ql-editor {
    min-height: 480px;
    line-height: 1.75;
}

.ql-editor h2 {
    font-size: 1.8em;
}

.ql-editor h3 {
    font-size: 1.35em;
}

/* ==========================================================================
   09. Article preview
   ========================================================================== */

.preview-page {
    background: var(--color-ink);
}

.preview-banner {
    position: sticky;
    top: 0;
    z-index: 30;
    padding: 10px 20px;
    background: var(--color-ember);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-align: center;
}

.preview-banner a {
    color: #fff;
}

.story-preview {
    width: min(820px, calc(100% - 36px));
    margin: 0 auto;
    padding: 70px 0 100px;
}

.story-category {
    color: var(--color-ember-bright);
    font-size: 0.75rem;
    font-weight: 900;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.story-preview h1 {
    margin: 14px 0 20px;
    font-size: clamp(2.4rem, 7vw, 5.2rem);
    letter-spacing: -0.06em;
    line-height: 0.98;
}

.story-deck {
    color: #bac3cc;
    font-size: 1.25rem;
    line-height: 1.6;
}

.story-preview figure {
    margin: 40px 0;
}

.story-preview figure img {
    width: 100%;
    border-radius: 18px;
}

.story-preview figcaption,
.story-meta,
.story-source {
    color: var(--color-muted);
    font-size: 0.78rem;
}

.story-meta {
    border-top: 1px solid var(--color-line);
    border-bottom: 1px solid var(--color-line);
    padding: 18px 0;
}

.story-body {
    color: #eee;
    font-family: var(--font-editorial);
    font-size: 1.12rem;
    line-height: 1.85;
}

.story-body h2,
.story-body h3 {
    margin-top: 2em;
    font-family: var(--font-ui);
    line-height: 1.15;
}

.story-body a,
.story-source a {
    color: var(--color-ember-bright);
}

/* ==========================================================================
   10. Responsive behavior
   ========================================================================== */

@media (max-width: 1050px) {
    .auth-shell {
        grid-template-columns: minmax(0, 1fr) minmax(340px, 0.92fr);
    }

    .auth-brand h1 {
        font-size: clamp(2.75rem, 6vw, 4.45rem);
    }

    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 920px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }

    .sticky-card,
    .editor-heading {
        position: static;
    }

    .editor-actions {
        display: none;
    }

    .mobile-action-bar {
        position: fixed;
        right: 0;
        bottom: 0;
        left: 0;
        z-index: 40;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        padding:
            12px max(14px, env(safe-area-inset-right))
            calc(12px + env(safe-area-inset-bottom))
            max(14px, env(safe-area-inset-left));
        border-top: 1px solid var(--color-line);
        background: rgba(4, 6, 8, 0.95);
        backdrop-filter: blur(14px);
    }

    .mobile-action-bar button {
        justify-content: center;
    }

    .field-row {
        grid-template-columns: 1fr;
    }

    .article-row {
        align-items: flex-start;
    }

    .row-meta {
        flex-direction: column;
        align-items: flex-end;
    }
}

@media (max-width: 850px) {
    .auth-page {
        place-items: stretch;
        padding: 0;
    }

    .auth-shell {
        min-height: 100vh;
        grid-template-columns: 1fr;
        border: 0;
        border-radius: 0;
    }

    .auth-brand {
        min-height: auto;
        padding: 46px 28px 34px;
    }

    .auth-brand h1 {
        font-size: clamp(2.65rem, 13vw, 4rem);
        white-space: normal;
    }

    .brand-copy,
    .skyline {
        display: none;
    }

    .auth-panel {
        align-items: start;
        padding: 38px 28px 52px;
    }

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

    .welcome-panel {
        align-items: flex-start;
        flex-direction: column;
    }

    .live-clock {
        text-align: left;
    }

    .security-panel {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .topbar {
        min-height: 68px;
        flex-wrap: wrap;
        padding: 10px 16px;
    }

    .admin-nav {
        order: 3;
        width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 2px;
        scrollbar-width: thin;
    }

    .admin-nav a {
        flex: 0 0 auto;
    }

    .dashboard-shell {
        padding-top: 38px;
    }

    .page-heading {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 560px) {
    .editor-shell {
        width: calc(100% - 24px);
        padding-top: 22px;
    }

    .form-card {
        border-radius: 16px;
        padding: 18px;
    }

    .article-row {
        align-items: stretch;
        flex-direction: column;
    }

    .row-meta {
        align-items: center;
        flex-direction: row;
        flex-wrap: wrap;
    }

    .editor-heading h1 {
        white-space: normal;
    }

    .story-preview {
        padding-top: 44px;
    }
}

@media (max-width: 520px) {
    .dashboard-shell {
        width: min(100% - 28px, var(--content-width));
    }

    .security-panel ul {
        grid-template-columns: 1fr;
    }

    .setup-card {
        border-radius: 18px;
        padding: 26px 20px;
    }

    .auth-brand {
        padding-inline: 22px;
    }

    .auth-panel {
        padding-inline: 22px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* Phase 3.1: embedded article video */
.story-video {
    width: 100%;
    margin: 40px 0;
    overflow: hidden;
    border: 1px solid var(--color-line);
    border-radius: var(--radius-lg);
    background: #000;
    aspect-ratio: 16 / 9;
}

.story-video iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.story-tags {
    margin-top: 40px;
    color: var(--color-muted);
    font-size: 0.82rem;
}
