:root {
  --bg: #f4f7f1;
  --surface: #ffffff;
  --surface-2: #edf4ea;
  --ink: #1f2a1e;
  --muted: #556252;
  --line: #ccd7c8;
  --accent: #0d8a5f;
  --accent-strong: #076b49;
  --danger: #c64040;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Noto Sans KR", "Malgun Gothic", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, #e6f3ea 0%, transparent 35%),
    radial-gradient(circle at 100% 100%, #dceadf 0%, transparent 45%),
    var(--bg);
}

.app {
  max-width: 1100px;
  margin: 24px auto 32px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  box-shadow: 0 4px 12px rgba(29, 43, 28, 0.06);
}

.hero {
  background: linear-gradient(130deg, #ffffff 0%, #eef8f3 100%);
}

h1 {
  margin: 0;
  font-size: 28px;
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

p {
  margin: 8px 0;
}

.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
  color: var(--muted);
}

input {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
}

textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 15px;
  color: var(--ink);
  background: #fff;
  line-height: 1.4;
}

input:focus {
  outline: 2px solid rgba(13, 138, 95, 0.25);
  border-color: var(--accent);
}

textarea:focus {
  outline: 2px solid rgba(13, 138, 95, 0.25);
  border-color: var(--accent);
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  background: var(--surface-2);
  cursor: pointer;
}

button:hover {
  filter: brightness(0.98);
}

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

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

button.primary:hover {
  background: var(--accent-strong);
}

button.subtle {
  background: transparent;
}

.quick-days {
  margin-top: 10px;
  display: flex;
  gap: 8px;
}

.patient-grid {
  margin-top: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.patient-grid .symptom-field {
  grid-column: 1 / -1;
}

#symptomInput {
  min-height: 88px;
  resize: vertical;
}

.picker-row {
  display: flex;
  align-items: end;
  gap: 8px;
}

.grow {
  flex: 1;
}

.quick-drugs {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.quick-drugs > strong {
  color: var(--muted);
  font-size: 13px;
}

.quick-drug-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.quick-drug-buttons button {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  background: #f7fbf6;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px 6px;
  font-size: 14px;
}

th {
  color: var(--muted);
  background: #fafdf9;
}

.delete-btn {
  color: var(--danger);
  border-color: #f0c2c2;
  background: #fff5f5;
  min-height: 34px;
}

.message {
  margin: 8px 0 0;
  min-height: 20px;
  color: var(--danger);
}

.copy-summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.copy-summary-head h2 {
  margin: 0;
}

#copySummaryText {
  margin-top: 10px;
  min-height: 220px;
  resize: vertical;
  font-family: "Consolas", "Malgun Gothic", monospace;
  line-height: 1.45;
}

.totals {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.result-extra {
  margin-top: 12px;
}

.handong-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 220px));
  gap: 10px;
}

.handong-field {
  max-width: 260px;
}

.totals > div {
  display: flex;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}

.totals .grand {
  border-color: var(--accent);
  background: #ebf8f2;
}

.totals span {
  color: var(--muted);
}

.totals strong {
  font-size: 18px;
}

.total-edit-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
}

.total-edit-wrap input {
  min-width: 110px;
}

.total-spin-wrap {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #f7fbf6;
}

.total-spin-btn {
  min-width: 40px;
  min-height: 24px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 0;
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  color: #2e3f2d;
  background: #f3f8f2;
}

.total-spin-btn:last-child {
  border-bottom: 0;
}

.total-spin-btn:hover {
  background: #e8f2e7;
}

@media (max-width: 880px) {
  .grid {
    grid-template-columns: 1fr;
  }

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

  h1 {
    font-size: 24px;
  }
}
