* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Malgun Gothic", "맑은 고딕", -apple-system, sans-serif;
  background: #f4f5f7;
  color: #222;
}

.hidden { display: none !important; }
.row-2 { display: flex; gap: 10px; }
.row-2 > div { flex: 1; }

header {
  background: #0F6E56;
  color: #fff;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 20;
}
header h1 { font-size: 16px; margin: 0; }
header button {
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
}

.layout {
  display: flex;
  max-width: 1100px;
  margin: 0 auto;
}

.sidebar {
  display: none;
  flex-direction: column;
  width: 160px;
  flex-shrink: 0;
  padding: 16px 8px;
  gap: 4px;
}
.sidebar button {
  text-align: left;
  padding: 9px 12px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 14px;
  cursor: pointer;
  color: #333;
}
.sidebar button.active { background: #0F6E56; color: #fff; }
.sidebar .write-btn {
  margin-top: 12px;
  background: #1a202c;
  color: #fff;
  text-align: center;
  font-weight: bold;
}

.pills {
  display: flex;
  gap: 6px;
  padding: 10px 12px;
  overflow-x: auto;
}
.pills button {
  flex-shrink: 0;
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid #cbd5e0;
  background: #fff;
  color: #333;
  cursor: pointer;
}
.pills button.active { background: #1a202c; color: #fff; border-color: #1a202c; }

main {
  flex: 1;
  min-width: 0;
  padding: 8px 12px 90px;
}

.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.panel-header h2 { font-size: 16px; margin: 0; }

.filter-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; }
.filter-row button {
  flex-shrink: 0; font-size: 13px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid #cbd5e0; background: #fff; color: #333; cursor: pointer;
}
.filter-row button.active { background: #0F6E56; color: #fff; border-color: #0F6E56; }

input[type=text], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 10px; font-size: 14px; border: 1px solid #ccc; border-radius: 8px;
  margin-bottom: 10px;
}
label { display: block; font-size: 13px; color: #555; margin: 8px 0 4px; }

.btn {
  padding: 8px 14px; background: #0F6E56; color: #fff; border: none; border-radius: 8px;
  font-size: 13px; cursor: pointer;
}
.btn.secondary { background: #eee; color: #333; }
.btn.danger { background: #fff; color: #b91c1c; border: 1px solid #f0c0c0; }

.item-card {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 12px 14px;
  margin-bottom: 10px; cursor: pointer;
}
.item-card.below-min { border-color: #f0a0a0; background: #fff8f7; }
.item-card .row-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 2px; }
.item-card .color-name { font-weight: bold; font-size: 15px; }
.item-card .badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: #e1f5ee; color: #085041; }
.item-card .total-line { font-size: 12px; color: #718096; margin: 0 0 8px; }
.item-card .warn-line { font-size: 12px; color: #c53030; margin: 0 0 8px; display: flex; align-items: center; gap: 4px; }
.item-card .seg-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; margin-bottom: 8px; background: #ddd; }
.item-card .legend { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; color: #718096; }
.item-card .legend .dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 3px; }

.empty-msg { text-align: center; color: #a0aec0; padding: 30px 0; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; background: #fff; border-radius: 10px; overflow: hidden; }
.data-table th, .data-table td { padding: 8px 10px; border-bottom: 1px solid #edf2f7; text-align: left; }
.data-table th { background: #f7fafc; color: #4a5568; font-size: 12px; }
.data-table td.num { text-align: right; }

.count-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid #edf2f7; }
.count-row .name { flex: 1; font-size: 13px; }
.count-row input { width: 80px; margin: 0; }
.count-row .diff { font-size: 12px; min-width: 70px; text-align: right; }
.count-row .diff.neg { color: #c53030; }
.count-row .diff.pos { color: #2f855a; }

.fab {
  position: fixed; right: 20px; bottom: 24px; width: 54px; height: 54px; border-radius: 50%;
  background: #1a202c; color: #fff; border: none; font-size: 26px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25); cursor: pointer;
}

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center;
  justify-content: center; z-index: 50; padding: 16px; overflow-y: auto;
}
.modal { background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto; }
.modal h2 { font-size: 16px; margin: 0 0 14px; }
.modal .row { display: flex; gap: 16px; margin-top: 16px; }
.modal button.primary { flex: 1; padding: 12px; background: #0F6E56; color: #fff; border: none; border-radius: 8px; font-weight: bold; }
.modal button.secondary { padding: 12px 16px; background: #eee; border: none; border-radius: 8px; }
.error { color: #b91c1c; font-size: 13px; margin-top: 8px; }

.detail-section { margin-bottom: 14px; }
.detail-section h3 { font-size: 13px; color: #555; margin: 0 0 6px; }
.detail-chip { display: inline-block; font-size: 12px; border: 1px solid #e2e8f0; padding: 4px 10px; border-radius: 8px; margin: 0 6px 6px 0; }

@media (min-width: 860px) {
  .sidebar { display: flex; }
  .pills { display: none; }
  .fab { display: none; }
  main { padding: 16px 20px 20px; }
}
