:root {
    --bg: #f3f5f8;
    --card: #ffffff;
    --ink: #1b2430;
    --muted: #5b6775;
    --line: #d7dee8;
    --brand: #123a63;
    --ok: #1b7a45;
    --ok-bg: #e6f6ec;
    --wait: #8a5a12;
    --wait-bg: #fff4e3;
    --danger: #9b1c1c;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.4;
}

.top {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--brand);
    color: #fff;
    padding: 14px 14px 16px;
}

.top h1 {
    margin: 0 0 10px;
    font-size: 18px;
    font-weight: 700;
}

.top .lbl,
.top p {
    color: #d7e6f5;
}

.lbl {
    display: block;
    margin: 0 0 6px;
    font-size: 13px;
}

select,
input[type="file"] {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 16px;
    background: #fff;
    color: var(--ink);
}

.summary {
    margin: 10px 0 0;
    font-size: 13px;
    min-height: 18px;
}

.wrap {
    padding: 12px;
}

.table-wrap {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th {
    text-align: left;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--muted);
    background: #eef2f6;
    padding: 10px 12px;
}

td {
    padding: 12px;
    border-top: 1px solid var(--line);
    vertical-align: middle;
}

.name {
    font-weight: 700;
    margin: 0 0 2px;
}

.meta {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
}

.row-actions {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
    min-width: 96px;
}

.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 999px;
}

.badge.wait {
    color: var(--wait);
    background: var(--wait-bg);
}

.badge.ok {
    color: var(--ok);
    background: var(--ok-bg);
}

.btn {
    min-height: 42px;
    border: 0;
    border-radius: 8px;
    background: var(--brand);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    padding: 8px 14px;
    width: 100%;
}

.btn.ghost {
    background: #e8eef5;
    color: var(--brand);
}

.btn:disabled {
    opacity: 0.6;
}

.hint {
    color: var(--muted);
    text-align: center;
    padding: 24px 8px;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 14px;
}

.card .btn {
    margin-top: 12px;
}

.note {
    padding: 10px 12px;
    border-radius: 8px;
    margin: 0 0 12px;
}

.note.ok {
    background: var(--ok-bg);
    color: var(--ok);
}

.note.err {
    background: #fdecec;
    color: var(--danger);
}

a {
    color: var(--brand);
}

.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    display: flex;
    align-items: stretch;
    justify-content: center;
    z-index: 50;
    padding: 10px;
}

.modal[hidden],
table[hidden],
input[hidden] {
    display: none !important;
}

.modal-box {
    background: #fff;
    width: 100%;
    max-width: 520px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.modal-title {
    margin: 0;
    padding: 12px 14px;
    font-weight: 700;
}

.crop-box {
    height: min(62vh, 480px);
    background: #111;
}

.crop-box img {
    display: block;
    max-width: 100%;
}

.modal-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px;
}

.source-box {
    align-self: center;
}

.source-actions {
    grid-template-columns: 1fr;
}

input.file-pick {
    position: fixed;
    left: -40px;
    top: 0;
    width: 1px;
    height: 1px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    overflow: hidden;
}
