:root {
    --bg: #07101d;
    --surface: #111d2d;
    --surface-2: #162438;
    --border: #25364d;
    --text: #f4f7fb;
    --muted: #93a2b6;
    --gold: #f6b73c;
    --green: #29c482;
    --red: #f26a73;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family:
        Inter,
        "Segoe UI",
        Arial,
        sans-serif;
}

body {
    min-height: 100vh;
    padding: 28px;
    background:
        radial-gradient(
            circle at top right,
            rgba(246, 183, 60, 0.11),
            transparent 35%
        ),
        var(--bg);
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.hidden {
    display: none !important;
}

.loading-view {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--bg);
    display: grid;
    place-items: center;
}

.loading-card {
    display: grid;
    justify-items: center;
    gap: 15px;
    color: var(--muted);
    font-size: 12px;
}

body:not(.auth-pending) .loading-view {
    display: none;
}

.shell {
    max-width: 1250px;
    margin: 0 auto;
}

.login-card {
    width: 100%;
    max-width: 430px;
    margin: 8vh auto 0;
    padding: 32px;
    border: 1px solid var(--border);
    border-radius: 22px;
    background:
        linear-gradient(
            145deg,
            rgba(22, 36, 56, 0.99),
            rgba(10, 20, 34, 0.99)
        );
    box-shadow:
        0 35px 90px rgba(0, 0, 0, 0.38);
}

.logo {
    width: 66px;
    height: 66px;
    border: 1px solid rgba(246, 183, 60, 0.55);
    border-radius: 18px;
    background: #080e18;
    color: var(--gold);
    display: grid;
    place-items: center;
    font-size: 22px;
    font-weight: 900;
}

h1 {
    margin: 21px 0 7px;
}

p {
    margin: 0;
    color: var(--muted);
}

.back-link {
    width: fit-content;
    margin-bottom: 18px;
    padding: 10px 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    font-size: 11px;
    font-weight: 800;
}

.back-link:hover {
    border-color: rgba(246, 183, 60, 0.45);
    color: var(--gold);
}

form {
    margin-top: 25px;
}

label {
    margin-bottom: 15px;
    display: grid;
    gap: 8px;
}

label span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
}

input,
select {
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    outline: none;
    background: #0a1422;
    color: var(--text);
}

button {
    min-height: 42px;
    padding: 0 15px;
    border: 1px solid var(--gold);
    border-radius: 10px;
    background: var(--gold);
    color: #171006;
    font-size: 12px;
    font-weight: 800;
}

button.secondary {
    border-color: var(--border);
    background: var(--surface-2);
    color: var(--text);
}

button.danger {
    border-color: rgba(242, 106, 115, 0.4);
    background: rgba(242, 106, 115, 0.1);
    color: #ffabb1;
}

form button {
    width: 100%;
}

small {
    min-height: 18px;
    margin-top: 12px;
    color: var(--red);
    display: block;
    text-align: center;
}

.dashboard header {
    min-height: 110px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.dashboard header h1 {
    margin: 0 0 7px;
}

.header-actions {
    display: flex;
    gap: 9px;
}

.summary {
    margin: 23px 0 17px;
    display: grid;
    grid-template-columns:
        repeat(3, minmax(0, 1fr));
    gap: 13px;
}

.summary article,
.panel {
    border: 1px solid var(--border);
    border-radius: 15px;
    background:
        linear-gradient(
            145deg,
            rgba(22, 36, 56, 0.97),
            rgba(12, 23, 38, 0.97)
        );
}

.summary article {
    min-height: 115px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.summary span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}

.summary strong {
    margin-top: 11px;
    font-size: 28px;
}

.panel {
    padding: 18px;
}

.subscription-row {
    padding: 15px;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns:
        minmax(170px, 1.2fr)
        135px
        150px
        120px
        115px
        115px
        auto;
    align-items: end;
    gap: 12px;
}

.subscription-row:last-child {
    border-bottom: none;
}

.restaurant-name strong,
.restaurant-name span {
    display: block;
}

.restaurant-name strong {
    font-size: 13px;
}

.restaurant-name span {
    margin-top: 5px;
    color: var(--muted);
    font-size: 10px;
}

.control {
    display: grid;
    gap: 6px;
}

.control span {
    color: var(--muted);
    font-size: 9px;
    font-weight: 700;
}

.check {
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 10px;
}

.check input {
    min-height: auto;
    width: 18px;
    height: 18px;
    accent-color: var(--gold);
}

.service-state {
    display: inline-flex;
    margin-top: 7px;
    padding: 5px 8px;
    border: 1px solid rgba(41, 196, 130, 0.35);
    border-radius: 20px;
    color: #68e8b1;
    font-size: 9px;
    font-weight: 800;
}

.service-state.blocked {
    border-color: rgba(242, 106, 115, 0.4);
    color: #ffabb1;
}

.empty {
    min-height: 160px;
    color: var(--muted);
    display: grid;
    place-items: center;
}

.toast {
    position: fixed;
    right: 22px;
    bottom: 22px;
    max-width: 380px;
    padding: 13px 16px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #17263a;
    opacity: 0;
    pointer-events: none;
    transform: translateY(12px);
    transition: 0.2s ease;
}

.toast.visible {
    opacity: 1;
    transform: translateY(0);
}

.toast.error {
    color: #ffb1b7;
}

@media (max-width: 900px) {
    body {
        padding: 15px;
    }

    .dashboard header {
        align-items: flex-start;
        flex-direction: column;
    }

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

    .subscription-row {
        grid-template-columns: 1fr;
        align-items: stretch;
    }
}
