:root {
    color-scheme: light;
    --ink: #1f2933;
    --muted: #667085;
    --line: #d8dee7;
    --surface: #ffffff;
    --soft: #f4f7fb;
    --accent: #177a73;
    --accent-dark: #0f5954;
    --focus: rgba(23, 122, 115, 0.22);
}

* {
    box-sizing: border-box;
}

html {
    scrollbar-gutter: stable;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    color: var(--ink);
    background: var(--soft);
}

.shell {
    width: min(1180px, calc(100% - 32px));
    margin: 32px auto;
}

.search-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 24px;
}

.eyebrow {
    margin: 0 0 6px;
    color: var(--accent-dark);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

h1 {
    margin: 0 0 22px;
    font-size: clamp(26px, 4vw, 40px);
    line-height: 1.12;
}

.line-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 18px;
}

.line-filter {
    width: auto;
    min-height: 38px;
    padding: 0 16px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
}

.line-filter:hover,
.line-filter.is-active {
    border-color: var(--accent);
    background: var(--accent);
    color: #fff;
}

.search-form {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 240px) auto;
    gap: 14px;
    align-items: end;
}

label span {
    display: block;
    margin-bottom: 7px;
    color: var(--muted);
    font-size: 13px;
}

input,
select,
button {
    width: 100%;
    min-height: 44px;
    border-radius: 6px;
    font: inherit;
}

input[type="checkbox"] {
    width: 18px;
    min-height: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--accent);
}

input,
select {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    padding: 0 12px;
}

input:focus,
select:focus,
button:focus {
    outline: 3px solid var(--focus);
    outline-offset: 1px;
}

button {
    border: 0;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    padding: 0 22px;
    cursor: pointer;
}

button:hover {
    background: var(--accent-dark);
}

.summary {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    margin-top: 16px;
    color: var(--muted);
    font-size: 14px;
}

.table-wrap {
    margin-top: 18px;
    overflow-x: auto;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 8px;
}

table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
    table-layout: fixed;
}

th:nth-child(1) { width: 6%; }
th:nth-child(2) { width: 16%; }
th:nth-child(3) { width: 10%; }
th:nth-child(4) { width: 13%; }
th:nth-child(5) { width: 42%; }
th:nth-child(6) { width: 13%; }

th,
td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    font-size: 14px;
}

th {
    background: #edf3f6;
    color: #344054;
    font-size: 12px;
    text-transform: uppercase;
}

tbody tr:hover {
    background: #f7fbfb;
}

.code {
    font-weight: 700;
    white-space: nowrap;
}

.muted {
    color: var(--muted);
}

.download {
    display: inline-block;
    width: auto;
    min-height: 0;
    border-radius: 6px;
    background: #eef7f6;
    color: var(--accent-dark);
    padding: 7px 10px;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.action {
    display: inline-block;
    color: var(--accent-dark);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.small-button {
    width: auto;
    min-height: 34px;
    border-radius: 6px;
    padding: 0 12px;
    font-size: 13px;
}

.small-button.secondary {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--accent-dark);
}

.bulk-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.selection-count {
    color: var(--muted);
    font-size: 13px;
}

.pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    align-items: center;
}

.pagination-bottom {
    display: flex;
    justify-content: center;
    margin: 16px 0;
}

.page-button {
    width: 36px;
    min-height: 36px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #fff;
    color: var(--accent-dark);
    font-weight: 700;
    cursor: pointer;
}

.page-button:hover:not(:disabled),
.page-button.is-current {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.page-button:disabled {
    opacity: .45;
    cursor: default;
}

.page-button:focus-visible {
    outline: 2px solid var(--accent-dark);
    outline-offset: 2px;
}

.content-summary {
    font-weight: 700;
}

details {
    margin-top: 8px;
}

summary {
    cursor: pointer;
    color: var(--accent-dark);
    font-weight: 700;
}

.file-list {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.file-item {
    display: grid;
    grid-template-columns: 18px minmax(260px, 1fr) auto;
    gap: 10px;
    align-items: start;
    padding: 9px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #fff;
}

.file-item small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
}

.file-actions,
.row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.thumb-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.photo-content {
    display: block;
}

.thumb {
    width: 72px;
    height: 72px;
    min-height: 72px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 0;
    background: #fff;
    overflow: hidden;
    cursor: pointer;
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
}

.modal.is-open {
    display: block;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.72);
}

.modal-panel {
    position: absolute;
    inset: 32px;
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto;
    gap: 14px;
    max-width: 1100px;
    margin: auto;
    padding: 18px;
    border-radius: 8px;
    background: #fff;
}

.modal-panel img {
    width: 100%;
    height: 100%;
    min-height: 0;
    object-fit: contain;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 36px;
    min-height: 36px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
    padding: 0;
}

.modal-nav {
    position: absolute;
    top: 50%;
    width: 44px;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--accent-dark);
    font-size: 34px;
    line-height: 1;
    padding: 0 0 4px;
    transform: translateY(-50%);
}

.modal-prev {
    left: 18px;
}

.modal-next {
    right: 18px;
}

.modal-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}

#modalTitle {
    font-weight: 700;
}

.empty {
    padding: 28px;
    color: var(--muted);
    text-align: center;
}

@media (max-width: 760px) {
    .shell {
        width: min(100% - 20px, 1180px);
        margin: 10px auto;
    }

    .search-panel {
        padding: 18px;
    }

    .search-form {
        grid-template-columns: 1fr;
    }
}
