:root {
    --bg: #f4f6fb;
    --surface: #ffffff;
    --surface-soft: #eef2f9;
    --text: #182033;
    --muted: #64708a;
    --line: #dce3ef;
    --brand: #3457d5;
    --brand-dark: #2643ad;
    --green: #07825b;
    --green-soft: #e0f7ee;
    --orange: #b85c00;
    --orange-soft: #fff0dc;
    --red: #bd2f3a;
    --red-soft: #ffe5e7;
    --shadow: 0 18px 45px rgba(24, 32, 51, 0.08);
    --radius: 16px;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: light;
}

body {
    margin: 0;
    background: radial-gradient(circle at top left, #e7edff 0, var(--bg) 38rem);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    line-height: 1.55;
    min-height: 100vh;
}

a {
    color: var(--brand);
    text-decoration: none;
}

a:hover {
    color: var(--brand-dark);
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    line-height: 1.1;
    letter-spacing: -0.035em;
    margin-bottom: 0.5rem;
}

h2 {
    font-size: 1.15rem;
    letter-spacing: -0.015em;
}

small {
    display: block;
    color: var(--muted);
    font-size: 0.75rem;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(255, 255, 255, 0.86);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(16px);
}

.header-inner {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    min-height: 70px;
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text);
}

.brand strong {
    display: block;
    line-height: 1.15;
}

.brand-logo {
    display: block;
    flex: 0 0 auto;
    width: 44px;
    max-width: 44px;
    height: 44px;
    max-height: 44px;
    object-fit: contain;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    margin-left: auto;
}

.main-nav a {
    padding: 0.5rem 0.8rem;
    border-radius: 9px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 600;
}

.main-nav a:hover,
.main-nav a.active {
    background: var(--surface-soft);
    color: var(--text);
}

.account {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.account-name {
    font-size: 0.9rem;
    font-weight: 600;
}

.avatar {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    overflow: hidden;
    border-radius: 50%;
    background: var(--surface-soft);
    color: var(--brand-dark);
    font-weight: 800;
}

.avatar img,
img.avatar {
    object-fit: cover;
}

.avatar.large {
    width: 84px;
    height: 84px;
    font-size: 1.7rem;
    border: 3px solid var(--surface);
    box-shadow: var(--shadow);
}

.container {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 2rem 0 3rem;
}

.site-footer {
    width: min(1180px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.5rem 0 2rem;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    color: var(--muted);
    font-size: 0.85rem;
}

.flash {
    width: min(1180px, calc(100% - 2rem));
    margin: 1rem auto 0;
    padding: 0.9rem 1.1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
    font-weight: 600;
}

.flash.success {
    border-color: #b6ead8;
    background: var(--green-soft);
    color: var(--green);
}

.flash.error {
    border-color: #ffc7cc;
    background: var(--red-soft);
    color: var(--red);
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.6fr);
    gap: 2rem;
    align-items: stretch;
    padding: 2rem 0 1rem;
}

.hero-copy {
    padding: 2rem 0;
}

.hero-copy p {
    max-width: 650px;
    color: var(--muted);
    font-size: 1.05rem;
}

.hero-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 1rem;
    padding: 2rem;
    border-radius: 24px;
    background: linear-gradient(145deg, #1e2d6b, #3457d5);
    color: #fff;
    box-shadow: var(--shadow);
}

.hero-panel p {
    color: #dbe3ff;
    margin: 0;
}

.hero-panel a {
    color: #fff;
    font-weight: 700;
    text-decoration: underline;
}

.hero-logo {
    width: 78px;
    height: 78px;
    object-fit: contain;
    filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.24));
}

.eyebrow {
    display: inline-block;
    margin-bottom: 0.5rem;
    color: var(--brand);
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-height: 42px;
    padding: 0.65rem 1rem;
    border: 1px solid transparent;
    border-radius: 10px;
    background: var(--brand);
    color: #fff;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.15s ease;
}

.button:hover {
    background: var(--brand-dark);
    color: #fff;
    transform: translateY(-1px);
}

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

.button.secondary:hover {
    background: var(--surface-soft);
    color: var(--text);
}

.button.small {
    min-height: 36px;
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
}

.link-button {
    border: 0;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.link-button:hover {
    color: var(--red);
}

.inline-form {
    display: inline;
}

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1.5rem;
    box-shadow: var(--shadow);
}

.card.narrow {
    max-width: 620px;
    margin: 2rem auto;
}

.card.center,
.center {
    text-align: center;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.user-card,
.command-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.55rem;
    text-align: center;
}

.user-card h2,
.command-card h2 {
    margin: 0.5rem 0 0;
}

.command-card {
    align-items: flex-start;
    text-align: left;
}

.command-card .button {
    margin-top: auto;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 2rem;
    margin: 1rem 0 1.5rem;
}

.page-heading p {
    margin: 0;
    color: var(--muted);
    max-width: 380px;
    text-align: right;
}

.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.25rem 0.6rem;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
}

.badge.allow {
    background: var(--green-soft);
    color: var(--green);
}

.badge.deny,
.badge.ban {
    background: var(--red-soft);
    color: var(--red);
}

.badge.unknown {
    background: var(--orange-soft);
    color: var(--orange);
}

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

.admin-nav {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding: 0.45rem;
    margin: 1.25rem 0 1.5rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.admin-nav a {
    flex: 0 0 auto;
    padding: 0.55rem 0.8rem;
    border-radius: 8px;
    color: var(--muted);
    font-size: 0.87rem;
    font-weight: 700;
}

.admin-nav a.active,
.admin-nav a:hover {
    background: var(--brand);
    color: #fff;
}

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 1rem;
}

.tile {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding: 1.4rem;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
}

.tile:hover {
    border-color: #b8c6ee;
    color: var(--text);
    transform: translateY(-2px);
}

.tile span {
    color: var(--muted);
    font-size: 0.88rem;
}

.layout-with-sidebar {
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 1.25rem;
    align-items: start;
}

.filters {
    position: sticky;
    top: 90px;
}

.pagination {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.pagination a {
    font-weight: 700;
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    font-size: 0.9rem;
    font-weight: 700;
}

label span {
    color: var(--text);
}

input,
textarea,
select {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fbfcff;
    color: var(--text);
    font: inherit;
    font-size: 0.92rem;
    padding: 0.7rem 0.8rem;
}

textarea {
    resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
    outline: 3px solid rgba(52, 87, 213, 0.16);
    border-color: var(--brand);
}

label.checkbox {
    flex-direction: row;
    align-items: center;
    gap: 0.6rem;
}

label.checkbox input {
    width: auto;
}

.two-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.counter {
    margin: -0.6rem 0 0;
    color: var(--muted);
    font-size: 0.8rem;
}

.counter.low {
    color: var(--red);
    font-weight: 700;
}

.warning-text {
    margin: 0;
    padding: 1rem;
    border-left: 4px solid var(--orange);
    border-radius: 8px;
    background: var(--orange-soft);
    color: #713a00;
    font-size: 0.88rem;
}

.notice {
    margin-bottom: 1rem;
    padding: 1rem 1.2rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    font-weight: 700;
}

.notice.warning {
    background: var(--orange-soft);
    border-color: #ffd59e;
    color: var(--orange);
}

.notice.danger {
    background: var(--red-soft);
    border-color: #ffc7cc;
    color: var(--red);
}

.profile-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.profile-main {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.profile-main h2 {
    margin-bottom: 0.2rem;
}

.profile-main p {
    margin: 0;
}

.profile-actions {
    display: flex;
    gap: 0.6rem;
}

.dialog {
    width: min(720px, calc(100% - 2rem));
    max-height: calc(100vh - 2rem);
    overflow: auto;
    border: 0;
    border-radius: 18px;
    padding: 1.5rem;
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 30px 90px rgba(12, 20, 45, 0.35);
}

.dialog::backdrop {
    background: rgba(13, 20, 40, 0.55);
    backdrop-filter: blur(3px);
}

.dialog-header,
.dialog-footer {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.dialog-header h2 {
    margin-bottom: 0.1rem;
}

.dialog-footer {
    justify-content: flex-end;
    padding-top: 0.5rem;
}

.icon-button {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--muted);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}

.details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.8rem;
    padding: 1rem;
    border-radius: 12px;
    background: var(--surface-soft);
}

.details > div {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.details .full {
    grid-column: 1 / -1;
}

.details span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.details strong {
    overflow-wrap: anywhere;
    font-size: 0.92rem;
}

.decision {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 0;
    padding: 0;
    border: 0;
}

.decision legend {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
}

.decision label {
    flex-direction: row;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 0.8rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
}

.decision input {
    width: auto;
}

.center-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 1rem;
}

@media (max-width: 900px) {
    .header-inner {
        flex-wrap: wrap;
        padding: 0.75rem 0;
    }

    .main-nav {
        order: 3;
        width: 100%;
        margin-left: 0;
    }

    .account {
        margin-left: auto;
    }

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

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

    .filters {
        position: static;
    }

    .page-heading {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .page-heading p {
        text-align: left;
    }
}

@media (max-width: 620px) {
    .account-name,
    .brand small {
        display: none;
    }

    .profile-card {
        flex-direction: column;
        align-items: flex-start;
    }

    .details,
    .two-columns {
        grid-template-columns: 1fr;
    }

    .site-footer {
        flex-direction: column;
    }
}

.url-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
}

.url-row p {
    margin: 0.2rem 0 0;
    font-size: 0.85rem;
}

.url-link {
    font-weight: 700;
    overflow-wrap: anywhere;
}

.url-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.code {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    border-radius: 8px;
    background: var(--surface-soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
    overflow-wrap: anywhere;
}

.list {
    margin: 0;
    padding-left: 1.1rem;
}

.list li {
    margin: 0.15rem 0;
}

.button.danger {
    background: var(--red);
}

.button.danger:hover {
    background: #9c2530;
}

.fieldset-reset {
    border: 0;
    padding: 0;
    margin: 0;
}
