html, body {
    margin: 0;
    padding: 0;
    background: #f5f5f5;
    color: #111;
    font: 13px/1.45 "Segoe UI", "Microsoft YaHei", sans-serif;
}

a {
    color: #111;
    text-decoration: underline;
}

button,
input,
select {
    font: inherit;
    border: 1px solid #777;
    border-radius: 0;
    background: #fff;
    color: #111;
    padding: 4px 8px;
    box-sizing: border-box;
}

button {
    cursor: pointer;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    border-bottom: 1px solid #999;
    background: #fff;
}

.topbar-title {
    font-size: 16px;
    font-weight: 700;
}

.topbar-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.topbar-nav form {
    margin: 0;
}

.page {
    padding: 12px 16px 24px;
}

.panel {
    border: 1px solid #999;
    background: #fff;
    padding: 12px;
    margin-bottom: 12px;
}

.flash-list {
    margin-bottom: 12px;
}

.flash-item {
    border: 1px solid #999;
    padding: 8px 10px;
    background: #fff;
}

.toolbar,
.grid-toolbar {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.toolbar-group {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

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

.dense-table {
    width: 100%;
    min-width: 1400px;
    border-collapse: collapse;
}

.audit-table {
    min-width: 1100px;
}

.dense-table th,
.dense-table td {
    border: 1px solid #b5b5b5;
    padding: 4px 6px;
    white-space: nowrap;
    vertical-align: top;
}

.dense-table th {
    position: sticky;
    top: 0;
    background: #eee;
    text-align: left;
}

.wide-cell {
    min-width: 180px;
    white-space: normal;
}

.summary-cell {
    white-space: normal;
    word-break: break-word;
}

.transactions-table .summary-col {
    width: auto;
    max-width: none;
}

.transactions-table {
    width: max-content;
    min-width: 0;
    table-layout: auto;
}

.transactions-table th,
.transactions-table td,
.transactions-table .summary-col,
.transactions-table .summary-cell {
    width: auto;
    max-width: none;
    white-space: nowrap;
}

.transactions-table .summary-cell {
    word-break: normal;
}

.icbc-transactions-table {
    width: max-content;
    min-width: 0;
    table-layout: auto;
}

.icbc-transactions-table th,
.icbc-transactions-table td,
.icbc-transactions-table .wide-cell {
    width: auto;
    max-width: none;
    white-space: nowrap;
}

.icbc-transactions-table .wide-cell {
    word-break: normal;
}

.key-cell {
    min-width: 220px;
    font-family: Consolas, monospace;
    font-size: 12px;
}

.num {
    text-align: right;
    font-family: Consolas, monospace;
}

.empty-cell,
.hint {
    color: #333;
    padding: 4px 0;
}

.login-panel {
    max-width: 360px;
    margin: 80px auto 0;
}

.stack-form {
    display: grid;
    gap: 10px;
}

.stack-form label,
.detail-grid > div {
    display: grid;
    gap: 4px;
}

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    gap: 8px 16px;
}

.detail-grid.compact {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
}

.detail-grid .full {
    grid-column: 1 / -1;
}

.detail-grid span {
    color: #555;
}

.upload-form {
    display: grid;
    gap: 10px;
}

.upload-dropzone {
    border: 1px dashed #777;
    padding: 16px;
    min-height: 100px;
    display: grid;
    align-content: center;
    gap: 8px;
}

.upload-dropzone.is-dragover {
    background: #efefef;
}

.voucher-meta,
.voucher-links {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.image-preview img {
    max-width: 100%;
    border: 1px solid #aaa;
}

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

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