:root {
    color-scheme: light;
    --background: #f6f7fb;
    --surface: #ffffff;
    --text: #182033;
    --muted: #667085;
    --line: #e4e7ec;
    --primary: #263b80;
    --primary-dark: #1a2b67;
    --primary-soft: #eef2ff;
    --success: #087443;
    --success-soft: #eaf8f1;
    --warning: #9a5b00;
    --warning-soft: #fff7e8;
    --danger: #b42318;
    --danger-soft: #fff0ee;
    --radius: 16px;
    --shadow: 0 14px 38px rgba(23, 34, 61, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--background);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.55;
}

a {
    color: var(--primary);
    text-underline-offset: 3px;
}

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

h1 {
    margin-bottom: 12px;
    font-size: clamp(2rem, 5vw, 3.5rem);
    line-height: 1.05;
    letter-spacing: -0.04em;
}

h2 {
    margin-bottom: 12px;
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

h3 {
    margin-bottom: 4px;
    font-size: 1rem;
    overflow-wrap: anywhere;
}

.container {
    width: min(1120px, calc(100% - 32px));
    margin: 0 auto;
    padding: 52px 0;
}

.container.narrow,
.login-container {
    width: min(620px, calc(100% - 32px));
}

.page-header {
    margin-bottom: 30px;
}

.page-header > p:last-child,
.public-header > p {
    max-width: 720px;
    color: var(--muted);
    font-size: 1.04rem;
}

.eyebrow {
    margin-bottom: 8px;
    color: var(--primary);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.panel {
    margin-bottom: 24px;
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.success-panel {
    border-color: #b7e4cc;
}

label {
    display: block;
    margin: 18px 0 7px;
    font-size: 0.9rem;
    font-weight: 750;
}

input[type="text"],
input[type="url"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="datetime-local"],
input[type="file"] {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid #cfd4dc;
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

input:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(38, 59, 128, 0.13);
}

input[type="file"] {
    padding: 8px;
}

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 20px;
    padding: 10px 17px;
    border: 1px solid var(--primary);
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-weight: 760;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.button:hover:not(:disabled) {
    border-color: var(--primary-dark);
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.button:disabled {
    cursor: not-allowed;
    opacity: 0.46;
}

.button-secondary {
    border-color: #cdd4e8;
    background: #fff;
    color: var(--primary);
}

.button-secondary:hover:not(:disabled) {
    border-color: var(--primary);
    background: var(--primary-soft);
}

.button-quiet {
    border-color: transparent;
    background: transparent;
    color: var(--muted);
}

.button-quiet:hover:not(:disabled) {
    border-color: var(--line);
    background: #fff;
    color: var(--text);
}

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

.button-danger:hover:not(:disabled) {
    border-color: #8f1c13;
    background: #8f1c13;
}

.button-small {
    min-height: 38px;
    margin-top: 0;
    padding: 8px 13px;
    font-size: 0.87rem;
}

.full-width {
    width: 100%;
}

.button-row,
.header-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.header-actions .button,
.header-actions form {
    margin: 0;
}

.help,
.small-copy,
.server-note {
    color: var(--muted);
    font-size: 0.88rem;
}

.alert {
    margin-bottom: 16px;
    padding: 13px 16px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-weight: 650;
}

.alert-error {
    border-color: #f5c0ba;
    background: var(--danger-soft);
    color: #8f1c13;
}

.alert-success {
    border-color: #b7e4cc;
    background: var(--success-soft);
    color: var(--success);
}

.status-list {
    margin: 0;
}

.status-list > div {
    display: grid;
    grid-template-columns: minmax(150px, 0.7fr) minmax(0, 1.5fr);
    gap: 18px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}

.status-list > div:last-child {
    border-bottom: 0;
}

.status-list dt {
    color: var(--muted);
}

.status-list dd {
    margin: 0;
    overflow-wrap: anywhere;
    font-weight: 650;
}

.public-container {
    width: min(940px, calc(100% - 32px));
}

.public-header {
    padding: 44px;
    border-radius: 24px;
    background: linear-gradient(135deg, #18285f 0%, #334b99 72%, #546cba 100%);
    box-shadow: 0 20px 50px rgba(23, 38, 90, 0.2);
    color: #fff;
}

.public-header .eyebrow,
.public-header > p {
    color: #dfe6ff;
}

.latest-button {
    border-color: #fff;
    background: #fff;
    color: var(--primary);
}

.latest-button:hover:not(:disabled) {
    border-color: #fff;
    background: #f5f7ff;
}

.section-heading,
.panel-heading,
.file-title-line,
.admin-file-main,
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.section-heading {
    margin: 36px 0 16px;
}

.section-heading h2 {
    margin: 0;
}

.count-badge,
.latest-badge,
.status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 800;
}

.count-badge {
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    background: #e9edf7;
    color: var(--primary);
}

.latest-badge {
    padding: 4px 9px;
    background: var(--primary-soft);
    color: var(--primary);
    white-space: nowrap;
}

.file-list,
.admin-file-list {
    display: grid;
    gap: 12px;
}

.file-card,
.admin-file-card {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #fff;
}

.file-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 16px;
    padding: 18px;
}

.file-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 11px;
    background: var(--success-soft);
    color: var(--success);
    font-size: 0.72rem;
    font-weight: 900;
}

.file-details p,
.admin-file-main p {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.public-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 14px;
    margin-top: 34px;
    padding: 18px 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.84rem;
}

.empty-state {
    padding: 36px 20px;
    border: 1px dashed #cfd4dc;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.5);
    color: var(--muted);
    text-align: center;
}

.empty-state.compact {
    padding: 20px;
}

.admin-body {
    background: #f4f6fa;
}

.admin-header {
    margin-bottom: 26px;
}

.admin-header h1 {
    margin: 0;
    font-size: clamp(1.8rem, 4vw, 2.7rem);
}

.login-container {
    display: grid;
    min-height: 100vh;
    place-items: center;
}

.login-panel {
    width: 100%;
}

.centered-link {
    margin: 22px 0 0;
    text-align: center;
}

.upload-controls {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) minmax(150px, 0.7fr) minmax(120px, 0.55fr) auto;
    align-items: end;
    gap: 12px;
}

.upload-controls label {
    margin-top: 0;
}

.align-bottom {
    margin: 0;
    white-space: nowrap;
}

.schedule-area {
    margin: 20px 0;
}

.schedule-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.schedule-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

.schedule-table th,
.schedule-table td {
    padding: 11px 13px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.schedule-table th {
    background: #f9fafb;
    color: var(--muted);
    font-size: 0.78rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.schedule-table tr:last-child td {
    border-bottom: 0;
}

.schedule-table input {
    min-width: 210px;
}

.schedule-name {
    min-width: 300px;
    overflow-wrap: anywhere;
    font-weight: 650;
}

.server-note {
    margin-top: 22px;
    padding: 12px 14px;
    border-radius: 9px;
    background: #f8f9fc;
}

.admin-file-card {
    overflow: hidden;
}

.admin-file-main {
    padding: 17px 18px;
}

.status {
    margin-bottom: 7px;
    padding: 4px 9px;
}

.status-published {
    background: var(--success-soft);
    color: var(--success);
}

.status-scheduled {
    background: var(--warning-soft);
    color: var(--warning);
}

.file-actions {
    border-top: 1px solid var(--line);
    background: #fbfcfe;
}

.file-actions summary {
    padding: 12px 18px;
    color: var(--primary);
    font-size: 0.88rem;
    font-weight: 750;
    cursor: pointer;
}

.action-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    padding: 2px 18px 20px;
}

.mini-form {
    min-width: 0;
}

.mini-form label {
    margin-top: 8px;
}

.mini-form .button {
    margin-top: 10px;
}

.locked-note {
    grid-column: span 2;
    align-self: center;
    margin: 12px 0 0;
    color: var(--muted);
    font-size: 0.88rem;
}

@media (max-width: 860px) {
    .upload-controls,
    .action-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .container {
        width: min(100% - 20px, 1120px);
        padding: 28px 0;
    }

    .panel,
    .public-header {
        padding: 20px;
        border-radius: 14px;
    }

    .file-card {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .file-card .button {
        grid-column: 1 / -1;
        width: 100%;
    }

    .file-title-line,
    .admin-file-main,
    .admin-header {
        align-items: flex-start;
    }

    .file-title-line,
    .admin-file-main,
    .admin-header,
    .upload-controls,
    .action-grid,
    .status-list > div {
        grid-template-columns: 1fr;
        flex-direction: column;
    }

    .upload-controls,
    .action-grid {
        display: grid;
    }

    .header-actions {
        width: 100%;
    }

    .header-actions .button,
    .header-actions form,
    .header-actions form .button {
        width: 100%;
    }

    .locked-note {
        grid-column: auto;
    }
}
