:root {
    --bg: #f5f8fc;
    --panel: rgba(255, 255, 255, 0.94);
    --text: #172033;
    --muted: #68758b;
    --border: #dce4ef;
    --primary: #1f6feb;
    --primary-dark: #1558bd;
    --accent: #ff9f43;
    --danger: #c93c4a;
    --danger-bg: #fff2f3;
    --success: #147a52;
    --success-bg: #eefaf5;
    --info-bg: #eef5ff;
    --shadow: 0 18px 55px rgba(28, 53, 87, 0.12);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--bg);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--text);
    background:
        radial-gradient(circle at 8% 2%, rgba(31, 111, 235, 0.10), transparent 28rem),
        radial-gradient(circle at 95% 18%, rgba(255, 159, 67, 0.11), transparent 25rem),
        var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
    color: var(--primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

button,
input,
select,
textarea {
    font: inherit;
}

.background-glow {
    position: fixed;
    z-index: -1;
    width: 18rem;
    height: 18rem;
    border-radius: 999px;
    filter: blur(90px);
    opacity: 0.24;
    pointer-events: none;
}

.background-glow-one {
    top: 3rem;
    left: -7rem;
    background: #4d95ff;
}

.background-glow-two {
    right: -8rem;
    bottom: 7rem;
    background: #ffb15e;
}

.site-header {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 22px 0 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: var(--text);
}

.brand:hover {
    text-decoration: none;
}

.brand img {
    border-radius: 11px;
    box-shadow: 0 8px 18px rgba(31, 111, 235, 0.23);
}

.brand span {
    display: flex;
    flex-direction: column;
    line-height: 1.05;
}

.brand strong {
    font-size: 1.04rem;
}

.brand small {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.72rem;
    letter-spacing: 0.025em;
}

.header-user {
    color: var(--muted);
    font-size: 0.9rem;
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 22px 0 48px;
}

.auth-shell {
    width: min(460px, 100%);
    margin: 6vh auto 0;
}

.panel {
    background: var(--panel);
    border: 1px solid rgba(220, 228, 239, 0.92);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    backdrop-filter: blur(12px);
}

.auth-panel {
    padding: 34px;
}

.panel-pad {
    padding: 28px;
}

.hero-mark {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
    padding: 7px 11px;
    color: var(--primary-dark);
    background: #edf5ff;
    border: 1px solid #d6e8ff;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

h1,
h2,
h3 {
    margin-top: 0;
    letter-spacing: -0.025em;
}

h1 {
    margin-bottom: 10px;
    font-size: clamp(1.85rem, 4vw, 2.55rem);
}

h2 {
    margin-bottom: 8px;
    font-size: 1.28rem;
}

h3 {
    margin-bottom: 8px;
    font-size: 1rem;
}

.lead {
    margin: 0 0 26px;
    color: var(--muted);
    line-height: 1.58;
}

.muted {
    color: var(--muted);
}

.small {
    font-size: 0.86rem;
}

.form-grid {
    display: grid;
    gap: 17px;
}

.field {
    display: grid;
    gap: 7px;
}

.field label {
    font-weight: 700;
    font-size: 0.9rem;
}

.field-note {
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.4;
}

input[type="email"],
input[type="text"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    min-height: 46px;
    padding: 10px 13px;
    color: var(--text);
    background: #fff;
    border: 1px solid #cfd9e6;
    border-radius: 11px;
    outline: none;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}

textarea {
    min-height: 92px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #73a9f5;
    box-shadow: 0 0 0 4px rgba(31, 111, 235, 0.10);
}

.code-input {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: 0.28em;
    text-align: center;
}

.button-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    padding: 9px 15px;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 750;
    line-height: 1;
    text-decoration: none;
    transition: transform 80ms ease, box-shadow 120ms ease, background 120ms ease;
}

.btn:hover {
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #3586ff);
    box-shadow: 0 8px 18px rgba(31, 111, 235, 0.20);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
}

.btn-secondary {
    color: var(--text);
    background: #fff;
    border-color: var(--border);
}

.btn-danger {
    color: var(--danger);
    background: var(--danger-bg);
    border-color: #f2cbd0;
}

.btn-quiet {
    color: var(--muted);
    background: transparent;
    border-color: transparent;
}

.btn-small {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 0.82rem;
}

.notice {
    margin-bottom: 18px;
    padding: 13px 15px;
    border: 1px solid;
    border-radius: 11px;
    line-height: 1.45;
}

.notice-success {
    color: var(--success);
    background: var(--success-bg);
    border-color: #c8ebdc;
}

.notice-error {
    color: #a52b39;
    background: var(--danger-bg);
    border-color: #f1c6cb;
}

.notice-info {
    color: #245f9f;
    background: var(--info-bg);
    border-color: #cddff7;
}

.auth-links {
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--border);
    color: var(--muted);
    font-size: 0.88rem;
    text-align: center;
}

.turnstile-wrap {
    min-height: 65px;
}

.dashboard-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.dashboard-head p {
    margin: 5px 0 0;
    color: var(--muted);
}

.dashboard-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: end;
    gap: 12px;
}

.toolbar-select {
    min-width: 190px;
}

.forward-box {
    margin: 0 0 20px;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--muted);
    background: #f7faff;
    border: 1px solid #dae7f7;
    border-radius: 12px;
}

.forward-box strong {
    color: var(--text);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--border);
    border-radius: 13px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
}

th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid #e8edf4;
    text-align: left;
    vertical-align: middle;
}

th {
    color: #5a687d;
    background: #f8fafd;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.045em;
}

td {
    font-size: 0.91rem;
}

tr:last-child td {
    border-bottom: 0;
}

.address-text {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.87rem;
    font-weight: 700;
}

.inline-form {
    display: inline;
}

.empty-state {
    padding: 46px 22px;
    text-align: center;
}

.empty-state strong {
    display: block;
    margin-bottom: 7px;
    font-size: 1.08rem;
}

.empty-state p {
    max-width: 520px;
    margin: 0 auto 18px;
    color: var(--muted);
    line-height: 1.5;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 13px;
    margin-bottom: 20px;
}

.stat {
    padding: 18px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 13px;
}

.stat span {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.045em;
}

.stat strong {
    display: block;
    margin-top: 5px;
    font-size: 1.45rem;
}

dialog {
    width: min(480px, calc(100% - 30px));
    padding: 0;
    border: 0;
    border-radius: 16px;
    box-shadow: 0 28px 90px rgba(13, 31, 56, 0.28);
}

dialog::backdrop {
    background: rgba(13, 26, 46, 0.46);
    backdrop-filter: blur(3px);
}

.dialog-body {
    padding: 26px;
}

.dialog-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 20px;
}

.dialog-head h2 {
    margin: 0;
}

.dialog-close {
    width: 34px;
    height: 34px;
    padding: 0;
    border: 0;
    border-radius: 9px;
    color: var(--muted);
    background: #f2f5f9;
    cursor: pointer;
    font-size: 1.25rem;
}

.address-preview {
    padding: 12px 13px;
    color: var(--primary-dark);
    background: #edf5ff;
    border: 1px solid #d3e6ff;
    border-radius: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.84rem;
    overflow-wrap: anywhere;
}

.danger-zone {
    color: var(--danger);
}

.status-pill {
    display: inline-flex;
    align-items: center;
    min-height: 25px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 750;
}

.status-active {
    color: var(--success);
    background: var(--success-bg);
}

.status-deleted {
    color: #7d4d52;
    background: #f6eeee;
}

.site-footer {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 0 0 28px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: #8591a3;
    font-size: 0.78rem;
}

@media (max-width: 720px) {
    .site-header,
    .page-shell,
    .site-footer {
        width: min(100% - 22px, 1180px);
    }

    .header-user {
        display: none;
    }

    .auth-panel,
    .panel-pad {
        padding: 22px;
    }

    .dashboard-head {
        align-items: stretch;
        flex-direction: column;
    }

    .dashboard-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .toolbar-select {
        min-width: 0;
    }

    .btn {
        min-height: 44px;
    }

    th,
    td {
        padding: 11px;
    }

    .site-footer {
        flex-direction: column;
        gap: 4px;
    }
}
