:root {
  color-scheme: light;
  --bg: #f5f6f4;
  --ink: #1d2424;
  --muted: #657171;
  --line: #d6dcda;
  --panel: #ffffff;
  --accent: #116466;
  --accent-soft: #d9eeee;
  --warn: #8a5b10;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1500px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 360px) 1fr;
  gap: 20px;
  align-items: end;
  margin-bottom: 16px;
}

h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0;
}

p {
  margin: 6px 0 0;
  color: var(--muted);
}

.filters {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) repeat(3, minmax(140px, 1fr)) auto;
  gap: 10px;
  align-items: center;
}

input,
select,
button,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input,
select,
textarea {
  min-height: 38px;
  padding: 8px 10px;
}

button {
  min-height: 36px;
  padding: 7px 14px;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  cursor: pointer;
}

button.danger {
  width: 100%;
  border-color: #9b2d20;
  background: #9b2d20;
}

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

.check {
  display: flex;
  gap: 7px;
  align-items: center;
  white-space: nowrap;
  color: var(--muted);
}

.check input {
  min-height: auto;
}

.table-wrap {
  overflow: auto;
  max-height: calc(100vh - 150px);
  border: 1px solid var(--line);
  background: var(--panel);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1180px;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef2f1;
  font-size: 12px;
  text-transform: uppercase;
  color: #526060;
}

.file-name {
  font-weight: 650;
}

.path {
  max-width: 520px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  overflow-wrap: anywhere;
}

td select,
td input,
td textarea {
  width: 100%;
}

textarea {
  min-height: 38px;
  resize: vertical;
}

.ext {
  display: inline-flex;
  min-width: 42px;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent-soft);
  color: #174d50;
  padding: 3px 8px;
  font-weight: 700;
  text-transform: uppercase;
}

.preview-cell {
  width: 128px;
}

.preview-btn {
  min-height: 30px;
  padding: 4px 9px;
  font-size: 12px;
}

.preview-box {
  margin-top: 6px;
  min-height: 26px;
  color: var(--muted);
  font-size: 12px;
}

.delete-cell {
  width: 112px;
}

.open-cell {
  width: 132px;
}

.open-btn {
  width: 100%;
  background: #315f7d;
  border-color: #315f7d;
}

.modal[hidden] {
  display: none;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 10;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 28, 28, .72);
}

.modal-panel {
  position: absolute;
  inset: 28px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
}

.modal-close {
  justify-self: end;
  min-width: 92px;
  background: #fff;
  color: var(--ink);
  border-color: #fff;
}

#previewLarge {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  border: 1px solid rgba(255,255,255,.35);
}

.pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
}

.error {
  color: var(--warn);
}

@media (max-width: 980px) {
  .toolbar,
  .filters {
    grid-template-columns: 1fr;
  }
}
