:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --ink: #0d2538;
    --muted: #5b6c78;
    --line: #d8e0e6;
    --brand: #0f766e;
    --brand-2: #134e4a;
    --alert: #b91c1c;
    --warn: #b45309;
    --ok: #0f766e;
    --shadow: 0 10px 30px rgba(13, 37, 56, 0.09);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    padding: 0;
    font-family: "IBM Plex Sans", "Avenir Next", "Trebuchet MS", sans-serif;
    color: var(--ink);
    background: radial-gradient(circle at 15% 10%, #d9f0ee 0%, #f4f6f8 35%, #edf2f7 100%);
    min-height: 100%;
}

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

a:hover {
    text-decoration: underline;
}

.shell {
    display: grid;
    grid-template-columns: 270px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: linear-gradient(165deg, #0f172a 0%, #083344 100%);
    color: #e2e8f0;
    padding: 28px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    margin: 0 0 22px;
}

.user-box {
    border: 1px solid rgba(226, 232, 240, 0.24);
    border-radius: 12px;
    padding: 10px 12px;
    margin-bottom: 18px;
    font-size: 0.9rem;
}

.user-box .name {
    display: block;
    font-weight: 600;
}

.user-box .role {
    opacity: 0.8;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.07em;
}

.nav-link {
    display: block;
    padding: 10px 12px;
    border-radius: 10px;
    color: #dbeafe;
    margin-bottom: 6px;
    font-weight: 600;
}

.nav-link.active,
.nav-link:hover {
    background: rgba(148, 163, 184, 0.22);
    text-decoration: none;
}

.logout-btn {
    margin-top: 14px;
    width: 100%;
}

.main {
    padding: 28px;
}

.main-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.notify-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid #cbd5e1;
    border-radius: 999px;
    padding: 8px 12px;
    font-weight: 600;
    color: #0f172a;
}

.notify-chip:hover {
    text-decoration: none;
    background: #f8fafc;
}

.notify-chip.unread {
    border-color: #0f766e;
}

.notify-chip .count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    border-radius: 999px;
    background: #0f766e;
    color: #fff;
    font-size: 0.75rem;
    line-height: 1;
    padding: 0 7px;
}

.mention-menu {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 18px rgba(15, 23, 42, 0.12);
    z-index: 30;
    max-height: 220px;
    overflow-y: auto;
}

.mention-item {
    width: 100%;
    display: block;
    text-align: left;
    border: 0;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 0;
    background: #fff;
    color: #0f172a;
    padding: 10px 12px;
    cursor: pointer;
}

.mention-item:last-child {
    border-bottom: 0;
}

.mention-item:hover,
.mention-item.active {
    background: #ecfeff;
}

.page-title {
    margin: 0;
    font-size: 1.45rem;
}

.page-subtitle {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 16px;
}

.grid {
    display: grid;
    gap: 14px;
}

.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));
}

.stat-value {
    margin: 2px 0 0;
    font-size: 1.4rem;
    font-weight: 700;
}

.stat-label {
    color: var(--muted);
    font-size: 0.86rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    text-align: left;
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
    vertical-align: top;
    font-size: 0.92rem;
}

th {
    font-size: 0.82rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    background: #e2e8f0;
    color: #0f172a;
}

.badge.open,
.badge.in_progress,
.badge.waiting_on_customer {
    background: #dbeafe;
    color: #1e3a8a;
}

.badge.resolved,
.badge.closed,
.badge.approved,
.badge.paid,
.badge.matched,
.badge.matched_manual {
    background: #dcfce7;
    color: #166534;
}

.badge.rejected,
.badge.spam,
.badge.blocked,
.badge.overdue {
    background: #fee2e2;
    color: #991b1b;
}

.badge.pending,
.badge.waitlisted,
.badge.unmatched,
.badge.unpaid {
    background: #fef3c7;
    color: #92400e;
}

form.inline {
    display: inline-flex;
    gap: 6px;
    align-items: center;
}

input,
select,
textarea,
button {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    padding: 8px 10px;
    font: inherit;
    background: #fff;
}

button,
.btn {
    background: var(--brand);
    color: #fff;
    border: 1px solid var(--brand);
    cursor: pointer;
    width: auto;
    transition: transform 120ms ease, opacity 120ms ease;
}

button:hover,
.btn:hover {
    opacity: 0.94;
    transform: translateY(-1px);
    text-decoration: none;
}

.btn.secondary {
    background: #fff;
    color: var(--brand-2);
    border-color: #9fb3c2;
}

button.secondary {
    background: #fff;
    color: var(--brand-2);
    border-color: #9fb3c2;
}

.btn.danger {
    background: var(--alert);
    border-color: var(--alert);
}

button.danger {
    background: var(--alert);
    border-color: var(--alert);
}

.alert {
    margin-bottom: 14px;
    border-radius: 10px;
    padding: 10px 12px;
    border: 1px solid;
}

.alert.ok {
    background: #ecfdf5;
    border-color: #86efac;
    color: #166534;
}

.alert.error {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #991b1b;
}

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

.list-reset {
    margin: 0;
    padding-left: 18px;
}

.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.login-card {
    max-width: 420px;
    width: 100%;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: var(--shadow);
    padding: 20px;
}

.login-card h1 {
    margin-top: 0;
}

.kv {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 6px 10px;
    font-size: 0.92rem;
}

@media (max-width: 1080px) {
    .shell {
        grid-template-columns: 1fr;
    }

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

    .grid-4,
    .grid-3,
    .grid-2 {
        grid-template-columns: 1fr;
    }
}
