:root {
  --bg: #f4f7f8;
  --text: #122126;
  --muted: #5e6e73;
  --card: #ffffff;
  --line: #dce5e8;
  --teal: #0f766e;
  --teal-soft: #d9f4ef;
  --orange: #c2410c;
  --orange-soft: #ffedd5;
  --navy: #1e3a8a;
  --shadow: 0 12px 32px rgba(17, 44, 60, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  background: radial-gradient(circle at 10% -10%, #d8f2eb 0%, transparent 35%),
    radial-gradient(circle at 90% 0%, #ffe6d6 0%, transparent 30%), var(--bg);
  color: var(--text);
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  pointer-events: none;
  z-index: 0;
  filter: blur(42px);
  opacity: 0.35;
}

.bg-orb-1 {
  width: 300px;
  height: 300px;
  background: #6ee7b7;
  left: -120px;
  top: 120px;
}

.bg-orb-2 {
  width: 340px;
  height: 340px;
  background: #fdba74;
  right: -140px;
  top: 80px;
}

.layout {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 20px 48px;
  display: grid;
  gap: 18px;
}

.hero {
  background: linear-gradient(130deg, #0f766e 0%, #134e4a 60%, #1e3a8a 100%);
  color: #f8fdfd;
  border-radius: 20px;
  padding: 24px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  box-shadow: var(--shadow);
  animation: rise 0.6s ease;
}

.eyebrow {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.9;
}

h1 {
  margin: 8px 0 6px;
  font-size: 32px;
}

.subtitle {
  margin: 0;
  color: #c6f7ef;
}

.hero-actions {
  display: flex;
  gap: 10px;
  align-items: end;
  flex-wrap: wrap;
}

.hero-actions label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
}

.admin-btn {
  width: auto;
  white-space: nowrap;
}

.admin-btn.active {
  background: #0f766e;
  border-color: #0f766e;
  color: #ecfeff;
  font-weight: 700;
}

button,
select,
input {
  border-radius: 10px;
  border: 1px solid #d4e5ea;
  padding: 9px 11px;
  font-size: 14px;
}

button {
  cursor: pointer;
  background: #ffffff;
}

button.primary {
  background: #f59e0b;
  border-color: #f59e0b;
  color: #1f1301;
  font-weight: 700;
}

.compact-btn {
  width: auto;
  white-space: nowrap;
}

.add-year-btn {
  align-self: flex-start;
  margin-bottom: 2px;
}

.hidden-btn {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.48);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}

.modal-backdrop.hidden-btn {
  display: none;
}

.modal-card {
  width: min(360px, 100%);
  background: #ffffff;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 14px;
}

.modal-card h3 {
  margin: 0 0 10px;
}

.modal-card form {
  display: grid;
  gap: 8px;
}

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

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  gap: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.kpi-card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid #edf2f4;
  animation: rise 0.6s ease;
}

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

.kpi-value {
  font-size: 28px;
  font-weight: 800;
}

.card {
  background: var(--card);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
  border: 1px solid #edf2f4;
}

.card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.delete-toggle-btn {
  padding: 5px 8px;
  font-size: 12px;
}

.delete-toggle-btn.active {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #991b1b;
}

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

h3 {
  margin: 0;
  font-size: 14px;
  color: var(--navy);
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

.annual-due-editor {
  margin-top: 12px;
  border-top: 1px dashed var(--line);
  padding-top: 12px;
}

.annual-due-rows {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.annual-due-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.annual-due-row label {
  font-size: 13px;
  color: var(--muted);
}

.annual-due-row input {
  width: 100%;
  min-width: 0;
  text-align: right;
}

.two-col {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 14px;
}

.table-wrap {
  overflow-x: auto;
}

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

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

tr.alert td {
  background: var(--orange-soft);
}

.stacked-form {
  margin-bottom: 14px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafdfd;
}

.stacked-form-inner {
  margin-top: 8px;
  margin-bottom: 0;
}

.accordion {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafdfd;
  padding: 6px 10px;
  margin-bottom: 12px;
}

.accordion summary {
  cursor: pointer;
  font-size: 14px;
  color: var(--navy);
  font-weight: 600;
  padding: 4px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lock-btn {
  width: auto;
  min-width: 36px;
  height: 36px;
  padding: 2px 4px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lock-btn.unlocked {
  background: #dcfce7;
  border-color: #86efac;
}

.lock-icon-img {
  width: 20px;
  height: 20px;
  display: block;
  object-fit: contain;
}

.lock-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

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

.month-input {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.month-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 30px;
  gap: 4px;
  align-items: center;
  min-width: 0;
}

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

.month-input input {
  width: 100%;
  min-width: 0;
  text-align: right;
  -moz-appearance: textfield;
}

.month-input input::-webkit-outer-spin-button,
.month-input input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.member-form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.quick-select {
  width: 30px;
  min-width: 30px;
  height: 36px;
  padding: 0;
  text-align: center;
  font-size: 10px;
  background: #f8fafc;
}

.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
}

.feed li {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
}

.feed .remove-check {
  width: 16px;
  height: 16px;
  margin: 0;
  align-self: center;
}

.feed li.removable {
  grid-template-columns: 20px 78px 1fr auto;
}

.feed .amount {
  font-weight: 700;
}

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

  .hero {
    flex-direction: column;
  }

  h1 {
    font-size: 26px;
  }
}

@media (max-width: 540px) {
  .layout {
    padding: 18px 12px 30px;
  }

  .kpi-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 6px;
    overflow-x: hidden;
  }

  .kpi-card {
    padding: 8px 6px;
    border-radius: 10px;
  }

  .kpi-label {
    font-size: 10px;
    margin-bottom: 4px;
    line-height: 1.2;
  }

  .kpi-value {
    font-size: 12px;
    line-height: 1.2;
    word-break: keep-all;
  }

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

  .hero-actions {
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: hidden;
    gap: 4px;
    align-items: center;
  }

  .hero-actions label {
    width: auto;
    min-width: 0;
    flex: 1 1 0;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 3px;
    font-size: 10px;
  }

  .hero-actions button {
    width: auto;
    flex: 1 1 0;
    min-width: 0;
    white-space: nowrap;
    padding: 5px 6px;
    font-size: 11px;
    border-radius: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hero-actions select {
    width: 100%;
    min-width: 0;
    flex: 1 1 0;
    padding: 5px 4px;
    font-size: 11px;
  }

  .hero-actions .compact-btn {
    width: auto;
    min-width: 0;
    max-width: none;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .hero-actions .add-year-btn {
    width: auto;
    max-width: 60px;
    flex: 1 1 0;
    padding: 5px 4px;
    font-size: 10px;
  }

  .feed li {
    grid-template-columns: 78px 1fr;
  }

  .feed li.removable {
    grid-template-columns: 20px 68px 1fr;
  }

  .feed .amount {
    grid-column: 1 / -1;
    text-align: right;
  }
}

@media (min-width: 1200px) {
  .month-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@keyframes rise {
  from {
    transform: translateY(10px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
