:root {
    color-scheme: light;
    --paper: #ecf0f5;
    --login-background: #d2d6de;
    --white: #fff;
    --ink: #333;
    --muted: #52616b;
    --line: #d2d6de;
    --blue: #3c8dbc;
    --blue-button: #32769e;
    --blue-dark: #2e6382;
    --blue-soft: #e8f2f8;
    --sidebar: #222d32;
    --sidebar-active: #1e282c;
    --sidebar-text: #b8c7ce;
    --success: #176744;
    --success-soft: #e6f6ed;
    --danger: #a72d1d;
    --danger-soft: #fceeea;
    font-family: "Raleway", system-ui, -apple-system, sans-serif;
    font-size: 15px;
    line-height: 1.5;
    color: var(--ink);
    background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--blue-dark); text-underline-offset: 3px; }
a:hover { color: var(--blue-button); }
:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.8rem, 3vw, 2.55rem); line-height: 1.12; letter-spacing: -.04em; }
h2 { font-size: 1.16rem; letter-spacing: -.015em; }
.application { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--sidebar); color: var(--white); padding: 26px 16px; display: flex; flex-direction: column; gap: 36px; }
.brand { display: block; width: fit-content; max-width: 100%; }
.brand img { display: block; width: 100%; height: auto; }
.sidebar .brand { width: 188px; padding-inline: 8px; }
.sidebar nav { display: grid; gap: 4px; }
.sidebar nav a { display: block; padding: 9px 12px; border-radius: 7px; color: var(--sidebar-text); text-decoration: none; }
.sidebar nav a:hover, .sidebar nav .active { background: var(--sidebar-active); color: var(--white); box-shadow: inset 3px 0 var(--blue); }
.identity { margin-top: auto; border-top: 1px solid #374850; padding: 14px 8px 0; overflow-wrap: anywhere; }
.identity small { display: block; color: var(--sidebar-text); margin-bottom: 6px; }
.identity .link { color: var(--white); padding: 0; border: 0; background: transparent; text-decoration: underline; min-height: auto; }
main { width: 100%; max-width: 1550px; margin-inline: auto; padding: clamp(18px, 3vw, 44px); min-width: 0; }
.page-header { display: flex; gap: 14px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 23px; }
.back { display: inline-block; margin-bottom: 12px; }
.panel { border: 1px solid var(--line); border-radius: 12px; background: var(--white); margin-bottom: 18px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); gap: 16px; }
.dashboard-card { padding: 22px; margin: 0; }
.dashboard-card p { color: var(--muted); margin: 8px 0 16px; }
.form-panel { padding: 20px; max-width: 960px; }
.form-panel > .actions { margin-top: 18px; }
.fields, .filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 175px), 1fr)); gap: 14px; }
.fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.filters { padding: 16px; align-items: end; }
.full { grid-column: 1 / -1; }
label { display: grid; gap: 4px; font-size: .9rem; font-weight: 630; min-width: 0; }
input, select, textarea { width: 100%; min-width: 0; background: var(--white); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 8px 9px; font: inherit; font-weight: 400; min-height: 37px; }
input[type=checkbox] { width: auto; min-height: auto; accent-color: var(--blue-button); }
textarea { resize: vertical; }
fieldset { border: 1px solid var(--line); border-radius: 8px; }
.checkboxes { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.checkboxes label { display: flex; align-items: center; }
.actions { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.actions form, td form { margin: 0; }
button, .button { display: inline-flex; align-items: center; justify-content: center; padding: 7px 12px; min-height: 37px; border-radius: 7px; color: var(--blue-dark); border: 1px solid var(--line); background: var(--white); font: inherit; font-weight: 650; text-decoration: none; cursor: pointer; }
button:hover, .button:hover { background: var(--blue-soft); }
.primary { background: var(--blue-button); border-color: var(--blue-button); color: var(--white); }
.primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); color: var(--white); }
.danger { color: var(--danger); }
.danger:hover { background: var(--danger-soft); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); background: #f4f6f9; font-size: .86rem; font-weight: 680; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
td .actions { min-width: 115px; }
.status { display: inline-block; background: #fef3dd; color: #74500f; padding: 3px 9px; border-radius: 100px; font-size: .82rem; white-space: nowrap; }
.status.published { background: var(--success-soft); color: var(--success); }
.pagination { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; color: var(--muted); }
.notice { padding: 11px 16px; border-radius: 8px; margin-bottom: 16px; }
.notice ul { margin: 0; padding-left: 20px; }
.success { background: var(--success-soft); color: var(--success); }
.error { background: var(--danger-soft); color: var(--danger); }
.guest { min-height: 100vh; display: grid; place-items: center; background: var(--login-background); }
.guest main { max-width: 465px; }
.auth-card { background: var(--white); border: 1px solid var(--line); border-radius: 16px; padding: clamp(22px, 5vw, 34px); box-shadow: 0 12px 40px #222d321a; }
.auth-card .brand { width: 100%; padding: 10px 12px; background: var(--sidebar); border-radius: 8px; }
.auth-card h1 { margin: 24px 0 15px; }
.auth-card form { display: grid; gap: 13px; margin-bottom: 14px; }
@media (width > 800px) {
    .sidebar {
        position: sticky;
        top: 0;
        align-self: start;
        height: 100vh;
        height: 100dvh;
        overflow-y: auto;
    }
    .sidebar .brand, .sidebar .identity { flex-shrink: 0; }
    .sidebar nav { min-height: 0; overflow-y: auto; }
    .sidebar nav a:focus-visible { outline-offset: -3px; }
}
@media (max-width: 800px) {
    .application { grid-template-columns: 1fr; }
    .sidebar { gap: 13px; padding: 12px 16px; }
    .sidebar nav { display: flex; flex-wrap: wrap; }
    .sidebar nav a { padding: 6px 9px; }
    .identity { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; padding: 8px 0 0; }
    .identity small { margin: 0; }
}
@media (max-width: 460px) {
    .fields { grid-template-columns: 1fr; }
    th, td { padding: 9px; }
}

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.editor-tools { margin: 5px 0; }
.editor-tools[hidden] { display: none; }
