:root {
    --navy: #0b1f3a;
    --navy-deep: #06172c;
    --teal: #0e8f8a;
    --teal-dark: #08716d;
    --gold: #d6a84b;
    --ink: #10233d;
    --muted: #66758a;
    --line: #dce4eb;
    --soft: #f4f7f9;
    --white: #fff;
    --danger: #b33b3b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: var(--ink);
    background: var(--soft);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.55;
}

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

a {
    color: inherit;
    text-decoration: none;
}

.admin-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: 250px 1fr;
}

.admin-sidebar {
    position: sticky;
    top: 0;
    display: flex;
    height: 100vh;
    flex-direction: column;
    color: #dce7f1;
    background: var(--navy-deep);
}

.admin-logo {
    display: flex;
    min-height: 92px;
    align-items: center;
    gap: 13px;
    padding: 0 28px;
    border-bottom: 1px solid rgba(255, 255, 255, .1);
}

.admin-logo span,
.admin-brand-mark {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    color: var(--navy);
    background: var(--gold);
    font-size: 19px;
    font-weight: 900;
}

.admin-logo strong {
    color: var(--white);
    font-size: 19px;
}

.admin-sidebar nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: 5px;
    padding: 24px 15px;
}

.admin-sidebar nav a {
    display: flex;
    min-height: 48px;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    color: #b8c7d7;
    font-weight: 700;
}

.admin-sidebar nav a:hover,
.admin-sidebar nav a.active {
    color: var(--white);
    background: var(--teal);
}

.nav-count {
    display: inline-grid;
    min-width: 24px;
    height: 24px;
    place-items: center;
    background: rgba(255, 255, 255, .16);
    font-size: 11px;
}

.sidebar-footer {
    display: grid;
    gap: 1px;
    padding: 15px;
    border-top: 1px solid rgba(255, 255, 255, .1);
}

.sidebar-footer a {
    padding: 11px 16px;
    color: #9eb0c3;
}

.sidebar-footer a:hover {
    color: var(--white);
}

.admin-main {
    min-width: 0;
}

.admin-topbar {
    display: flex;
    min-height: 92px;
    align-items: center;
    justify-content: space-between;
    padding: 19px 34px;
    background: var(--white);
    border-bottom: 1px solid var(--line);
}

.admin-topbar p {
    margin: 0 0 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.admin-topbar h1 {
    margin: 0;
    color: var(--navy);
    font-size: 25px;
}

.admin-user {
    padding: 10px 14px;
    color: var(--navy);
    background: var(--soft);
    font-weight: 800;
}

.admin-content {
    padding: 30px;
}

.admin-alert {
    margin-bottom: 20px;
    padding: 13px 16px;
    border: 1px solid;
}

.admin-alert.success {
    color: #0b684c;
    background: #effbf6;
    border-color: #a4dec7;
}

.admin-alert.error {
    color: #8d3030;
    background: #fff3f3;
    border-color: #ecc0c0;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-grid article {
    position: relative;
    min-height: 150px;
    padding: 24px;
    background: var(--white);
    border: 1px solid var(--line);
}

.stat-grid span {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.stat-grid strong {
    display: block;
    margin-top: 12px;
    color: var(--navy);
    font-size: 36px;
    line-height: 1;
}

.stat-grid a {
    position: absolute;
    right: 22px;
    bottom: 18px;
    color: var(--teal);
    font-size: 12px;
    font-weight: 800;
}

.dashboard-grid {
    display: grid;
    margin-top: 20px;
    grid-template-columns: 1fr 300px;
    gap: 20px;
}

.admin-panel {
    margin-bottom: 22px;
    background: var(--white);
    border: 1px solid var(--line);
}

.panel-heading {
    display: flex;
    min-height: 62px;
    align-items: center;
    justify-content: space-between;
    padding: 0 22px;
    border-bottom: 1px solid var(--line);
}

.panel-heading h2 {
    margin: 0;
    color: var(--navy);
    font-size: 17px;
}

.panel-heading a {
    color: var(--teal);
    font-size: 12px;
    font-weight: 800;
}

.quick-actions {
    align-self: start;
}

.quick-actions > a {
    display: block;
    margin: 13px;
    padding: 16px;
    color: var(--teal);
    border: 1px solid var(--line);
    font-weight: 800;
}

.quick-actions > a:hover {
    color: var(--white);
    background: var(--teal);
    border-color: var(--teal);
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 15px 18px;
    text-align: left;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

th {
    color: var(--muted);
    background: #fbfcfd;
    font-size: 11px;
    letter-spacing: .04em;
    text-transform: uppercase;
}

td {
    color: #45556a;
    font-size: 13px;
}

.status {
    display: inline-flex;
    padding: 4px 8px;
    font-size: 10px;
    font-weight: 900;
    text-transform: uppercase;
}

.status.new,
.status.active {
    color: #05746f;
    background: #e5f7f6;
}

.status.read,
.status.passive {
    color: #687587;
    background: #eef1f4;
}

.status.suspended {
    color: #845f14;
    background: #fff5dc;
}

.status.expired {
    color: #922f2f;
    background: #ffeded;
}

.empty-cell,
.panel-empty {
    padding: 30px;
    color: var(--muted);
    text-align: center;
}

.admin-form {
    padding: 25px;
}

.admin-form.two-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.admin-form label {
    color: var(--navy);
    font-size: 12px;
    font-weight: 800;
}

.admin-form label small {
    margin-left: 8px;
    color: var(--muted);
    font-weight: 500;
}

.admin-form input,
.admin-form textarea,
.admin-form select {
    width: 100%;
    margin-top: 7px;
    padding: 12px 13px;
    color: var(--ink);
    background: var(--white);
    border: 1px solid var(--line);
    outline: 0;
}

.admin-form input:focus,
.admin-form textarea:focus,
.admin-form select:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(14, 143, 138, .1);
}

.admin-form .wide {
    grid-column: 1 / -1;
}

.admin-form .check-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-form .check-label input {
    width: auto;
    margin: 0;
}

.admin-button,
.login-panel button {
    min-height: 46px;
    padding: 0 24px;
    color: var(--white);
    background: var(--teal);
    border: 0;
    cursor: pointer;
    font-weight: 800;
}

.admin-button:hover,
.login-panel button:hover {
    background: var(--teal-dark);
}

.form-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.form-actions a {
    color: var(--muted);
    font-weight: 700;
}

.table-panel {
    margin-top: 20px;
}

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

.row-actions form {
    margin: 0;
}

.row-actions a,
.row-actions button {
    padding: 0;
    color: var(--teal);
    background: transparent;
    border: 0;
    cursor: pointer;
    font-size: 12px;
    font-weight: 800;
}

.row-actions button {
    color: var(--danger);
}

.message-list {
    padding: 20px;
}

.message-item {
    margin-bottom: 14px;
    padding: 22px;
    border: 1px solid var(--line);
}

.message-item.unread {
    border-left: 4px solid var(--teal);
    background: #fbfefe;
}

.message-item header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 20px;
}

.message-item header div {
    display: flex;
    flex-direction: column;
}

.message-item header a,
.message-item time,
.message-phone {
    color: var(--muted);
    font-size: 12px;
}

.message-item h3 {
    margin: 17px 0 7px;
    color: var(--navy);
}

.message-item > p {
    color: #506076;
}

.login-page {
    background: var(--white);
}

.login-shell {
    display: grid;
    min-height: 100vh;
    grid-template-columns: .85fr 1.15fr;
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: 9vw;
    color: var(--white);
    background: var(--navy-deep);
}

.login-brand .admin-brand-mark {
    width: 74px;
    height: 74px;
    font-size: 28px;
}

.login-brand p {
    max-width: 360px;
    margin: 28px 0;
    color: #aebdcb;
    font-size: 18px;
}

.login-brand a {
    color: var(--gold);
    font-weight: 800;
}

.login-panel {
    display: grid;
    place-items: center;
    padding: 40px;
    background: var(--soft);
}

.login-panel > div {
    width: min(100%, 440px);
    padding: 48px;
    background: var(--white);
    border: 1px solid var(--line);
    box-shadow: 0 24px 70px rgba(11, 31, 58, .12);
}

.login-kicker {
    color: var(--teal) !important;
    font-size: 11px !important;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.login-panel h1 {
    margin: 5px 0 8px;
    color: var(--navy);
    font-size: 34px;
}

.login-panel p {
    color: var(--muted);
}

.login-panel form {
    display: grid;
    gap: 17px;
    margin-top: 28px;
}

.login-panel label {
    color: var(--navy);
    font-size: 12px;
    font-weight: 800;
}

.login-panel input {
    width: 100%;
    margin-top: 7px;
    padding: 13px;
    border: 1px solid var(--line);
    outline: 0;
}

.login-panel input:focus {
    border-color: var(--teal);
    box-shadow: 0 0 0 3px rgba(14, 143, 138, .1);
}

@media (max-width: 1050px) {
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
    }

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

@media (max-width: 760px) {
    .admin-shell {
        display: block;
    }

    .admin-sidebar {
        position: static;
        height: auto;
    }

    .admin-logo {
        min-height: 74px;
    }

    .admin-sidebar nav {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        padding: 12px;
    }

    .sidebar-footer {
        grid-template-columns: 1fr 1fr;
    }

    .admin-topbar {
        min-height: 78px;
        padding: 16px 18px;
    }

    .admin-content {
        padding: 18px;
    }

    .stat-grid,
    .admin-form.two-column {
        grid-template-columns: 1fr;
    }

    .admin-form .wide {
        grid-column: auto;
    }

    .login-shell {
        grid-template-columns: 1fr;
    }

    .login-brand {
        min-height: 280px;
        padding: 50px 30px;
    }

    .login-panel {
        padding: 24px 15px;
    }

    .login-panel > div {
        padding: 30px 22px;
    }
}
