:root {
    --bg-top: #f4f7fb;
    --bg-bottom: #dbe7f5;
    --panel: #ffffff;
    --ink: #10223a;
    --muted: #5f7188;
    --line: #d9e2ee;

    --primary: #0f5e76;
    --primary-hover: #0a4b5f;
    --secondary: #e6ecf4;
    --secondary-hover: #d9e1ec;
    --danger: #9f1e1e;
    --danger-hover: #831818;

    --ok-bg: #dcfce7;
    --ok-ink: #166534;
    --warn-bg: #fff4ce;
    --warn-ink: #92400e;
    --err-bg: #fee2e2;
    --err-ink: #991b1b;
}

* {
    box-sizing: border-box;
}

body.app-page {
    margin: 0;
    min-height: 100vh;
    color: var(--ink);
    font-family: "IBM Plex Sans", "Avenir Next", "Segoe UI", Helvetica, sans-serif;
    background:
        radial-gradient(1100px 600px at 12% -10%, #ffffff 10%, transparent 45%),
        radial-gradient(900px 480px at 100% 0%, #ecf4ff 20%, transparent 58%),
        linear-gradient(165deg, var(--bg-top), var(--bg-bottom));
}

.container {
    width: min(1280px, calc(100% - 32px));
    margin: 26px auto;
}

.card {
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 20px 50px rgba(8, 23, 48, 0.1);
    padding: 22px;
}

.top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 18px;
}

h1 {
    margin: 0;
    font-size: clamp(1.3rem, 1rem + 1vw, 1.9rem);
    line-height: 1.15;
    letter-spacing: -0.02em;
}

.subtitle {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 0.95rem;
}

.controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.controls form,
.row-actions form {
    margin: 0;
}

button,
.link-btn {
    appearance: none;
    border: 0;
    border-radius: 12px;
    padding: 10px 13px;
    font-weight: 700;
    text-decoration: none;
    font-size: 0.86rem;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.16s ease, background-color 0.18s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

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

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

.primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 18px rgba(15, 94, 118, 0.22);
}

.primary:hover {
    background: var(--primary-hover);
}

.secondary {
    background: var(--secondary);
    color: #1a2b42;
}

.secondary:hover {
    background: var(--secondary-hover);
}

.danger {
    background: var(--danger);
    color: #fff;
}

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

.full {
    width: 100%;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #24364f;
}

input[type="text"],
input[type="password"] {
    width: 100%;
    border: 1px solid #cfd9e8;
    border-radius: 12px;
    background: #fff;
    color: #132238;
    padding: 10px 12px;
    margin-bottom: 13px;
    font-size: 0.95rem;
}

input[type="text"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: #6a97c6;
    box-shadow: 0 0 0 3px rgba(94, 142, 195, 0.2);
}

.flash {
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 14px;
    font-size: 0.9rem;
    border: 1px solid transparent;
}

.flash.error {
    background: var(--err-bg);
    border-color: #f9b4b4;
    color: var(--err-ink);
}

.flash.success {
    background: var(--ok-bg);
    border-color: #9be3bb;
    color: var(--ok-ink);
}

.flash.warning {
    background: var(--warn-bg);
    border-color: #f4d387;
    color: var(--warn-ink);
}

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

table {
    width: 100%;
    min-width: 1060px;
    border-collapse: separate;
    border-spacing: 0;
}

thead th {
    background: #f3f7fc;
    color: #4d6079;
    font-size: 0.74rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 11px 10px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}

tbody td {
    font-size: 0.86rem;
    padding: 11px 10px;
    border-bottom: 1px solid #edf2f9;
    vertical-align: top;
}

tbody tr:nth-child(even) {
    background: #fbfdff;
}

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

.status {
    display: inline-block;
    border-radius: 999px;
    padding: 4px 9px;
    font-size: 0.73rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.status.synced,
.status.success {
    background: #dcfce7;
    color: #166534;
    border-color: #9be3bb;
}

.status.failed,
.status.failed_nas,
.status.failed_dump {
    background: #fee2e2;
    color: #991b1b;
    border-color: #f9b4b4;
}

.status.pending,
.status.not_configured,
.status.deleted_remote,
.status.skipped,
.status.not_synced {
    background: #eef2f7;
    color: #485a72;
    border-color: #d7e0ec;
}

.row-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0;
}

.muted {
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.35;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 18px;
}

.wrap {
    width: min(430px, 100%);
    background: rgba(255, 255, 255, 0.97);
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 24px 58px rgba(9, 24, 49, 0.14);
    padding: 24px;
}

.wrap h1 {
    margin: 0 0 10px;
}

.wrap p {
    margin: 0 0 18px;
    color: var(--muted);
}

@media (max-width: 980px) {
    .container {
        width: calc(100% - 20px);
        margin: 14px auto;
    }

    .card {
        border-radius: 14px;
        padding: 14px;
    }

    .table-wrap {
        border: 0;
        background: transparent;
    }

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

    table {
        min-width: 0;
    }

    thead {
        display: none;
    }

    tbody tr {
        border: 1px solid var(--line);
        border-radius: 14px;
        margin-bottom: 12px;
        background: #fff;
        overflow: hidden;
    }

    tbody td {
        border: 0;
        border-bottom: 1px dashed #e5edf7;
        display: grid;
        grid-template-columns: minmax(105px, 34%) 1fr;
        gap: 10px;
        align-items: start;
    }

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

    tbody td::before {
        content: attr(data-label);
        color: #4d6079;
        font-weight: 700;
        font-size: 0.73rem;
        text-transform: uppercase;
        letter-spacing: 0.03em;
    }

    .row-actions {
        justify-content: flex-start;
    }
}
