:root {
  --bg: #f3efe6;
  --bg-2: #fffdf8;
  --ink: #1f1b16;
  --muted: #6b6258;
  --line: #e4d9c8;
  --teal: #0f6e62;
  --teal-soft: #d9efe9;
  --ok: #157347;
  --ok-soft: #d9f3e4;
  --warn: #9a3412;
  --warn-soft: #fde8d8;
  --danger: #9f1239;
  --danger-soft: #fde4ea;
  --shadow: 0 18px 40px rgba(55, 38, 16, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 10% -10%, #fff7e6, transparent 50%),
    radial-gradient(900px 400px at 100% 0%, #e7f4ef, transparent 45%),
    var(--bg);
  color: var(--ink);
  font-family: "Avenir Next", "Segoe UI", Helvetica, Arial, sans-serif;
}

body {
  padding: 28px 20px 64px;
}

.wrap {
  width: min(1120px, 100%);
  margin: 0 auto;
}

.panel {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.setup {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 16px;
  padding: 18px;
}

.drop-col {
  display: grid;
  gap: 8px;
  align-content: start;
}

.drop {
  position: relative;
  min-height: 148px;
  padding: 18px;
  border: 1.5px dashed #c9bba5;
  border-radius: 14px;
  background: #fbf7ef;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.drop:hover,
.drop.dragover {
  border-color: var(--teal);
  background: #f3faf7;
  transform: translateY(-1px);
}

.drop.ready {
  border-style: solid;
  border-color: #86c4b6;
  background: #f3faf7;
}

.drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.drop small,
.meta {
  color: var(--muted);
}

.drop h2,
.limit h2 {
  margin: 0 0 6px;
  font-size: 16px;
}

.file-name,
.file-list {
  margin-top: 0;
  min-height: 1.4em;
  color: var(--muted);
  font-weight: 550;
  word-break: break-word;
}

.file-list {
  display: grid;
  gap: 6px;
  font-weight: 550;
}

.file-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid #d7cbb8;
  font-size: 13px;
}

.file-chip button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 0 4px;
  font-size: 16px;
  line-height: 1;
}

.limit {
  min-width: 210px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.limit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0 16px;
}

.actions {
  display: grid;
  gap: 8px;
}

.actions .primary,
.actions .ghost {
  width: 100%;
}

.ghost:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.limit input {
  width: 100%;
  padding: 11px 12px;
  border: 1px solid #d7cbb8;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  font-weight: 650;
}

.unit {
  color: var(--muted);
  font-weight: 650;
}

button {
  font: inherit;
}

.primary,
.ghost {
  border: 0;
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
}

.primary {
  background: var(--ink);
  color: #fff7ea;
  font-weight: 700;
}

.primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 14px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.stat {
  padding: 8px 12px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 650;
}

.stat.danger {
  background: var(--danger-soft);
  border-color: #f3c1ce;
  color: var(--danger);
}

.stat.warn {
  background: var(--warn-soft);
  border-color: #f3c9a8;
  color: var(--warn);
}

.stat.ok {
  background: var(--ok-soft);
  border-color: #b7e4c7;
  color: var(--ok);
}

.filters {
  display: flex;
  gap: 8px;
}

.ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

.ghost.active {
  background: var(--ink);
  color: #fff7ea;
  border-color: var(--ink);
}

.search {
  min-width: 220px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  font: inherit;
}

.error {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--danger-soft);
  color: var(--danger);
}

.results {
  overflow: hidden;
}

.row {
  border-top: 1px solid var(--line);
}

.row:first-child {
  border-top: 0;
}

.summary {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 16px;
  align-items: center;
  width: 100%;
  padding: 16px 18px;
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.row.ok .summary {
  cursor: default;
}

.badge {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-weight: 800;
}

.row.ok .badge {
  background: var(--ok-soft);
  color: var(--ok);
}

.row.bad .badge {
  background: var(--danger-soft);
  color: var(--danger);
}

.row.warn .badge {
  background: var(--warn-soft);
  color: var(--warn);
}

.name {
  font-weight: 750;
}

.sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.metric {
  text-align: right;
}

.metric strong {
  display: block;
  font-size: 18px;
}

.metric span,
.note {
  color: var(--muted);
  font-size: 12px;
}

.metric.over strong {
  color: var(--danger);
}

.metric.caution strong {
  color: var(--warn);
}

.details {
  padding: 0 18px 18px 62px;
}

.note {
  margin: 0 0 10px;
}

.days {
  display: grid;
  gap: 8px;
}

.day {
  display: grid;
  grid-template-columns: 110px 40px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 14px;
}

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

.report-panel {
  padding: 28px;
}

.report-header {
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--ink);
}

.report-header h1 {
  margin: 0 0 8px;
  font-size: 28px;
  letter-spacing: -0.03em;
}

.report-meta,
.report-empty {
  margin: 0 0 4px;
  color: var(--muted);
}

.report-section {
  margin: 0 0 28px;
}

.report-section h2 {
  margin: 0 0 12px;
  font-size: 18px;
}

.report-person {
  margin: 0 0 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.report-person h3 {
  margin: 0 0 6px;
}

.report-person p {
  margin: 0 0 4px;
  color: var(--muted);
}

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

.report-table th,
.report-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.report-table th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

@media (max-width: 840px) {
  .setup,
  .summary,
  .day {
    grid-template-columns: 1fr;
    display: grid;
  }

  .setup {
    display: flex;
    flex-direction: column;
  }

  .metric,
  .summary {
    text-align: left;
  }

  .details {
    padding-left: 18px;
  }
}

@media print {
  html,
  body {
    background: #fff;
    color: #111;
  }

  body {
    padding: 16px;
  }

  .setup,
  .error,
  .toolbar {
    display: none !important;
  }

  .panel {
    border: 0;
    box-shadow: none;
    background: #fff;
  }

  .report-person,
  .report-section {
    break-inside: avoid;
  }
}
