:root {
    --bg: #06131b;
    --bg-soft: #0d202b;
    --panel: rgba(9, 25, 34, 0.84);
    --panel-strong: rgba(13, 34, 46, 0.96);
    --line: rgba(159, 203, 215, 0.14);
    --text: #eef7f7;
    --muted: #91acb5;
    --accent: #f2b95d;
    --accent-2: #8ed3c8;
    --danger: #ff8c79;
    --shadow: 0 28px 60px rgba(0, 0, 0, 0.28);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Trebuchet MS", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(242, 185, 93, 0.2), transparent 28%),
        radial-gradient(circle at bottom right, rgba(142, 211, 200, 0.18), transparent 24%),
        linear-gradient(135deg, #071219 0%, #0b1922 42%, #0c1720 100%);
    min-height: 100vh;
}

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

input,
select,
textarea,
button {
    font: inherit;
}

input,
select,
textarea {
    width: 100%;
    margin-top: 8px;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.04);
    color: var(--text);
    outline: none;
    appearance: none;
}

select,
option {
    background: #10222d;
    color: var(--text);
}

textarea {
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: rgba(242, 185, 93, 0.6);
    box-shadow: 0 0 0 4px rgba(242, 185, 93, 0.08);
}

.bg-orb {
    position: fixed;
    border-radius: 999px;
    filter: blur(90px);
    pointer-events: none;
    opacity: 0.45;
}

.bg-orb-a {
    width: 320px;
    height: 320px;
    top: -70px;
    right: -40px;
    background: rgba(242, 185, 93, 0.28);
}

.bg-orb-b {
    width: 360px;
    height: 360px;
    left: -80px;
    bottom: -80px;
    background: rgba(142, 211, 200, 0.18);
}

.layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.sidebar {
    width: 290px;
    padding: 28px 22px;
    border-right: 1px solid var(--line);
    background: rgba(4, 14, 20, 0.86);
    backdrop-filter: blur(18px);
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 32px;
}

.brand strong,
h1,
h2 {
    letter-spacing: -0.04em;
}

.brand small,
.muted,
.lead,
.sidebar-label {
    color: var(--muted);
}

.brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(145deg, var(--accent), #f7df9a);
    color: #1e160c;
    font-weight: 800;
}

.nav a,
.sidebar-card,
.panel,
.hero {
    border: 1px solid var(--line);
    background: var(--panel);
    box-shadow: var(--shadow);
}

.nav {
    display: grid;
    gap: 10px;
}

.nav a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 16px;
    padding: 14px 16px;
}

.nav a.active {
    background: linear-gradient(135deg, rgba(242, 185, 93, 0.16), rgba(142, 211, 200, 0.12));
    border-color: rgba(242, 185, 93, 0.4);
}

.sidebar-card {
    border-radius: 22px;
    margin-top: 26px;
    padding: 18px;
    display: grid;
    gap: 8px;
}

.logout-link {
    color: var(--accent);
}

.nav-count {
    min-width: 26px;
    height: 26px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 8px;
    background: rgba(242, 185, 93, 0.16);
    color: var(--accent);
    font-size: 0.84rem;
    font-weight: 700;
}

.main {
    flex: 1;
    padding: 34px;
}

.main-auth {
    display: grid;
    place-items: center;
}

.flash-stack {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
}

.flash {
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.04);
}

.flash-error {
    border-color: rgba(255, 140, 121, 0.38);
}

.flash-success {
    border-color: rgba(142, 211, 200, 0.35);
}

.auth-shell {
    width: min(960px, 100%);
}

.auth-card,
.hero {
    padding: 34px;
    border-radius: 32px;
    background: linear-gradient(180deg, rgba(12, 30, 41, 0.96), rgba(9, 22, 31, 0.82));
}

.auth-card {
    display: grid;
    gap: 26px;
}

.eyebrow {
    margin: 0 0 12px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 0.78rem;
}

h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.4rem);
    line-height: 0.95;
    max-width: 14ch;
}

h2 {
    margin: 0;
    font-size: 1.15rem;
}

.lead {
    max-width: 68ch;
    line-height: 1.55;
}

.grid-two,
.detail-grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 22px;
    margin-top: 22px;
}

.panel {
    border-radius: 28px;
    padding: 24px;
    backdrop-filter: blur(16px);
}

.panel-head,
.detail-head,
.button-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.detail-head {
    margin-bottom: 22px;
}

.form-grid {
    display: grid;
    gap: 18px;
}

.grid-2,
.grid-3,
.grid-4 {
    display: grid;
    gap: 16px;
}

.grid-2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.wide {
    grid-column: 1 / -1;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 13px 18px;
    border-radius: 16px;
    border: 0;
    cursor: pointer;
}

.button-primary {
    background: linear-gradient(135deg, var(--accent), #ffd897);
    color: #24190b;
    font-weight: 700;
}

.button-secondary {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.button-danger {
    background: rgba(255, 140, 121, 0.12);
    color: #ffd4cd;
    border: 1px solid rgba(255, 140, 121, 0.32);
}

.narrow-panel {
    max-width: 760px;
}

.pill,
.status-badge {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.table-panel {
    margin-top: 22px;
}

.backup-summary {
    margin-top: 22px;
}

.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 18px;
    flex-wrap: wrap;
}

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

.pagination-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.table-scroll {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1120px;
}

.action-cell {
    display: grid;
    gap: 10px;
}

.inline-form {
    display: grid;
    gap: 10px;
}

.inline-form select {
    margin-top: 0;
    min-width: 220px;
}

th,
td {
    text-align: left;
    padding: 16px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    vertical-align: top;
}

th {
    color: var(--muted);
    font-size: 0.86rem;
    font-weight: 600;
}

.table-sort {
    color: var(--muted);
    text-decoration: none;
}

.table-sort:hover {
    color: var(--accent);
}

.row-link {
    color: var(--accent);
    font-weight: 700;
}

.external-link {
    color: var(--accent-2);
    word-break: break-word;
}

.compact-cell {
    max-width: 220px;
    color: #d6e3e5;
}

.chat-preview-cell {
    width: 340px;
}

.chat-preview {
    display: grid;
    gap: 4px;
    margin-bottom: 10px;
    padding: 10px 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
}

.quick-chat {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    margin-top: 12px;
}

.quick-chat input {
    margin-top: 0;
}

.chat-thread {
    display: grid;
    gap: 12px;
    max-height: 640px;
    overflow: auto;
}

.chat-bubble,
.empty-chat {
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

.chat-bubble-unread {
    border-color: rgba(242, 185, 93, 0.35);
    box-shadow: inset 0 0 0 1px rgba(242, 185, 93, 0.08);
}

.chat-meta {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    color: var(--muted);
    margin-bottom: 10px;
    font-size: 0.92rem;
}

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

.info-card {
    display: grid;
    gap: 8px;
    padding: 16px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.07);
}

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

.info-card strong {
    word-break: break-word;
}

.info-card-wide {
    grid-column: 1 / -1;
}

.chat-bubble p {
    margin: 0;
    line-height: 1.5;
}

.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 42px 16px;
}

@media (max-width: 1100px) {
    .grid-two,
    .detail-grid,
    .grid-3,
    .grid-4,
    .grid-2,
    .info-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 860px) {
    .layout {
        display: block;
    }

    .sidebar {
        position: relative;
        width: auto;
        height: auto;
    }

    .main {
        padding: 18px;
    }

    .auth-card,
    .hero,
    .panel {
        padding: 20px;
        border-radius: 24px;
    }
}
