:root {
    --bg: #f4f6f8;
    --panel: #ffffff;
    --text: #172033;
    --muted: #617086;
    --line: #d8dee7;
    --accent: #006f91;
    --accent-dark: #00536d;
    --active: #137333;
    --danger: #a63232;
    --amber: #946200;
    --soft-blue: #e8f3f7;
    --soft-green: #e7f4ec;
    --soft-amber: #fff3d6;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    line-height: 1.5;
}

a {
    color: var(--accent-dark);
    font-weight: 700;
}

.app-shell {
    width: min(1440px, calc(100% - 32px));
    margin: 24px auto;
}

.toolbar,
.filters,
.status-bar,
.pagination,
.notice {
    background: var(--panel);
    border: 1px solid var(--line);
}

.toolbar {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    padding: 22px;
    border-radius: 8px 8px 0 0;
}

.detail-shell .toolbar {
    border-radius: 8px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 0;
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.1;
}

h2 {
    margin-bottom: 0;
    font-size: 21px;
}

.subtitle,
.muted {
    color: var(--muted);
}

label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

input,
select,
.button,
button {
    min-height: 42px;
    border-radius: 6px;
    font: inherit;
}

input,
select {
    width: 100%;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    padding: 8px 10px;
}

input:focus,
select:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(0, 111, 145, 0.18);
}

.button,
button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    background: var(--accent);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    padding: 0 16px;
    text-decoration: none;
    white-space: nowrap;
}

.button:hover,
button:hover {
    background: var(--accent-dark);
}

.button-ghost,
.pagination .button {
    background: #eef3f6;
    color: var(--text);
    border: 1px solid var(--line);
}

.button-ghost:hover,
.pagination .button:hover {
    background: #dfe8ee;
}

.button-small {
    min-height: 34px;
    padding: 0 12px;
}

.button-disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.icon {
    font-size: 16px;
    line-height: 1;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.filters {
    display: grid;
    grid-template-columns: repeat(6, minmax(140px, 1fr)) auto;
    gap: 14px;
    align-items: end;
    padding: 18px 22px;
    border-top: 0;
}

.status-bar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    padding: 12px 22px;
    border-top: 0;
    color: var(--muted);
}

.table-wrap {
    overflow-x: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-top: 0;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1240px;
}

th,
td {
    padding: 13px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #edf2f5;
    color: #334155;
    font-size: 13px;
}

tbody tr:hover {
    background: #f8fafc;
}

.filing-table-wrap {
    overflow-x: auto;
}

.filing-table {
    min-width: 0;
}

.filing-table th {
    position: static;
    background: #fff;
    color: #111827;
    font-size: 16px;
    padding: 10px 0;
}

.filing-table td {
    padding: 12px 0;
    border-top: 1px solid var(--line);
    border-bottom: 0;
}

.filing-table th:first-child,
.filing-table td:first-child {
    width: 140px;
    padding-right: 18px;
}

.filing-table tbody tr:hover {
    background: transparent;
}

.filing-table p {
    margin: 10px 0 0;
    white-space: pre-line;
}

.filing-list {
    margin: 4px 0 0;
    padding-left: 18px;
}

.filing-list li {
    margin: 2px 0 10px;
    white-space: pre-line;
}

.company-name {
    color: var(--accent-dark);
    font-weight: 700;
}

.pill,
.tag {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    padding: 3px 9px;
    text-transform: capitalize;
}

.pill {
    min-height: 24px;
    background: var(--soft-green);
    color: var(--active);
}

.tag {
    background: var(--soft-amber);
    color: var(--amber);
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.empty-row td {
    color: var(--muted);
    padding: 32px 14px;
    text-align: center;
}

.error {
    color: var(--danger);
}

.notice {
    margin-top: 18px;
    padding: 18px 22px;
    border-radius: 8px;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 14px 22px;
    border-top: 0;
    border-radius: 0 0 8px 8px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    margin-top: 18px;
}

.info-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 20px;
}

.info-card.wide {
    grid-column: 1 / -1;
}

.info-card header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.card-icon {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: var(--soft-blue);
    color: var(--accent-dark);
    font-size: 20px;
    font-weight: 700;
}

.detail-list,
.compact-list {
    display: grid;
    gap: 14px;
    margin: 0;
}

.detail-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.detail-list div,
.compact-list div {
    min-width: 0;
}

dt {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

dd {
    margin: 3px 0 0;
}

.stack {
    display: grid;
    gap: 12px;
}

.people-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.mini-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 14px;
    background: #fbfcfd;
}

.mini-card p {
    margin-bottom: 8px;
    color: var(--muted);
}

.mini-card-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.mini-card-top span {
    color: var(--muted);
    font-size: 13px;
    white-space: nowrap;
}

.print-page {
    background: #fff;
}

.print-shell {
    width: min(980px, calc(100% - 24px));
    margin: 18px auto;
}

.print-toolbar,
.print-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.print-toolbar h1 {
    font-size: 28px;
}

.address-card-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
    background: #fff;
}

.address-card {
    min-height: 112px;
    border: 1px solid #aeb4bb;
    border-radius: 8px;
    padding: 16px 18px;
    break-inside: avoid;
    page-break-inside: avoid;
}

.address-card h2 {
    margin: 0 0 8px;
    color: #4b4f55;
    font-size: 14px;
    line-height: 1.25;
}

.address-card p {
    margin: 0;
    color: #62676f;
    font-size: 14px;
    line-height: 1.4;
}

.address-card-empty {
    grid-column: 1 / -1;
}

.print-pagination {
    margin-top: 16px;
    justify-content: center;
}

@media print {
    @page {
        margin: 10mm;
    }

    body {
        background: #fff;
    }

    .print-shell {
        width: 100%;
        margin: 0;
    }

    .print-toolbar,
    .print-pagination,
    .notice {
        display: none;
    }

    .address-card-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .address-card {
        min-height: 101px;
        border-color: #999;
        border-radius: 6px;
        padding: 12px 14px;
    }

    .address-card h2 {
        font-size: 11px;
    }

    .address-card p {
        font-size: 11px;
    }
}

@media (max-width: 1100px) {
    .toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .filters,
    .card-grid,
    .detail-list,
    .people-grid,
    .address-card-grid {
        grid-template-columns: repeat(2, minmax(180px, 1fr));
    }
}

@media (max-width: 720px) {
    .app-shell {
        width: min(100% - 20px, 1440px);
        margin: 10px auto;
    }

    .toolbar,
    .filters,
    .status-bar,
    .pagination {
        padding: 14px;
    }

    .filters,
    .card-grid,
    .detail-list,
    .people-grid,
    .address-card-grid {
        grid-template-columns: 1fr;
    }

    .status-bar,
    .pagination,
    .mini-card-top,
    .print-toolbar,
    .print-pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .actions {
        justify-content: stretch;
    }

    .button,
    button {
        width: 100%;
    }

    .address-card {
        padding: 18px 22px;
    }
}

@media print {
    @page {
        size: A4 portrait;
        margin: 8mm;
    }

    .address-card-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        grid-auto-rows: 101px;
        width: 100% !important;
    }

    .address-card {
        min-height: 101px;
        height: 101px;
        padding: 12px 14px;
        overflow: hidden;
    }

    .address-card h2 {
        font-size: 11px;
        line-height: 1.25;
        margin-bottom: 7px;
    }

    .address-card p {
        font-size: 11px;
        line-height: 1.35;
    }
}