:root {
  color-scheme: light;
  --bg: #f6f4ee;
  --panel: #ffffff;
  --panel-strong: #fdfaf3;
  --ink: #202124;
  --muted: #67645d;
  --line: #ded8ca;
  --teal: #0f766e;
  --teal-dark: #0b514b;
  --coral: #d95d39;
  --amber: #f0b429;
  --green-soft: #e5f5ec;
  --green-text: #1f6b3d;
  --red-soft: #fde8e1;
  --red-text: #9a3412;
  --shadow: 0 16px 35px rgba(32, 33, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.topbar {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin: 0 auto 18px;
  max-width: 1180px;
  padding: 18px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 14px;
  min-width: 0;
}

.brand-mark {
  align-items: center;
  background: #e8f4ef;
  border: 1px solid #b8ddd0;
  border-radius: 8px;
  color: var(--teal);
  display: flex;
  flex: 0 0 52px;
  height: 52px;
  justify-content: center;
  width: 52px;
}

.brand-mark svg {
  fill: currentColor;
  height: 30px;
  width: 30px;
}

h1 {
  font-size: 22px;
  line-height: 1.2;
  margin: 0 0 4px;
}

p {
  margin: 0;
}

#folderLabel {
  color: var(--muted);
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions,
.control-band,
.table-toolbar {
  align-items: center;
  display: flex;
  gap: 10px;
}

.button {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-weight: 700;
  gap: 8px;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.button:hover:not(:disabled) {
  border-color: #b6ad9b;
  transform: translateY(-1px);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.button.primary {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.button.primary:hover:not(:disabled) {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
}

.button.wide {
  min-width: 164px;
}

.button-icon {
  align-items: center;
  display: inline-flex;
  height: 20px;
  justify-content: center;
  width: 20px;
}

.button-icon svg,
.search-icon svg {
  fill: none;
  height: 20px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 20px;
}

.workspace {
  display: grid;
  gap: 14px;
  margin: 0 auto;
  max-width: 1180px;
}

.summary-band {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 92px;
  padding: 16px;
}

.stat-label {
  color: var(--muted);
  display: block;
  font-size: 13px;
  margin-bottom: 10px;
}

.stat-card strong {
  display: block;
  font-size: 28px;
  line-height: 1;
}

.control-band,
.table-band {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 260px;
}

.field.compact {
  min-width: 130px;
  width: 130px;
}

.field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input[type="text"],
input[type="number"],
input[type="search"] {
  background: var(--panel-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  min-height: 40px;
  outline: none;
  padding: 0 12px;
  width: 100%;
}

input:focus-visible {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.unit-input {
  align-items: center;
  display: flex;
  position: relative;
}

.unit-input input {
  padding-right: 42px;
}

.unit-input span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  position: absolute;
  right: 12px;
}

.control-spacer {
  flex: 1;
}

.table-band {
  min-height: 360px;
}

.table-toolbar {
  justify-content: space-between;
  margin-bottom: 12px;
}

.search-field {
  align-items: center;
  display: flex;
  max-width: 420px;
  position: relative;
  width: 100%;
}

.search-field input {
  padding-left: 40px;
}

.search-icon {
  color: var(--muted);
  display: flex;
  left: 12px;
  position: absolute;
}

.check-control {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 14px;
  font-weight: 700;
  gap: 8px;
  min-height: 40px;
  white-space: nowrap;
}

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

.status-message {
  align-items: center;
  background: var(--panel-strong);
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  justify-content: center;
  min-height: 220px;
  padding: 22px;
  text-align: center;
}

.status-message.busy {
  color: var(--teal);
}

.status-message.error {
  background: var(--red-soft);
  border-color: #f7b99f;
  color: var(--red-text);
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 520px;
  overflow: auto;
}

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

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

th {
  background: #f1eadb;
  color: #514d45;
  font-size: 12px;
  position: sticky;
  top: 0;
  z-index: 1;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover {
  background: #fffaf0;
}

.select-column {
  text-align: center;
  width: 48px;
}

.path-cell {
  font-weight: 700;
  max-width: 520px;
  overflow-wrap: anywhere;
}

.size-cell,
.modified-cell {
  color: var(--muted);
  white-space: nowrap;
}

.pill {
  background: #eef6f4;
  border: 1px solid #c5e3dd;
  border-radius: 999px;
  color: var(--teal-dark);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  min-height: 26px;
  padding: 4px 10px;
  white-space: nowrap;
}

.pill.done {
  background: var(--green-soft);
  border-color: #b7dfc7;
  color: var(--green-text);
}

.pill.error {
  background: var(--red-soft);
  border-color: #f7b99f;
  color: var(--red-text);
}

.pill.skipped {
  background: #fff4d8;
  border-color: #f4d37b;
  color: #805600;
}

@media (max-width: 820px) {
  .app-shell {
    padding: 12px;
  }

  .topbar,
  .control-band,
  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .summary-band {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field,
  .field.compact,
  .button.wide,
  .search-field {
    max-width: none;
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 520px) {
  .brand {
    align-items: flex-start;
  }

  .brand-mark {
    flex-basis: 46px;
    height: 46px;
    width: 46px;
  }

  h1 {
    font-size: 19px;
  }

  .top-actions,
  .summary-band {
    grid-template-columns: 1fr;
  }
}
