/* ---------- 1. PAGE HEAD ---------- */
.ui-page-head { margin-bottom: 12px; }

.ui-page-back { margin-bottom: 4px; font-size: 13px; }
.ui-page-back a { color: var(--text-strong); text-underline-offset: 3px; }
.ui-page-back a:hover { color: var(--brand-strong); }

.ui-page-head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-2); }

.ui-page-title { font-size: 1.25rem; font-weight: 600; line-height: 1.25; }

.ui-page-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 6px; }

@media (max-width: 700px) {
    .ui-page-head-row { flex-direction: column; align-items: stretch; }
    .ui-page-head-row > .ui-actions { justify-content: flex-start; }
}

/* ---------- 2. BADGE ---------- */
.ui-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--r-pill);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.4;
    white-space: nowrap;
}

.ui-badge-neutral { background: var(--surface); color: var(--text-strong); box-shadow: inset 0 0 0 1px var(--border); }
.ui-badge-info { background: var(--brand-tint); color: var(--brand-deep); }
.ui-badge-positive { background: var(--positive-tint); color: #166534; }
.ui-badge-warning { background: var(--warning-tint); color: #92400e; }
.ui-badge-danger { background: var(--danger-tint); color: #b91c1c; }

/* ---------- 3. PANEL ---------- */
.ui-panel {
    margin-bottom: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--white);
}

.ui-panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); margin-bottom: 8px; }

.ui-panel-title { color: var(--text-strong); font-size: 13px; font-weight: 600; letter-spacing: 0.04em; line-height: 1.3; text-transform: uppercase; }

.ui-panel-lead { margin-bottom: 8px; color: var(--muted); font-size: 13px; line-height: 1.45; }

/* ---------- 4. TABLE ---------- */
.ui-table-wrap { overflow-x: auto; }

.ui-table { width: 100%; border-collapse: collapse; }

.ui-table th, .ui-table td { padding: 7px 10px; color: var(--ink); font-size: 13.5px; text-align: left; vertical-align: top; }

.ui-table thead th {
    border-bottom: 1px solid var(--border);
    color: var(--text-strong);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    white-space: nowrap;
}

.ui-table tbody tr { border-bottom: 1px solid var(--border); }
.ui-table tbody tr:hover { background: var(--surface); }

.ui-table tbody td:first-child { font-weight: 500; }

.ui-table td:not([data-label]) { text-align: right; }

@media (max-width: 700px) {
    .ui-table, .ui-table tbody, .ui-table tr, .ui-table td { display: block; }

    .ui-table thead { display: none; }

    .ui-table tbody tr {
        margin-bottom: 8px;
        padding: 4px 12px;
        border: 1px solid var(--border);
        border-radius: var(--r);
        background: var(--white);
    }

    .ui-table td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-2);
        padding: 6px 0;
        text-align: right;
    }

    .ui-table td + td { border-top: 1px solid var(--border); }

    .ui-table td::before {
        content: attr(data-label);
        flex: none;
        color: var(--muted);
        font-size: 12px;
        font-weight: 400;
        text-align: left;
    }

    .ui-table td:not([data-label]) { justify-content: flex-end; }
}

/* ---------- 5. DESCRIPTION LIST ---------- */
.ui-dl { display: grid; gap: 6px; }

.ui-dl-row { display: grid; grid-template-columns: 96px 1fr; gap: 8px; }

.ui-dl dt { color: var(--muted); font-size: 12px; line-height: 1.7; }

.ui-dl dd { color: var(--ink); font-size: 14px; overflow-wrap: anywhere; }

@media (max-width: 480px) {
    .ui-dl-row { grid-template-columns: 1fr; gap: 0; }
}

/* ---------- 6. FILTER TABS ---------- */
.ui-tabs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }

.ui-tab {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--white);
    color: var(--text-strong);
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
}

.ui-tab:hover { border-color: var(--muted); }

.ui-tab[aria-current="page"] { border-color: var(--ink); background: var(--ink); color: #fff; }

.ui-tab-count { color: var(--muted); font-weight: 400; }
.ui-tab[aria-current="page"] .ui-tab-count { color: inherit; }

/* ---------- 7. EMPTY STATE ---------- */
.ui-empty { padding: 8px 0; color: var(--muted); font-size: 13.5px; }

.ui-empty-title { color: var(--text-strong); font-weight: 500; }

.ui-empty p + p { margin-top: 2px; }

/* ---------- 8. FIELDS + NOTICES ---------- */
.field { display: grid; gap: 6px; }

.field label { font-weight: 500; color: var(--text-strong); }

.field input, .field select, .field textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: var(--r);
    background: var(--white);
    color: var(--ink);
    font-family: inherit;
    font-size: 16px; /* below 16px iOS zooms into the field */
}

.field textarea { min-height: 120px; line-height: 1.5; resize: vertical; }

.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px var(--brand-tint); }

.field-hint { color: var(--muted); font-size: 13.5px; line-height: 1.45; }

.field-error { color: var(--danger); font-size: 14px; line-height: 1.45; }

.form-notice {
    margin-bottom: var(--space-2);
    padding: 12px 14px;
    border: 1px solid var(--brand);
    border-radius: var(--r);
    background: var(--brand-tint);
    color: var(--brand-strong);
    font-size: 15px;
}

/* ---------- 9. TIMELINE ---------- */
.ui-timeline { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }

.ui-timeline-item { position: relative; padding-left: 16px; }

.ui-timeline-item::before {
    content: "";
    position: absolute;
    top: 7px;
    left: 0;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--brand);
}

.ui-timeline-when { color: var(--muted); font-size: 12px; }

.ui-timeline-title { color: var(--text-strong); font-size: 13.5px; font-weight: 500; }

.ui-timeline-note { margin-top: 2px; color: var(--text); font-size: 13.5px; line-height: 1.45; white-space: pre-line; }

/* ---------- 10. PAGINATION ---------- */
.ui-pagination { display: flex; justify-content: space-between; gap: var(--space-2); margin-top: 12px; }

.ui-pagination-next { margin-left: auto; }

/* ---------- 11. SMALL TEXT HELPERS ---------- */
.ui-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; justify-content: flex-end; }
.ui-actions-start { justify-content: flex-start; }

.ui-muted { color: var(--muted); font-size: 13px; font-weight: 400; }

.ui-nowrap { white-space: nowrap; }

.ui-strong { font-weight: 500; color: var(--text-strong); }

.ui-link { color: var(--brand-strong); text-underline-offset: 3px; }
.ui-link:hover { color: var(--brand); }

.ui-lines { display: grid; gap: 2px; }

.ui-quote { margin-top: 4px; padding-left: 8px; border-left: 2px solid var(--danger); color: var(--text); font-size: 13px; line-height: 1.45; white-space: pre-line; }
