:root {
  --base: #1e1e2e; --surface0: #181825; --surface1: #313244; --surface2: #45475a;
  --text: #cdd6f4; --subtle: #a6adc8; --muted: #6c7086;
  --green: #a6e3a1; --yellow: #f9e2af; --red: #f38ba8; --blue: #89b4fa;
  --mauve: #cba6f7; --teal: #94e2d5; --peach: #fab387;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  background: var(--base);
  color: var(--text);
  font-family: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace;
  font-size: 13px;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; }
table { border-collapse: collapse; width: 100%; }
.tabular-nums { font-variant-numeric: tabular-nums; }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 28px;
    border-bottom: 1px solid var(--surface1);
    background: var(--surface0);
    position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 18px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.refresh-indicator { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.refresh-indicator .pulse {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--green);
    animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
.range-select {
    background: var(--surface0);
    color: var(--text);
    border: 1px solid var(--surface1);
    border-radius: 4px;
    padding: 5px 10px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
}
.content { padding: 24px 28px; }
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 24px; }
.card {
    background: var(--surface0);
    border: 1px solid var(--surface1);
    border-radius: 6px;
    padding: 16px 18px;
    display: flex; flex-direction: column; gap: 8px;
    min-height: 100px;
}
.card.skeleton {
    background: linear-gradient(90deg, var(--surface0), var(--surface1), var(--surface0));
    background-size: 200% 100%;
    animation: shimmer 1.4s linear infinite;
}
@keyframes shimmer { from { background-position: 0% 0; } to { background-position: -200% 0; } }
.card-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.card-label i { color: var(--mauve); }
.card-value { font-size: 28px; font-weight: 600; }
.card-foot { font-size: 11px; color: var(--subtle); }
.charts-row { display: grid; grid-template-columns: 2fr 1fr; gap: 14px; margin-bottom: 24px; }
.chart-panel, .list-panel { background: var(--surface0); border: 1px solid var(--surface1); border-radius: 6px; padding: 16px 18px; }
.chart-panel h2, .list-panel h2 { font-size: 13px; font-weight: 600; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; }
.chart-panel .sub { font-size: 11px; color: var(--muted); margin-bottom: 12px; }
.chart-canvas-wrap { position: relative; height: 220px; }
.rejections-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 24px; }
.list-table th { text-align: left; color: var(--muted); font-weight: 500; padding: 6px 0; border-bottom: 1px solid var(--surface1); font-size: 11px; text-transform: uppercase; }
.list-table td { padding: 8px 0; border-bottom: 1px solid var(--surface1); }
.list-table .num { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 500; }
.reason-pill { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 11px; background: var(--surface1); color: var(--subtle); }
.reason-pill.warn { background: rgba(249, 226, 175, 0.12); color: var(--yellow); }
.reason-pill.bad { background: rgba(243, 139, 168, 0.12); color: var(--red); }
.error-banner { background: rgba(243, 139, 168, 0.10); border: 1px solid var(--red); color: var(--red); padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; }
.error-banner .btn-link { background: none; border: 1px solid var(--red); color: var(--red); padding: 4px 10px; border-radius: 4px; cursor: pointer; margin-left: auto; }
.capacity-card { background: var(--surface0); border: 1px solid var(--surface1); border-radius: 6px; padding: 16px 18px; }
.capacity-card h2 { font-size: 13px; font-weight: 600; margin-bottom: 12px; }
.capacity-bar { height: 8px; background: var(--surface1); border-radius: 4px; overflow: hidden; }
.capacity-fill { height: 100%; background: var(--mauve); transition: width 200ms ease; }
.crumbs { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.crumbs a { color: var(--blue); text-decoration: none; }
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.search { flex: 1; max-width: 380px; position: relative; }
.search input {
    width: 100%;
    padding: 8px 10px 8px 32px;
    background: var(--surface0);
    border: 1px solid var(--surface1);
    border-radius: 4px;
    color: var(--text);
    font-family: inherit;
    font-size: 12px;
}
.search i { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.filter {
    background: var(--surface0);
    border: 1px solid var(--surface1);
    border-radius: 4px;
    padding: 7px 10px;
    font-family: inherit;
    color: var(--text);
    font-size: 12px;
}
.table-panel { background: var(--surface0); border: 1px solid var(--surface1); border-radius: 6px; overflow: hidden; }
table.users { width: 100%; border-collapse: collapse; font-size: 12px; }
table.users th { text-align: left; color: var(--muted); font-weight: 500; padding: 10px 14px; border-bottom: 1px solid var(--surface1); font-size: 11px; text-transform: uppercase; }
table.users td { padding: 11px 14px; border-bottom: 1px solid var(--surface1); }
table.users tr:last-child td { border-bottom: none; }
table.users tr.row { cursor: pointer; transition: background 80ms ease; }
table.users tr.row:hover { background: rgba(205, 214, 244, 0.03); }
.tid { color: var(--subtle); font-size: 11px; }
.dn { font-weight: 500; }
.relative { color: var(--muted); font-size: 11px; }
.pill { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600; }
.pill.active { background: rgba(166, 227, 161, 0.13); color: var(--green); }
.pill.trial { background: rgba(250, 179, 135, 0.13); color: var(--peach); }
.pill.expired { background: rgba(243, 139, 168, 0.13); color: var(--red); }
.pill.grace { background: rgba(249, 226, 175, 0.13); color: var(--yellow); }
.pill.none { background: var(--surface1); color: var(--subtle); }
.pill.override { background: rgba(203, 166, 247, 0.13); color: var(--mauve); margin-left: 6px; }
.pager { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-top: 1px solid var(--surface1); font-size: 11px; color: var(--muted); }
.pager button { background: var(--surface1); color: var(--text); border: 1px solid var(--surface2); border-radius: 3px; padding: 4px 10px; font-family: inherit; font-size: 11px; cursor: pointer; }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.capacity-foot { font-size: 11px; color: var(--muted); margin-top: 8px; }
.detail-grid { display: grid; grid-template-columns: 320px 1fr; gap: 18px; }
.user-card, .panel {
    background: var(--surface0);
    border: 1px solid var(--surface1);
    border-radius: 6px;
    padding: 18px;
}
.user-card { display: flex; flex-direction: column; gap: 12px; height: fit-content; }
.user-card .avatar {
    width: 56px; height: 56px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--mauve), var(--blue));
    color: var(--base);
    font-size: 24px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
}
.user-card .name { font-size: 15px; font-weight: 600; }
.user-card .email { color: var(--subtle); font-size: 12px; word-break: break-all; }
.user-card .tid-row { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.live-indicators { display: flex; flex-direction: column; gap: 6px; padding-top: 12px; border-top: 1px solid var(--surface1); }
.live-row { display: flex; justify-content: space-between; align-items: center; font-size: 11px; }
.live-row span:first-child { color: var(--muted); }
.live-row .ok { color: var(--green); }
.live-row .off { color: var(--muted); }
.panel h3 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin-bottom: 12px; font-weight: 500; }
.kv { display: grid; grid-template-columns: 160px 1fr; row-gap: 10px; column-gap: 16px; font-size: 12px; }
.kv .k { color: var(--muted); }
.kv .v { color: var(--text); }
.actions-row { margin-top: 14px; display: flex; gap: 8px; }
.btn {
    background: var(--surface1);
    color: var(--subtle);
    border: 1px solid var(--surface2);
    border-radius: 4px;
    padding: 7px 12px;
    font-family: inherit;
    font-size: 11px;
    cursor: not-allowed;
    opacity: 0.7;
    display: inline-flex; align-items: center; gap: 6px;
}
.btn .v2 { font-size: 9px; background: var(--surface2); padding: 1px 5px; border-radius: 2px; color: var(--muted); }
.activity-list { display: flex; flex-direction: column; gap: 1px; }
.activity-item {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px dashed var(--surface1);
    font-size: 11px;
}
.activity-item .ts { color: var(--muted); font-variant-numeric: tabular-nums; }
.activity-item .what { color: var(--subtle); }
.activity-item .what i { color: var(--peach); margin-right: 4px; }
.activity-item .what.ok i { color: var(--green); }
.activity-item .what.bad i { color: var(--red); }
