* {
    box-sizing: border-box;
}

:root {
    --bg: #f6f7fb;
    --panel: #ffffff;
    --ink: #182036;
    --muted: #69748a;
    --line: #dde2ee;
    --brand: #ef4f7a;
    --brand-dark: #27215f;
    --teal: #0f9f9a;
    --amber: #c18416;
    --danger: #bf2f4a;
    --shadow: 0 18px 60px rgba(24, 32, 54, 0.09);
}

body {
    margin: 0;
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
}

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

code,
pre {
    font-family: Consolas, "Courier New", monospace;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

.button-primary {
    color: #fff;
    background: var(--brand);
    border-color: var(--brand);
}

.button-ghost {
    color: var(--ink);
    background: #fff;
}

.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

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

.brand-large {
    margin-bottom: 28px;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand), var(--teal));
    font-weight: 900;
}

.brand strong,
.brand small {
    display: block;
}

.brand small {
    color: var(--muted);
    font-size: 0.78rem;
}

.eyebrow {
    display: inline-block;
    color: var(--brand);
    font-size: 0.76rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

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

.login-shell {
    width: min(100%, 1080px);
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.7fr);
    gap: 18px;
}

.login-shell-narrow {
    grid-template-columns: minmax(0, 720px);
}

.login-panel,
.ops-panel,
.section-band,
.stat-card,
.guild-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.login-panel {
    padding: 46px;
}

.login-panel h1 {
    margin: 10px 0 14px;
    max-width: 680px;
    font-size: clamp(2rem, 5vw, 4rem);
    line-height: 1.02;
}

.login-panel p {
    max-width: 640px;
    margin: 0 0 26px;
    color: var(--muted);
    font-size: 1.05rem;
    line-height: 1.7;
}

.login-actions,
.actions,
.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.ops-panel {
    align-self: stretch;
    padding: 28px;
    display: grid;
    gap: 12px;
}

.metric-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 1px solid var(--line);
    padding: 14px 0;
}

.metric-row span {
    color: var(--muted);
}

.dashboard-body {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.dashboard-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 22px;
    background: #12182b;
    color: #fff;
    display: flex;
    flex-direction: column;
}

.side-nav {
    display: grid;
    gap: 8px;
    margin-top: 28px;
}

.side-nav a {
    padding: 11px 12px;
    border-radius: 8px;
    color: #dbe3f8;
}

.side-nav a:hover {
    background: rgba(255, 255, 255, 0.08);
}

.sidebar-footer {
    margin-top: auto;
    display: grid;
    gap: 10px;
    color: #bac5dd;
    font-size: 0.9rem;
}

.dashboard-main {
    min-width: 0;
    padding: 30px;
}

.topbar,
.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.topbar {
    margin-bottom: 22px;
}

.topbar h1,
.section-heading h2 {
    margin: 4px 0 0;
}

.section-heading p {
    margin: 6px 0 0;
    color: var(--muted);
}

.user-chip {
    display: flex;
    gap: 12px;
    align-items: center;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
}

.user-chip a {
    color: var(--brand);
    font-weight: 700;
}

.notice {
    margin: 0 0 16px;
    padding: 13px 15px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
}

.notice-ok {
    border-color: rgba(15, 159, 154, 0.35);
    color: #086865;
}

.notice-error {
    border-color: rgba(191, 47, 74, 0.35);
    color: var(--danger);
}

.notice-warn {
    border-color: rgba(193, 132, 22, 0.35);
    color: var(--amber);
}

.code-block {
    overflow-x: auto;
    padding: 14px;
    border-radius: 8px;
    background: #111827;
    color: #eef2ff;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

.stat-card {
    padding: 22px;
}

.stat-card span,
.guild-row small,
.guild-card small,
.empty-state,
.audit-row small,
.audit-row span {
    color: var(--muted);
}

.stat-card strong {
    display: block;
    margin-top: 12px;
    font-size: 2rem;
}

.section-band {
    padding: 22px;
    margin-bottom: 16px;
}

.guild-list {
    display: grid;
    gap: 10px;
    margin-top: 18px;
}

.guild-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

.guild-row strong,
.guild-row small {
    display: block;
}

.guild-avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    color: #fff;
    background: var(--brand-dark);
    font-weight: 900;
}

.guild-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 18px;
}

.guild-card {
    padding: 18px;
    display: grid;
    gap: 10px;
}

.pill {
    display: inline-flex;
    width: fit-content;
    padding: 5px 9px;
    border-radius: 999px;
    color: #086865;
    background: rgba(15, 159, 154, 0.12);
    font-size: 0.78rem;
    font-weight: 800;
}

.settings-form {
    margin-top: 22px;
}

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

.form-grid label {
    display: grid;
    gap: 7px;
    color: var(--muted);
    font-weight: 700;
}

.form-grid input,
.form-grid select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0 12px;
    color: var(--ink);
    background: #fff;
}

.toggle-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 20px 0;
}

.toggle-card {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 8px;
    font-weight: 700;
}

.audit-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.audit-row {
    display: grid;
    grid-template-columns: minmax(160px, 1fr) minmax(140px, auto) auto;
    gap: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
}

@media (max-width: 860px) {
    .login-shell,
    .dashboard-body,
    .stats-grid,
    .form-grid,
    .toggle-grid {
        grid-template-columns: 1fr;
    }

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

    .topbar,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-main,
    .login-panel {
        padding: 22px;
    }

    .audit-row {
        grid-template-columns: 1fr;
    }
}
