:root {
    --page: #f6fbfe;
    --surface: #ffffff;
    --surface-soft: #edf7fc;
    --line: #bdd5e4;
    --line-strong: #88a9bd;
    --text: #1f2f38;
    --muted: #5d7482;
    --brand: #1a5776;
    --brand-dark: #123d52;
    --link: #06479f;
    --link-hover: #b62020;
    --note-bg: #fff9dc;
    --note-line: #d8bf56;
    --note-text: #5b4a00;
    --warn-bg: #fff0f0;
    --warn-line: #d99;
    --warn-text: #793131;
    --radius: 8px;
    --shadow: 0 14px 36px rgba(37, 76, 96, 0.08);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
}

body {
    margin: 0;
    padding: 0;
    font-family: Tahoma, Verdana, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: linear-gradient(180deg, #e8f4fa 0, var(--page) 180px, #fff 100%);
}

a {
    color: var(--link);
    text-decoration: underline;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--link-hover);
}

#header {
    background: linear-gradient(180deg, #d8edf7, #cfe4ef);
    border-bottom: 1px solid var(--line-strong);
    padding: 18px clamp(16px, 4vw, 34px);
}

#header h1 {
    margin: 0;
    font-size: clamp(22px, 4vw, 32px);
    line-height: 1.15;
    color: var(--brand-dark);
    font-weight: 700;
}

#header p.subtitle {
    margin: 6px 0 0;
    max-width: 820px;
    font-size: 13px;
    color: var(--muted);
}

#page-wrap {
    display: flex;
    min-height: calc(100vh - 83px);
}

#sidebar {
    width: 170px;
    flex-shrink: 0;
    background: rgba(232, 244, 250, 0.88);
    border-right: 1px solid var(--line);
    padding: 14px 10px;
}

#sidebar a {
    display: block;
    margin: 0 0 5px;
    padding: 9px 11px;
    border: 1px solid transparent;
    border-radius: 6px;
    color: var(--link);
    font-size: 13px;
    text-decoration: none;
    white-space: nowrap;
}

#sidebar a:hover,
#sidebar a.active {
    background: #d8edf7;
    border-color: var(--line);
    color: var(--link-hover);
}

#main-area {
    display: flex;
    min-width: 0;
    flex: 1;
    flex-direction: column;
}

#content {
    width: min(900px, 100%);
    margin: 28px auto;
    padding: 0 clamp(16px, 4vw, 32px);
    flex: 1;
}

#footer {
    border-top: 1px solid var(--line);
    background: #f2f8fb;
    padding: 14px 20px;
    text-align: center;
    font-size: 12px;
    color: #728895;
}

h2 {
    margin: 0 0 14px;
    padding-bottom: 7px;
    border-bottom: 1px solid var(--line);
    color: var(--brand-dark);
    font-size: 20px;
    line-height: 1.25;
}

h2 + p {
    margin-top: 0;
}

h3 {
    margin: 22px 0 9px;
    color: var(--brand);
    font-size: 16px;
    line-height: 1.3;
}

p, ul, ol {
    margin: 10px 0;
}

ul, ol {
    padding-left: 24px;
}

li + li {
    margin-top: 4px;
}

table {
    max-width: 100%;
}

table.info {
    width: 100%;
    margin: 14px 0;
    border-collapse: collapse;
    overflow: hidden;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
}

table.info th,
table.info td {
    border: 1px solid var(--line);
    padding: 9px 12px;
    text-align: left;
    vertical-align: top;
}

table.info th {
    width: 180px;
    background: var(--surface-soft);
    color: var(--brand-dark);
    font-weight: 700;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
    width: 100%;
    max-width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: #fff;
    color: var(--text);
    font-family: inherit;
    font-size: 14px;
    padding: 8px 10px;
}

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

input[type="submit"],
button,
button.btn {
    min-height: 36px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: linear-gradient(180deg, #f8fcfe, #e4f1f8);
    color: var(--link);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    padding: 8px 16px;
}

input[type="submit"]:hover,
button:hover,
button.btn:hover {
    background: #d8edf7;
    border-color: #658da3;
    color: var(--link-hover);
}

.note-box,
.warning-box {
    border-radius: var(--radius);
    padding: 12px 14px;
    margin: 14px 0;
    font-size: 14px;
}

.note-box {
    background: var(--note-bg);
    border: 1px solid var(--note-line);
    color: var(--note-text);
}

.warning-box {
    background: var(--warn-bg);
    border: 1px solid var(--warn-line);
    color: var(--warn-text);
}

.muted {
    color: var(--muted);
    font-size: 12px;
}

.news-list {
    display: grid;
    gap: 10px;
    margin: 12px 0 22px;
}

.news-item,
.download-card,
.admin-list-item {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    padding: 14px;
}

.news-item time {
    display: block;
    margin-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
}

.news-item h3,
.download-card h3 {
    margin-top: 0;
}

.news-item p,
.admin-list-item p {
    margin-bottom: 0;
}

.download-button {
    display: inline-block;
    min-height: 36px;
    padding: 8px 16px;
    border: 1px solid var(--line-strong);
    border-radius: 6px;
    background: linear-gradient(180deg, #f8fcfe, #e4f1f8);
    color: var(--link);
    text-decoration: none;
}

.download-button:hover {
    background: #d8edf7;
    color: var(--link-hover);
}

.security-note {
    margin-top: 10px;
}

.hash-text {
    overflow-wrap: anywhere;
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
}

.vt-status {
    font-weight: 700;
}

.vt-clean {
    color: #237236;
}

.vt-warning {
    color: #8a7200;
}

.vt-danger {
    color: #a11f1f;
}

.vt-unknown {
    color: var(--muted);
}

.download-version-row {
    max-width: 360px;
    margin: 0 0 14px;
}

.download-version-row label {
    display: block;
    margin-bottom: 6px;
    color: var(--brand-dark);
    font-weight: 700;
}

.clearfix::after {
    content: "";
    display: table;
    clear: both;
}

.task-section {
    overflow-x: auto;
}

.task-section table {
    width: 100%;
    margin: 8px 0 14px;
    border-collapse: collapse;
    background: var(--surface);
}

.task-section th,
.task-section td {
    border: 1px solid var(--line);
    padding: 9px 10px;
    vertical-align: top;
    font-size: 13px;
    width: 33.333%;
}

.task-section th {
    background: var(--surface-soft);
    color: var(--brand-dark);
}

.task-section td.done-col {
    text-decoration: line-through;
    color: #888;
    background: #f5f9fa;
}

.task-section .task-item {
    display: flex;
    align-items: flex-start;
    gap: 7px;
}

.task-section .task-item input {
    width: auto;
    margin-top: 3px;
}

.task-section .done-text {
    text-decoration: line-through;
    color: #777;
}

.admin-login-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(214, 232, 240, 0.92);
}

.admin-login-box,
.modal-box {
    width: min(380px, 100%);
    padding: 24px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: var(--shadow);
}

.admin-login-box {
    text-align: center;
}

.admin-login-box h3,
.modal-box h3 {
    margin-top: 0;
    color: var(--brand-dark);
}

.admin-login-box input {
    margin: 8px 0 12px;
}

.login-back {
    margin: 12px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(18, 39, 52, 0.45);
}

.modal-overlay.active,
.modal-overlay[style*="flex"] {
    display: flex;
}

.modal-box label {
    display: block;
    margin-top: 12px;
    font-weight: 700;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.task-edit-table {
    width: 100%;
    margin: 10px 0;
    border-collapse: collapse;
    background: var(--surface);
}

.task-edit-table th,
.task-edit-table td {
    border: 1px solid var(--line);
    padding: 8px;
    text-align: left;
    vertical-align: top;
    font-size: 13px;
}

.task-edit-table th {
    background: var(--surface-soft);
    color: var(--brand-dark);
}

.task-edit-table .priority-Важно {
    color: #bf2222;
    font-weight: 700;
}

.task-edit-table .priority-Средне {
    color: #8a7200;
    font-weight: 700;
}

.edit-text,
.edit-priority {
    min-width: 120px;
}

.cell-center {
    text-align: center;
}

.actions-cell {
    white-space: nowrap;
}

.icon-btn {
    min-width: 34px;
    min-height: 34px;
    padding: 4px 8px;
}

.icon-btn.danger {
    color: #a11f1f;
}

.admin-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px clamp(16px, 4vw, 32px);
    background: #f5fafc;
    border-bottom: 1px solid var(--line);
}

#task-count {
    color: #667985;
    font-size: 13px;
}

.admin-form {
    margin-bottom: 22px;
}

.admin-list {
    display: grid;
    gap: 10px;
    margin: 12px 0 26px;
}

.compact-list {
    margin: 0;
}

.check-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.check-line input {
    width: auto;
}

@media (max-width: 760px) {
    body {
        font-size: 14px;
    }

    #header {
        padding: 15px 16px;
    }

    #page-wrap {
        flex-direction: column;
    }

    #sidebar {
        position: sticky;
        top: 0;
        z-index: 10;
        display: flex;
        width: auto;
        gap: 6px;
        overflow-x: auto;
        border-right: 0;
        border-bottom: 1px solid var(--line);
        padding: 8px;
    }

    #sidebar a {
        flex: 0 0 auto;
        margin: 0;
        padding: 8px 10px;
        white-space: nowrap;
    }

    #content {
        margin: 20px auto;
        padding: 0 14px;
    }

    table.info,
    table.info tbody,
    table.info tr,
    table.info th,
    table.info td {
        display: block;
        width: 100%;
    }

    table.info th {
        border-bottom: 0;
    }

    table.info td {
        border-top: 0;
    }

    .task-section table,
    .task-section thead,
    .task-section tbody,
    .task-section tr,
    .task-section th,
    .task-section td {
        display: block;
        width: 100%;
    }

    .task-section thead {
        display: none;
    }

    .task-section tr {
        border: 1px solid var(--line);
        border-radius: var(--radius);
        background: #fff;
        margin-bottom: 10px;
        overflow: hidden;
    }

    .task-section td {
        border: 0;
        border-bottom: 1px solid var(--line);
        min-height: 42px;
    }

    .task-section td:last-child {
        border-bottom: 0;
    }

    .task-section td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 4px;
        color: var(--muted);
        font-size: 12px;
        font-weight: 700;
    }

    .admin-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .task-edit-table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

@media (max-width: 420px) {
    #header h1 {
        font-size: 22px;
    }

    .modal-actions {
        flex-direction: column-reverse;
    }

    .modal-actions button,
    input[type="submit"] {
        width: 100%;
    }
}
