:root {
    --bg: #f6f9fc;
    --card: #ffffff;
    --text: #16324f;
    --text-body: #16324f;
    --text-strong: #0b4f8a;
    --muted: #6b7280;
    --bd: #d3e6f4;
    --head: #f7fbff;
    --hover: #f5fafe;
    --shadow: 0 6px 18px -8px rgba(0, 0, 0, .08);
    --alt: #fbfdff;
    --title: #0b4f8a;
    --primary: #206bc4;
    --field-bg: #ffffff;
    --field-bd: #d3e6f4;
    --field-text: #16324f;
    --field-focus: #206bc4;
    --field-shadow: 0 0 0 2px rgba(32, 107, 196, .12);
}

[data-theme="dark"] {
    --bg: #0f1419;
    --card: #161c2b;
    --text: #d6e2f7;
    --text-body: #c4d8ff;
    --text-strong: #e6f1ff;
    --muted: #a8b8d1;
    --bd: #27324a;
    --head: #1f2a3c;
    --hover: #1b2435;
    --shadow: 0 8px 20px rgba(0, 0, 0, .3);
    --alt: rgba(255, 255, 255, .06);
    --title: #dce6f7;
    --primary: #4a9eff;
    --field-bg: #161c2b;
    --field-bd: #394867;
    --field-text: #d6e2f7;
    --field-focus: #4a9eff;
    --field-shadow: 0 0 0 2px rgba(74, 158, 255, .25);
}

html,
body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--text);
    transition: background-color .35s ease, color .35s ease;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 10px 24px;
}

.topbar {
    display: flex;
    align-items: center;
    gap: .6rem;
    margin-bottom: .6rem;
}

.title {
    font-size: 1.1rem;
    font-weight: 800;
    margin: 0;
    color: var(--title);
}

.back-btn {
    display: inline-flex;
    align-items: center;
    gap: .35em;
    padding: .4rem .7rem;
    border-radius: 10px;
    border: 1px solid var(--bd);
    background: var(--card);
    color: var(--primary, #206bc4);
    text-decoration: none;
    font-weight: 700;
    transition: all .2s ease;
}

.back-btn:hover {
    background: #f3f8ff;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.hint {
    color: var(--muted);
    font-size: .8rem;
    margin: .2rem .2rem .4rem;
}

.field-input,
.filters input,
select {
    padding: .45rem .55rem;
    border: 1px solid var(--field-bd);
    border-radius: .55rem;
    outline: 0;
    font-size: .72rem;
    background: var(--field-bg);
    color: var(--field-text);
    transition: background .2s, border-color .2s, box-shadow .2s;
}

.field-input:focus,
.filters input:focus,
select:focus {
    border-color: var(--field-focus);
    box-shadow: var(--field-shadow);
    background: var(--card);
}

@media (max-width: 768px) {
    .container {
        padding: 8px 12px 20px;
    }
}

.table-wrap {
    margin-top: .2rem;
    max-height: 72vh;
    overflow: auto;
    border: 1px solid var(--bd);
    border-radius: 1rem;
    background: var(--card);
    box-shadow: var(--shadow);
}

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .72rem;
}

table.data-table thead th {
    position: sticky;
    top: 0;
    background: var(--head);
    padding: .45rem .5rem;
    border-bottom: 1px solid var(--bd);
    white-space: nowrap;
    color: var(--title);
}

table.data-table tbody td {
    padding: .4rem .5rem;
    border-bottom: 1px solid var(--bd);
    white-space: nowrap;
    color: var(--text);
}

table.data-table tbody tr:hover {
    background: var(--hover);
}

td.clampable {
    cursor: zoom-in;
    vertical-align: top;
}

td.clampable.expanded {
    cursor: zoom-out;
    white-space: normal;
    overflow: visible;
}

td.nowrap,
th.nowrap {
    white-space: nowrap;
}

@media (min-width: 901px) {
    td.clampable {
        max-width: 560px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    td.clampable.expanded {
        max-width: none;
        white-space: normal;
        overflow: visible;
    }
}

@media (max-width: 760px) {
    th,
    td {
        font-size: .8rem;
        padding: .3rem .4rem;
    }

    .data-table {
        min-width: 640px;
    }
}

.filters {
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    margin: .2rem 0 .4rem;
}

.filters input {
    background: #f7fafc;
    border: 1px solid #cfd9e4;
}

thead th.sortable {
    cursor: pointer;
    user-select: none;
}

thead th.sort-asc::after {
    content: ' ▲';
    color: #206bc4;
    margin-left: .25rem;
}

thead th.sort-desc::after {
    content: ' ▼';
    color: #206bc4;
    margin-left: .25rem;
}

.tu-highlight {
    background: rgba(255, 208, 0, .35);
    padding: 0 .1em;
    border-radius: .2em;
}

.card {
    background: transparent;
    border: 0;
}

.sec {
    background: var(--card);
    border: 1px solid var(--bd);
    box-shadow: var(--shadow);
    border-radius: 1rem;
    padding: .6rem;
    margin: .6rem 0;
}

.tbl-wrap {
    overflow: auto;
}

.sec table {
    border-collapse: collapse;
    width: 100%;
    min-width: 720px;
    table-layout: fixed;
}

.sec thead th {
    position: sticky;
    top: 0;
    background: var(--head);
    z-index: 1;
}

.sec th,
.sec td {
    border: 1px solid var(--bd);
    padding: .35rem .5rem;
    font-size: .88rem;
    word-break: break-word;
}

td.col-num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

td.col-date {
    text-align: center;
    color: var(--muted);
}

td.col-code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

td.clampable .clamp {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    word-break: break-word;
}

td.clampable.expanded .clamp {
    -webkit-line-clamp: unset;
}

tbody tr:nth-child(even) {
    background: var(--alt);
}

body::-webkit-scrollbar {
    display: none;
}
