*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    color-scheme: light dark;
    --bg: #f7f7f8;
    --surface: #ffffff;
    --surface-2: #fafafa;
    --text: #222;
    --text-muted: #555;
    --text-muted-2: #777;
    --border: #eee;
    --border-strong: #ddd;
    --shadow-1: 0 4px 20px rgba(0, 0, 0, 0.08);
    --shadow-2: 0 2px 12px rgba(0, 0, 0, 0.05);
    --accent: #10a37f;
    --accent-contrast: #fff;
    --hover-surface: #eee;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b0b0c;
        --surface: #141516;
        --surface-2: #1b1c1e;
        --text: #e8e8ea;
        --text-muted: #a1a1a6;
        --text-muted-2: #8b8b91;
        --border: #26272a;
        --border-strong: #303238;
        --shadow-1: 0 8px 24px rgba(0, 0, 0, 0.6);
        --shadow-2: 0 4px 16px rgba(0, 0, 0, 0.45);
        --accent: #2bd4a1;
        --accent-contrast: #041f17;
        --hover-surface: #232428;
    }
}

body {
    margin: 0;
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont;
    font-size: 13px;
    line-height: 1.45;
    background: var(--bg);
    color: var(--text);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 32px 24px 64px;
}

.centered {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.card {
    width: 320px;
    background: var(--surface);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow-1);
}

.card h2 {
    margin: 0 0 16px;
    font-size: 18px;
}

.auth-form {
    margin: 0;
}

.form-error {
    margin: 0 0 12px;
    color: #d14b5c;
}

input {
    width: 100%;
    padding: 10px 12px;
    margin-bottom: 12px;
    font-size: 14px;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
}

button {
    padding: 10px 16px;
    font-size: 14px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    background: var(--accent);
    color: var(--accent-contrast);
}

button:hover {
    opacity: 0.9;
}

.top-bar {
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}

.top-bar-inner {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
}

.token-view {
    font-size: 13px;
    font-family: monospace;
    color: var(--text-muted-2);
}

.inline-form {
    margin: 0;
}

.logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    padding: 6px 12px;
    background: transparent;
    color: var(--text-muted);
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    text-decoration: none;
}

.logout-btn:hover {
    background: var(--hover-surface);
    color: var(--text);
}

.summary-wrap {
    margin-bottom: 24px;
}

.summary {
    display: flex;
    gap: 32px;
    padding: 16px 20px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-2);
}

.summary-item {
    font-size: 14px;
}

.summary-item b {
    font-size: 18px;
}

.summary-meta {
    margin: 8px 4px 0;
    color: var(--text-muted-2);
}

.table-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
}

.table-meta {
    margin: 0 0 12px;
    color: var(--text-muted-2);
}

.pager {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pager-link,
.pager-status {
    font-size: 12px;
}

.pager-link {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 0 10px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--text);
    text-decoration: none;
    background: var(--surface);
}

.pager-link:hover {
    background: var(--hover-surface);
}

.pager-link.disabled {
    color: var(--text-muted-2);
    pointer-events: none;
}

h2 {
    margin: 32px 0 12px;
    font-size: 20px;
    font-weight: 600;
}

table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    background: var(--surface);
    border-radius: 8px;
    overflow: hidden;
}

th,
td {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

th {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--surface-2);
}

.key-column {
    width: 36%;
}

.key-cell {
    font-family: monospace;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
}

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

.task-row {
    cursor: pointer;
}

.task-row td {
    transition: background-color 0.15s ease;
}

.task-row:hover td,
.task-row:focus-visible td {
    background: var(--hover-surface);
}

.task-row.is-open td {
    background: var(--surface-2);
    border-bottom: none;
}

.task-details-row td {
    padding-top: 0;
    padding-bottom: 12px;
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
}

.details-panel {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface-2);
    overflow: hidden;
}

.details-heading {
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.details {
    padding: 12px 14px 14px;
}

.details-grid {
    display: grid;
    grid-template-columns: 140px minmax(0, 1fr);
    gap: 6px 12px;
}

.detail-label {
    font-size: 12px;
    color: var(--text-muted);
}

.detail-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
        "Liberation Mono", "Courier New", monospace;
    white-space: pre-wrap;
    word-break: break-word;
}

.detail-pre {
    margin: 0;
    font-family: inherit;
    white-space: pre-wrap;
}

.table-empty {
    margin: 0;
    padding: 16px 20px;
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow-2);
    color: var(--text-muted);
}

@media (max-width: 900px) {
    .summary {
        flex-direction: column;
        gap: 12px;
    }
}

@media (max-width: 720px) {
    .container {
        padding: 24px 16px 48px;
    }

    .card {
        width: calc(100vw - 32px);
    }

    .top-bar-inner {
        justify-content: space-between;
    }

    .details-grid {
        grid-template-columns: 1fr;
    }
}
