:root {
  --bg: #f5f5f1;
  --surface: #ffffff;
  --surface-soft: #eef3ef;
  --text: #202622;
  --muted: #65706b;
  --line: #d8ddd7;
  --accent: #226b5a;
  --accent-dark: #174d40;
  --warn: #945f1f;
  --danger: #a13d3d;
  --blue: #2f5f8f;
  --shadow: 0 10px 24px rgba(35, 44, 39, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Noto Sans KR", sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  touch-action: manipulation;
}

.shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(245, 245, 241, 0.96);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 180px;
}

.brand-name {
  font-size: 17px;
  font-weight: 700;
}

.brand-sub {
  color: var(--muted);
  font-size: 12px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.tab,
.button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 12px;
  cursor: pointer;
  white-space: nowrap;
}

.tab:hover,
.button:hover {
  border-color: #aeb8b1;
}

.tab.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

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

.button.primary:hover,
.tab.active:hover {
  background: var(--accent-dark);
}

.button.warn {
  border-color: var(--warn);
  color: var(--warn);
}

.button.danger {
  border-color: var(--danger);
  color: var(--danger);
}

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

.main {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(120px, 180px) minmax(120px, 180px) minmax(120px, 160px) minmax(220px, 1fr) auto;
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

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

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  padding: 8px 9px;
}

.field textarea {
  resize: vertical;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.status-row {
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  margin-bottom: 10px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

th,
td {
  padding: 10px 9px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #edf0ea;
  color: #3f4944;
  font-size: 12px;
}

td:first-child,
th:first-child {
  width: 42px;
  text-align: center;
}

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

tr.selected td {
  background: #ecf4f0;
}

.empty {
  padding: 40px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  text-align: center;
}

.pill {
  display: inline-flex;
  min-width: 58px;
  justify-content: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: #ece8dc;
  color: #5a4d2d;
  font-size: 12px;
}

.pill.done {
  background: #dcefe7;
  color: #225643;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 14px;
  box-shadow: var(--shadow);
}

.metric-label {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.section-title {
  margin: 20px 0 8px;
  font-size: 16px;
  font-weight: 700;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(24, 28, 26, 0.42);
}

.modal-backdrop.open {
  display: flex;
}

.modal {
  width: min(520px, 100%);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 20px 60px rgba(22, 26, 24, 0.25);
  padding: 18px;
}

.modal h2 {
  margin: 0 0 12px;
  font-size: 19px;
}

.modal p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.5;
}

.modal .field {
  margin-bottom: 10px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

@media (max-width: 980px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .tabs {
    justify-content: flex-start;
  }

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

  .filter-actions {
    justify-content: flex-start;
  }

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

  .split {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .main {
    padding: 12px;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .filter-actions,
  .tabs {
    width: 100%;
  }

  .tab,
  .button {
    flex: 1 1 auto;
  }
}
