:root {
  --bg: #efefec;
  --bg-soft: #e8e8e4;
  --bg-card: #f5f5f2;
  --text: #2a2a2a;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --primary: #c45c26;
  --primary-dark: #3d3d3d;
  --orange: #e67e22;
  --red: #c45b4a;
  --green: #1e8a5e;
  --green-bg: #e7f5ee;
  --border: #e0ddd6;
  /* 뉴모피즘: 밝은 하이라이트 + 어두운 소프트 섀도 */
  --shadow-out:
    8px 8px 18px rgba(166, 160, 145, 0.28),
    -6px -6px 16px rgba(255, 255, 255, 0.95);
  --shadow-out-sm:
    4px 4px 10px rgba(166, 160, 145, 0.22),
    -3px -3px 8px rgba(255, 255, 255, 0.9);
  --shadow-in:
    inset 5px 5px 10px rgba(166, 160, 145, 0.22),
    inset -4px -4px 10px rgba(255, 255, 255, 0.85);
  --shadow-in-sm:
    inset 3px 3px 6px rgba(166, 160, 145, 0.18),
    inset -2px -2px 6px rgba(255, 255, 255, 0.8);
  --shadow: var(--shadow-out);
  --radius: 22px;
  --radius-sm: 16px;
  --nav-h: 72px;
  --font: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font-family: inherit;
  font-size: 14px;
}

button {
  height: 44px;
  border: none;
  cursor: pointer;
  border-radius: 3px;
}

input,
select,
textarea {
  width: 100%;
  border: none;
  background: var(--bg);
  border-radius: 14px;
  padding: 12px 14px;
  outline: none;
  box-shadow: var(--shadow-in-sm);
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: none !important;
  box-shadow: var(--shadow-in) !important;
  border: none;
}

textarea {
  resize: none;
}

.app-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 16px 16px calc(var(--nav-h) + 28px);
  position: relative;
}

.app-shell.no-nav {
  padding-bottom: 24px;
}

.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-out);
  border: none;
  padding: 18px;
  margin-bottom: 16px;
}

.card-sm {
  padding: 14px;
}

.card-inset {
  box-shadow: var(--shadow-in);
  background: var(--bg);
}

.page-eyebrow {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin: 0 0 2px;
}

.page-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.branch-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  box-shadow: var(--shadow-out-sm);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary-dark);
  white-space: nowrap;
}

.branch-pill a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  color: var(--text-secondary);
  box-shadow: var(--shadow-out-sm);
  background: var(--bg-card);
  font-size: 12px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 16px;
  height: 44px;
  border-radius: 14px;
  font-weight: 600;
  box-shadow: var(--shadow-out-sm);
  border: none;
}

.btn-primary {
  background: var(--primary-dark);
  color: #fff;
  box-shadow: var(--shadow-out-sm);
}

.btn-accent {
  background: var(--orange);
  color: #fff;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--primary-dark);
}

.btn-danger {
  background: #dc2626;
  color: #fff;
}

.btn-ghost {
  background: var(--bg-card);
  box-shadow: var(--shadow-out-sm);
  color: var(--primary-dark);
  height: 40px;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  height: 34px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: 10px;
}

.muted {
  color: var(--text-secondary);
}

.tiny {
  font-size: 12px;
  color: var(--text-muted);
}

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

.empty .material-symbols-outlined {
  font-size: 42px;
  opacity: 0.35;
  display: block;
  margin-bottom: 8px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: max(10px, env(safe-area-inset-bottom));
  width: min(448px, calc(100% - 20px));
  height: 64px;
  background: var(--bg-card);
  border-radius: 22px;
  box-shadow: var(--shadow-out);
  border: none;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  z-index: 50;
  padding: 6px;
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 16px;
}

.bottom-nav a.active {
  color: var(--orange);
  background: rgba(230, 126, 34, 0.12);
  box-shadow: var(--shadow-in-sm);
}

.bottom-nav a.active .nav-icon {
  background: transparent;
  color: var(--orange);
  border-radius: 0;
  padding: 0;
}

.nav-icon {
  font-size: 22px;
  line-height: 1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 16px);
  transform: translateX(-50%) translateY(20px);
  background: #1f2937;
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
  z-index: 100;
  max-width: min(420px, calc(100% - 32px));
  display: flex;
  align-items: center;
  gap: 8px;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error {
  background: #b91c1c;
}

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--bg);
}

.login-brand {
  text-align: center;
  margin-bottom: 24px;
}

.login-logo {
  width: 64px;
  height: 64px;
  border-radius: 20px;
  background: var(--primary-dark);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-out);
  margin-bottom: 12px;
}

.login-brand h1 {
  margin: 0;
  font-size: 24px;
  color: var(--primary-dark);
}

.login-brand p {
  margin: 6px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.field {
  margin-bottom: 12px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.field-icon {
  position: relative;
}

.field-icon .material-symbols-outlined {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 20px;
}

.field-icon input {
  padding-left: 42px;
}

.segmented {
  display: flex;
  gap: 4px;
  background: var(--bg);
  padding: 5px;
  border-radius: 999px;
  margin-bottom: 14px;
  overflow-x: auto;
  box-shadow: var(--shadow-in);
}

.segmented a,
.segmented button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  min-width: max-content;
  height: 34px;
  border-radius: 999px;
  background: transparent;
  color: var(--text-secondary);
  padding: 0 14px;
  font-weight: 600;
  line-height: 1;
  text-align: center;
  box-shadow: none;
}

.segmented .active {
  background: #2f2f2f;
  color: #fff;
  box-shadow: var(--shadow-out-sm);
}

.metric-big {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

.row-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  text-align: center;
}

.row-3 .tiny {
  margin-bottom: 4px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.dot-orange {
  background: var(--orange);
}
.dot-red {
  background: var(--red);
}
.dot-green {
  background: var(--green);
}
.dot-gray {
  background: #cbd5e1;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.badge-orange {
  background: #fff1e3;
  color: var(--orange);
}
.badge-green {
  background: var(--green-bg);
  color: var(--green);
}
.badge-brown {
  background: #f0e8e0;
  color: var(--primary-dark);
}
.badge-gray {
  background: #f3f4f6;
  color: #6b7280;
}

.profit-box {
  background: var(--green-bg);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow-in-sm);
}

.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px dashed #e8e4dc;
}

.list-item:last-child {
  border-bottom: none;
}

.list-item .amount {
  margin-left: auto;
  font-weight: 700;
}

.amount-plus {
  color: var(--orange);
}
.amount-minus {
  color: var(--red);
}

.fab {
  position: fixed;
  right: max(20px, calc(50% - 240px + 20px));
  bottom: calc(var(--nav-h) + 8px);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--orange);
  color: #fff;
  box-shadow:
    6px 6px 14px rgba(180, 100, 40, 0.35),
    -3px -3px 10px rgba(255, 255, 255, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 40;
}

.fab .material-symbols-outlined {
  font-size: 28px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 80;
  display: none;
  align-items: flex-end;
  justify-content: center;
}

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

.modal {
  width: min(480px, 100%);
  background: var(--bg-card);
  border-radius: 24px 24px 0 0;
  padding: 18px 16px 28px;
  max-height: 88vh;
  overflow: auto;
  box-shadow: var(--shadow-out);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
}

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

.chip {
  border: 1px solid #e0d8cc;
  background: #fff;
  border-radius: 999px;
  height: auto;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--text-secondary);
}

.chip.active {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
  color: #fff;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.status-card {
  background: var(--bg-card);
  box-shadow: var(--shadow-out-sm);
  border-radius: 16px;
  padding: 12px 8px;
  text-align: center;
}

.status-card .num {
  font-size: 20px;
  font-weight: 700;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-head,
.cal-cell {
  text-align: center;
  padding: 8px 2px;
  font-size: 12px;
}

.cal-cell {
  background: var(--bg-card);
  border-radius: 12px;
  min-height: 54px;
  box-shadow: var(--shadow-out-sm);
}

.cal-cell .d {
  font-weight: 700;
  margin-bottom: 2px;
}

.cal-cell .names {
  font-size: 10px;
  color: var(--text-secondary);
  line-height: 1.2;
}

.menu-list a,
.menu-list button {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 4px;
  border-bottom: 1px solid #f0ebe3;
  background: transparent;
  height: auto;
  text-align: left;
  color: var(--text);
}

.menu-list a:last-child,
.menu-list button:last-child {
  border-bottom: none;
}

.welcome-card {
  background: var(--primary-dark);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-out);
  margin-bottom: 16px;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed #eee;
}

.check-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.chart-scroll {
  overflow-x: auto;
  overflow-y: hidden;
  margin: 0 -2px;
  padding: 6px 2px 2px;
}

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 150px;
  padding: 4px 2px 0;
  min-width: max-content;
}

.chart-bar {
  flex: 0 0 32px;
  width: 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.chart-bar .val {
  font-size: 9px;
  color: var(--text-muted);
  line-height: 1.15;
  text-align: center;
  min-height: 22px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.chart-bar .stack {
  width: 14px;
  flex: 0 0 auto;
  border-radius: 999px;
  overflow: hidden;
  display: flex;
  flex-direction: column-reverse;
  background: var(--bg-soft);
  box-shadow: var(--shadow-in-sm);
  min-height: 10px;
}

.chart-bar .dep {
  background: var(--orange);
  width: 100%;
  border-radius: 999px;
}

.chart-bar .label {
  font-size: 10px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.2;
}

.legend-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin-top: 14px;
}

.legend-grid .item {
  display: flex;
  align-items: center;
  font-size: 12px;
  color: var(--text-secondary);
}

.stat-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  text-align: center;
}

.stat-row .tiny {
  margin-bottom: 4px;
}

.stat-row strong {
  font-size: 16px;
  font-weight: 700;
}

.subtabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.subtabs a {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 11px 8px;
  background: var(--bg-card);
  border-radius: 14px;
  box-shadow: var(--shadow-out-sm);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 13px;
}

.subtabs a.active {
  background: var(--primary-dark);
  color: #fff;
  box-shadow: var(--shadow-out-sm);
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.section-head h2 {
  margin: 0;
  font-size: 16px;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.form-actions .btn {
  flex: 1;
}

.meter-row {
  margin-bottom: 12px;
}

.meter-row:last-child {
  margin-bottom: 0;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
}

.meter-track {
  height: 12px;
  border-radius: 999px;
  background: var(--bg);
  box-shadow: var(--shadow-in-sm);
  overflow: hidden;
}

.meter-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 0;
}

.meter-fill-dark {
  background: #4b5563;
}

.meter-fill-orange {
  background: var(--orange);
}

.meter-fill-red {
  background: var(--red);
}

.daily-table {
  overflow-x: auto;
  margin: 0 -4px;
  padding: 2px 4px;
}

.data-table {
  width: 100%;
  min-width: 420px;
  border-collapse: collapse;
  font-size: 12px;
}

.data-table th,
.data-table td {
  padding: 10px 8px;
  text-align: right;
  border-bottom: 1px solid rgba(0, 0, 0, 0.04);
  white-space: nowrap;
}

.data-table th:first-child,
.data-table td:first-child {
  text-align: left;
}

.data-table th {
  color: var(--text-muted);
  font-weight: 600;
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

@media (min-width: 768px) {
  .app-shell {
    padding-top: 24px;
  }
}
