:root {
  --teal: #1fbfad;
  --black: #111827;
  --gray2: #f1f5f9;
  --gray5: #6b7280;
  --border: #e5e7eb;
  --danger: #dc2626;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Noto Sans KR', -apple-system, sans-serif;
  color: var(--black);
  background: #f8fafc;
}
a { color: inherit; }

.layout { min-height: 100vh; display: flex; flex-direction: column; }

/* ── 상단 바 (taxby.pro 스타일) ── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 32px; background: #fff; border-bottom: 1px solid var(--border);
}
.topbar-brand { display: flex; align-items: center; gap: 10px; }
.topbar-logo {
  width: 36px; height: 36px; border-radius: 8px; background: var(--gray2);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.topbar-title { font-weight: 900; font-size: 15px; line-height: 1.3; }
.topbar-sub { font-size: 11px; color: var(--gray5); }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 13px; color: var(--gray5); }
.btn-admin-console {
  background: #0f172a; color: #fff; padding: 7px 14px; border-radius: 6px;
  font-size: 13px; font-weight: 700; text-decoration: none;
}
.btn-admin-console:hover { filter: brightness(1.15); }
.back-console-link { display: inline-block; margin-bottom: 16px; font-size: 13px; color: var(--gray5); text-decoration: none; }
.back-console-link:hover { color: var(--black); }

/* ── 메인 탭 (가로) ── */
.maintabs {
  display: flex; gap: 4px; padding: 0 32px; background: #fff;
  border-bottom: 1px solid var(--border); overflow-x: auto;
}
.maintabs a {
  padding: 14px 16px; font-size: 14px; color: var(--gray5); text-decoration: none;
  white-space: nowrap; border-bottom: 2px solid transparent; font-weight: 600;
}
.maintabs a.active { color: var(--teal); border-bottom-color: var(--teal); }
.maintabs a:hover { color: var(--black); }

/* ── 서브 탭 ── */
.subtabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.subtab {
  padding: 8px 16px; border-radius: 6px; font-size: 13px; font-weight: 600;
  background: var(--gray2); color: var(--gray5); cursor: pointer;
}
.subtab.active { background: var(--teal); color: #fff; }

.main { flex: 1; padding: 32px 40px; min-width: 0; }
.main h1 { font-size: 24px; margin: 0 0 4px; }
.main .subtitle { color: var(--gray5); margin-bottom: 24px; font-size: 14px; }

.card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 20px; }
.card + .card { margin-top: 16px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 16px; margin-bottom: 24px; }
.stat-box { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; }
.stat-box .label { font-size: 13px; color: var(--gray5); margin-bottom: 6px; }
.stat-box .value { font-size: 28px; font-weight: 900; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--gray5); font-weight: 600; font-size: 12px; text-transform: uppercase; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 16px; border-radius: 6px; border: none;
  font-size: 14px; font-weight: 600; cursor: pointer;
  background: var(--teal); color: #fff;
}
.btn:hover { filter: brightness(0.95); }
.btn.secondary { background: #fff; border: 1px solid var(--border); color: var(--black); }
.btn.danger { background: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }

input[type=text], input[type=password], input[type=file], select, textarea {
  width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 6px;
  font-size: 14px; font-family: inherit;
}
label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; margin-top: 14px; }
label:first-child { margin-top: 0; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,0.5);
  display: flex; align-items: center; justify-content: center; z-index: 100;
}
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 420px; max-width: 90vw; max-height: 85vh; overflow-y: auto; }
.modal h2 { margin: 0 0 16px; font-size: 18px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.admin { background: #fee2e2; color: #b91c1c; }
.badge.staff { background: #dbeafe; color: #1d4ed8; }
.badge.client { background: #dcfce7; color: #15803d; }

.msg { margin: 12px 0; padding: 10px 14px; border-radius: 8px; font-size: 14px; }
.msg.error { background: #fee2e2; color: #b91c1c; }
.msg.success { background: #dcfce7; color: #15803d; }

.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: #0f172a;
}
.login-card {
  background: #fff; border-radius: 14px; padding: 40px; width: 380px; max-width: 90vw;
}
.login-card h1 { font-size: 20px; margin: 0 0 4px; }
.login-card .subtitle { color: var(--gray5); font-size: 13px; margin-bottom: 24px; }
.login-card .btn { width: 100%; justify-content: center; margin-top: 20px; padding: 12px; font-size: 15px; }

.icon-btn { background: none; border: none; cursor: pointer; color: var(--gray5); font-size: 13px; text-decoration: underline; padding:0; }

.empty-state { text-align: center; padding: 40px 0; color: var(--gray5); font-size: 14px; }
