:root {
    --bg: #080a0e;
    --bg-soft: #0e1218;
    --panel: #121722;
    --panel-2: #171d2a;
    --line: #263041;
    --text: #eef2f8;
    --muted: #94a0b4;
    --red: #e23b3b;
    --red-soft: #ff6b5f;
    --green: #2ecc71;
    --yellow: #f1c40f;
    --blue: #4c8dff;
    --grey: #7b8494;
    --shadow: 0 24px 70px rgba(0, 0, 0, 0.45);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
}

.page-glow {
    position: fixed;
    inset: -20% -10% auto;
    height: 70vh;
    background:
        radial-gradient(circle at 20% 10%, rgba(226, 59, 59, 0.22), transparent 45%),
        radial-gradient(circle at 78% 0%, rgba(76, 141, 255, 0.14), transparent 42%);
    pointer-events: none;
    z-index: 0;
}

code {
    font-family: "SFMono-Regular", ui-monospace, monospace;
    font-size: 0.92em;
    color: #c9d4e6;
}

.topbar {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    max-width: 1180px;
    margin: 0 auto;
    padding: 26px 24px 10px;
}

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

.brand-mark {
    font-weight: 900;
    letter-spacing: 0.14em;
    font-size: 1.05rem;
    color: var(--red-soft);
}

.brand-sub {
    color: var(--muted);
    font-size: 0.82rem;
}

.topbar-actions {
    display: flex;
    gap: 10px;
}

.page {
    position: relative;
    z-index: 1;
    width: min(1180px, 100% - 40px);
    margin: 0 auto;
    padding: 10px 0 80px;
}

.login-view {
    display: grid;
    place-items: center;
    min-height: calc(100vh - 140px);
}

.login-card {
    width: min(480px, 100%);
    padding: 46px 40px;
    text-align: center;
    background: linear-gradient(180deg, rgba(23, 29, 42, 0.95), rgba(14, 18, 24, 0.95));
    border: 1px solid var(--line);
    border-radius: 26px;
    box-shadow: var(--shadow);
}

.login-logo {
    font-size: 3rem;
    filter: drop-shadow(0 8px 24px rgba(226, 59, 59, 0.45));
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--red-soft);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.login-card h1 {
    margin: 4px 0 12px;
    font-size: clamp(2rem, 6vw, 2.6rem);
    letter-spacing: -0.03em;
}

.login-copy {
    color: var(--muted);
    margin: 0 0 28px;
}

.login-note {
    color: var(--muted);
    font-size: 0.8rem;
    margin: 18px 0 0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 42px;
    padding: 10px 18px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: var(--panel-2);
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, opacity 0.15s ease;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.btn.ghost {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--line);
    color: #dbe3ef;
}

.btn.ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
}

.btn.discord {
    width: 100%;
    background: #5865f2;
    color: #fff;
    text-decoration: none;
    min-height: 50px;
    font-size: 1rem;
}

.btn.discord:hover {
    background: #4752c4;
    transform: translateY(-1px);
}

.discord-mark {
    font-weight: 900;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    padding: 3px 7px;
    background: rgba(255, 255, 255, 0.18);
    border-radius: 6px;
}

.btn.success {
    background: var(--green);
    color: #05170c;
}

.btn.primary {
    background: var(--blue);
    color: #fff;
}

.btn.danger {
    background: var(--red);
    color: #fff;
}

.btn.danger-text {
    color: var(--red-soft);
}

.profile-card {
    display: flex;
    align-items: center;
    gap: 22px;
    padding: 24px;
    background: linear-gradient(135deg, rgba(23, 29, 42, 0.96), rgba(14, 18, 24, 0.96));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 22px;
}

.avatar {
    width: 96px;
    height: 96px;
    border-radius: 24px;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.14);
    background: #1c2432;
    flex: 0 0 auto;
}

.profile-main {
    min-width: 0;
    flex: 1;
}

.profile-heading {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.profile-heading h1 {
    margin: 0;
    font-size: clamp(1.45rem, 4vw, 2rem);
    letter-spacing: -0.02em;
    overflow-wrap: anywhere;
}

.rank-badge {
    display: inline-flex;
    align-items: center;
    padding: 5px 11px;
    border-radius: 999px;
    background: rgba(226, 59, 59, 0.14);
    border: 1px solid rgba(226, 59, 59, 0.35);
    color: #ffd7d2;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.profile-username {
    margin: 6px 0 2px;
    color: var(--muted);
    overflow-wrap: anywhere;
}

.profile-id {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
}

.roles-wrap {
    position: relative;
    align-self: flex-start;
}

.chevron {
    font-size: 0.7rem;
    opacity: 0.75;
}

.roles-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 20;
    width: 260px;
    max-height: 320px;
    overflow-y: auto;
    padding: 8px;
    background: #111722;
    border: 1px solid var(--line);
    border-radius: 13px;
    box-shadow: var(--shadow);
}

.role-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: 0.88rem;
}

.role-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.role-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--grey);
    flex: 0 0 auto;
}

.role-empty {
    padding: 10px;
    color: var(--muted);
    font-size: 0.85rem;
}

.tabs {
    display: flex;
    gap: 6px;
    padding: 6px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid var(--line);
    border-radius: 14px;
    width: fit-content;
    margin-bottom: 22px;
}

.tab {
    padding: 9px 22px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--muted);
    font: inherit;
    font-weight: 650;
    font-size: 0.9rem;
    cursor: pointer;
}

.tab.active {
    background: var(--panel-2);
    color: var(--text);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.status-card {
    padding: 26px;
    background: linear-gradient(135deg, rgba(23, 29, 42, 0.96), rgba(13, 17, 23, 0.96));
    border: 1px solid var(--line);
    border-left: 4px solid var(--grey);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.status-card.is-on_duty {
    border-left-color: var(--green);
}

.status-card.is-on_break {
    border-left-color: var(--yellow);
}

.status-card.is-off_duty {
    border-left-color: var(--grey);
}

.status-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

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

.status-title h2 {
    margin: 0;
    font-size: 1.55rem;
    letter-spacing: -0.02em;
}

.status-dot {
    width: 13px;
    height: 13px;
    border-radius: 50%;
    background: var(--grey);
    box-shadow: 0 0 0 5px rgba(123, 132, 148, 0.15);
}

.status-dot.on_duty {
    background: var(--green);
    box-shadow: 0 0 0 5px rgba(46, 204, 113, 0.15);
}

.status-dot.on_break {
    background: var(--yellow);
    box-shadow: 0 0 0 5px rgba(241, 196, 15, 0.15);
}

.status-copy {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.88rem;
}

.shift-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 22px;
}

.shift-meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-top: 22px;
}

.meta-box {
    padding: 13px 15px;
    background: rgba(255, 255, 255, 0.035);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 11px;
}

.meta-box span {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.meta-box strong {
    font-size: 1rem;
    font-weight: 650;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 18px;
}

.summary-card {
    padding: 17px 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.summary-card span {
    display: block;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.summary-card strong {
    font-size: 1.35rem;
    letter-spacing: -0.02em;
}

.panel {
    margin-top: 22px;
    padding: 26px;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.section-heading h2 {
    margin: 0;
    font-size: 1.3rem;
    letter-spacing: -0.02em;
}

.manage-section {
    margin-top: 22px;
    padding: 26px;
    background: linear-gradient(135deg, rgba(226, 59, 59, 0.07), rgba(19, 24, 33, 0.96) 45%);
    border: 1px solid rgba(226, 59, 59, 0.25);
    border-radius: var(--radius);
}

.manage-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 14px;
    margin-top: 14px;
}

.manage-card {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 18px;
    background: rgba(9, 12, 17, 0.55);
    border: 1px solid var(--line);
    border-radius: 14px;
}

.manage-card h3 {
    margin: 0;
    font-size: 1rem;
}

.manage-card .btn {
    margin-top: auto;
}

.manage-card .muted {
    margin: 0;
    font-size: 0.8rem;
}

.danger-zone {
    border-color: rgba(226, 59, 59, 0.3);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.field.full {
    margin-top: 14px;
}

.field span {
    color: var(--muted);
    font-size: 0.76rem;
    font-weight: 650;
}

.field small {
    font-weight: 400;
    opacity: 0.8;
}

.field input,
.field select {
    width: 100%;
    min-height: 40px;
    padding: 8px 11px;
    background: #0b0f16;
    border: 1px solid var(--line);
    border-radius: 9px;
    color: var(--text);
    font: inherit;
    font-size: 0.9rem;
}

.field input:focus,
.field select:focus {
    outline: 2px solid rgba(76, 141, 255, 0.5);
    outline-offset: 1px;
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

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

.shift-list,
.infraction-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.shift-item,
.infraction-item {
    padding: 16px 18px;
    background: rgba(255, 255, 255, 0.028);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 13px;
}

.shift-item.voided,
.infraction-item.voided {
    opacity: 0.58;
}

.item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.item-head h3 {
    margin: 0;
    font-size: 0.98rem;
    overflow-wrap: anywhere;
}

.active-user {
    color: #dbe4f0;
    text-decoration: none;
}

.active-user:hover {
    color: #fff;
    text-decoration: underline;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.03em;
    background: rgba(255, 255, 255, 0.07);
    color: #cfd8e6;
    white-space: nowrap;
}

.badge.green {
    background: rgba(46, 204, 113, 0.16);
    color: #8ef0b7;
}

.badge.red {
    background: rgba(226, 59, 59, 0.16);
    color: #ff9f97;
}

.badge.yellow {
    background: rgba(241, 196, 15, 0.16);
    color: #ffe58a;
}

.badge.blue {
    background: rgba(76, 141, 255, 0.16);
    color: #a9c6ff;
}

.item-details {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin-top: 8px;
    color: var(--muted);
    font-size: 0.82rem;
}

.item-details strong {
    color: #dbe4f0;
    font-weight: 600;
}

.item-reason {
    margin: 11px 0 0;
    padding: 10px 12px;
    background: rgba(0, 0, 0, 0.22);
    border-left: 2px solid rgba(255, 255, 255, 0.12);
    border-radius: 0 8px 8px 0;
    color: #cdd6e3;
    font-size: 0.87rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

details {
    margin-top: 10px;
}

summary {
    cursor: pointer;
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
}

.break-row,
.adjust-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 5px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.07);
    color: var(--muted);
    font-size: 0.8rem;
}

.break-row:last-child,
.adjust-row:last-child {
    border-bottom: 0;
}

.loading {
    padding: 20px 0;
    color: var(--muted);
    text-align: center;
    font-size: 0.9rem;
}

.empty {
    padding: 22px 0;
    color: var(--muted);
    text-align: center;
    font-size: 0.9rem;
}

.error-box {
    padding: 18px;
    background: rgba(226, 59, 59, 0.1);
    border: 1px solid rgba(226, 59, 59, 0.3);
    border-radius: 12px;
    color: #ffc7c2;
    font-size: 0.9rem;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 26px;
    z-index: 100;
    max-width: min(520px, calc(100vw - 32px));
    padding: 13px 18px;
    background: #1a2230;
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
    color: var(--text);
    font-size: 0.9rem;
    opacity: 0;
    transform: translate(-50%, 18px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
    opacity: 1;
    transform: translate(-50%, 0);
}

.toast.error {
    border-color: rgba(226, 59, 59, 0.5);
    color: #ffb9b3;
}

.toast.success {
    border-color: rgba(46, 204, 113, 0.45);
    color: #a8f5c6;
}

@media (max-width: 720px) {
    .topbar {
        padding: 18px 16px 6px;
        flex-wrap: wrap;
    }

    .brand-sub {
        display: none;
    }

    .page {
        width: min(100% - 24px, 1180px);
    }

    .profile-card {
        flex-wrap: wrap;
        padding: 18px;
    }

    .avatar {
        width: 72px;
        height: 72px;
        border-radius: 18px;
    }

    .roles-wrap {
        width: 100%;
    }

    .roles-wrap .btn {
        width: 100%;
    }

    .roles-menu {
        left: 0;
        right: auto;
        width: 100%;
    }

    .status-card,
    .panel,
    .manage-section {
        padding: 18px;
    }

    .shift-actions .btn {
        flex: 1 1 100%;
    }

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