:root {
    --bg: #0f172a;
    --panel: #1e293b;
    --panel-2: #243043;
    --border: #334155;
    --text: #e2e8f0;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --warn: #f59e0b;
    --bad: #ef4444;
    --good: #10b981;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    line-height: 1.5;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); text-decoration: underline; }

code { font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: 0.9em; }

.topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 12px 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

.brand { font-weight: 600; }

.navbar {
    display: flex;
    gap: 16px;
    flex: 1;
}

.navbar a { color: var(--text); }
.navbar a:hover { color: var(--accent); }

.logout-form { display: inline; }

.content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

.footer {
    text-align: center;
    color: var(--text-muted);
    padding: 24px;
}

h1 { margin: 0 0 24px 0; }
h2 { margin: 0 0 12px 0; font-size: 1.1em; }

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

/* Cards */
.cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 16px;
}

.card-label { color: var(--text-muted); font-size: 0.85em; }
.card-value { font-size: 1.6em; font-weight: 600; margin-top: 4px; }
.card-fees .card-value { color: var(--good); }

.unit { font-size: 0.6em; color: var(--text-muted); }

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

dl { margin: 0; }
dl dt { color: var(--text-muted); font-size: 0.85em; margin-top: 8px; }
dl dd { margin: 0 0 4px 0; }

.prewrap {
    white-space: pre-wrap;
    word-break: break-word;
    background: var(--panel-2);
    padding: 8px;
    border-radius: 4px;
    margin: 0;
    font-family: inherit;
    font-size: 0.95em;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 16px;
}

.table th, .table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    background: var(--panel-2);
    font-weight: 600;
    font-size: 0.9em;
}

.table tr:last-child td { border-bottom: none; }

/* Forms */
.form, .search-form, .action-form {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: flex-end;
    margin-bottom: 16px;
}

.form { flex-direction: column; max-width: 360px; }
.form label { display: flex; flex-direction: column; gap: 4px; color: var(--text-muted); font-size: 0.85em; }

.form input, .search-form input, .search-form select, .action-form input {
    background: var(--panel-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 10px;
    border-radius: 4px;
    font-family: inherit;
    font-size: 1em;
}

.btn-primary, .btn-warn, .btn-danger, .btn-link {
    padding: 8px 16px;
    border-radius: 4px;
    border: none;
    font-family: inherit;
    font-size: 0.95em;
    cursor: pointer;
}

.btn-primary { background: var(--accent); color: white; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-warn { background: var(--warn); color: white; }
.btn-danger { background: var(--bad); color: white; }
.btn-link { background: transparent; color: var(--accent); padding: 8px 12px; }
.btn-link:hover { text-decoration: underline; }

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-admin { background: var(--accent); color: white; }
.badge-arb { background: var(--good); color: white; }
.badge-bad { background: var(--bad); color: white; }
.badge-warn { background: var(--warn); color: white; }
.badge-state { background: var(--panel-2); color: var(--text-muted); border: 1px solid var(--border); }
.badge-completed { background: var(--good); color: white; }
.badge-cancelled, .badge-expired, .badge-refunded { background: var(--text-muted); color: var(--bg); }
.badge-disputed { background: var(--bad); color: white; }
.badge-in_progress, .badge-in_arbitration { background: var(--accent); color: white; }
.badge-resolved { background: var(--good); color: white; }
.badge-open, .badge-assigned { background: var(--warn); color: white; }

/* Auth pages */
.auth-page .content {
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 32px;
    width: 100%;
    max-width: 420px;
}

/* Flash */
.flash {
    padding: 10px 14px;
    border-radius: 4px;
    margin-bottom: 16px;
}

.flash-info { background: rgba(59, 130, 246, 0.15); border: 1px solid var(--accent); }
.flash-error { background: rgba(239, 68, 68, 0.15); border: 1px solid var(--bad); }
.flash-success { background: rgba(16, 185, 129, 0.15); border: 1px solid var(--good); }

/* Pager / quick links */
.pager { display: flex; gap: 16px; }
.quick-links ul { list-style: none; padding: 0; }
.quick-links li { margin: 4px 0; }
.action-row { display: flex; gap: 16px; flex-wrap: wrap; }
