:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --border: #e3e5ea;
  --text: #1f2430;
  --muted: #7b8194;
  --accent: #c2410c;
  --accent-dark: #9a330a;
  --danger: #c0392b;
  --ok: #d97706;
  --shadow: 0 1px 3px rgba(20, 24, 33, 0.08);
  /* 사이드바 색 — 모두마당 앱 메인 색(주황)을 그대로 쓴다. */
  --sidebar-bg: #c2410c;
  --sidebar-text: #fce4d1;
}

* {
  box-sizing: border-box;
}

/* An element given a display value by a rule below would otherwise ignore the
   hidden attribute, since an author rule beats the user-agent [hidden] rule.
   Keep this guard so toggling .hidden always hides the element. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic",
    "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

/* 로그인 */
.login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 32px 28px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.login-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 4px;
}

.login-logo svg {
  display: block;
}

.login-title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
}

.login-sub {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.login-input {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 16px;
}

.login-input:focus {
  outline: 2px solid var(--accent);
  border-color: var(--accent);
}

.login-error {
  margin: 0;
  color: var(--danger);
  font-size: 14px;
}

/* 버튼 */
.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  background: var(--surface);
}

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

.btn-primary:hover {
  background: var(--accent-dark);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}

.btn-ghost:hover {
  background: var(--bg);
}

.btn-mini {
  padding: 6px 10px;
  font-size: 13px;
  border-color: var(--border);
}

.btn-ok {
  background: var(--ok);
  color: #fff;
  border-color: var(--ok);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
  border-color: var(--danger);
}

.btn:disabled {
  opacity: 0.6;
  cursor: default;
}

/* 관리자 셸 — 왼쪽 세로 메뉴 + 오른쪽 본문 */
.app-view {
  display: flex;
  min-height: 100vh;
}

/* 사이드바 */
.sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--sidebar-bg);
  padding: 20px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 22px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-mark svg {
  display: block;
}

.brand-text {
  font-size: 16px;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
}

/* 세로 내비 */
.tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.tab {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: none;
  background: none;
  padding: 11px 12px;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--sidebar-text);
  cursor: pointer;
  text-align: left;
  white-space: nowrap;
}

.tab:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.tab.is-active {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.tab-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding-top: 14px;
  margin-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.btn-logout {
  width: 100%;
  background: transparent;
  border-color: rgba(255, 255, 255, 0.28);
  color: #eaf3ee;
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* 오른쪽 본문 열 */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* 상단 바 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.topbar-title {
  font-size: 18px;
  font-weight: 800;
}

.content {
  padding: 28px;
  max-width: 1120px;
  width: 100%;
  margin: 0 auto;
}

/* 좁은 화면 — 사이드바를 가로 막대로 */
@media (max-width: 760px) {
  .app-view {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    overflow-x: auto;
  }
  .sidebar-brand {
    padding: 0 6px 0 2px;
  }
  .brand-text {
    display: none;
  }
  .tabs {
    flex-direction: row;
    flex: 1;
    gap: 4px;
  }
  .tab {
    padding: 9px 12px;
  }
  .sidebar-footer {
    padding-top: 0;
    margin-top: 0;
    border-top: none;
  }
  .btn-logout {
    width: auto;
    white-space: nowrap;
  }
  .content {
    padding: 20px 16px;
  }
}

.tab-panel {
  display: none;
}

.tab-panel.is-active {
  display: block;
}

/* 개요 카드 */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
}

.card-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.card-value {
  margin-top: 8px;
  font-size: 24px;
  font-weight: 800;
}

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

.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
}

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

.search {
  flex: 1;
  min-width: 200px;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
}

/* 표 */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow-x: auto;
  box-shadow: var(--shadow);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table th,
.table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table th {
  background: #fafbfc;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

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

.table .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.table .account {
  font-variant-numeric: tabular-nums;
}

.clickable {
  cursor: pointer;
}

.clickable:hover {
  background: #f7f9f8;
}

.row-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* 상태 배지 */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge-requested {
  background: #fdf1d6;
  color: #8a6d1a;
}

.badge-processing {
  background: #d8e8ff;
  color: #21548c;
}

.badge-paid {
  background: #d8efe0;
  color: #1f5c3d;
}

.badge-rejected {
  background: #f6dcd8;
  color: #8c2b21;
}

.badge-verified {
  background: #d8efe0;
  color: #1f5c3d;
}

.badge-unverified {
  background: #efe7da;
  color: #7a6a4f;
}

/* 상태·안내 문구 */
.empty,
.error,
.hint {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}

.error {
  color: var(--danger);
}

.hint {
  padding: 12px 4px;
  text-align: left;
  font-size: 13px;
}

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

/* 겹침 창 */
.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 24, 33, 0.45);
}

.modal-card {
  position: relative;
  background: var(--surface);
  border-radius: 16px;
  padding: 24px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 12px 40px rgba(20, 24, 33, 0.25);
}

.modal-title {
  margin: 0 0 6px;
  font-size: 20px;
  font-weight: 800;
}

.modal-desc {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
}

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

.textarea {
  width: 100%;
  min-height: 80px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 15px;
  font-family: inherit;
  resize: vertical;
}

.detail-grid {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 8px 12px;
  margin-bottom: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 8px;
}

.form-grid .textarea {
  min-height: 90px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.detail-label {
  color: var(--muted);
  font-weight: 700;
}

.detail-sub {
  margin: 18px 0 8px;
  font-size: 15px;
  font-weight: 800;
}

.detail-list {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
}

.detail-list li {
  margin-bottom: 4px;
}

.pre {
  white-space: pre-line;
}
