:root {
  --bg: #f8f9fa;
  --bg-elev: #ffffff;
  --card: #ffffff;
  --card-2: #f4f5f7;
  --border: #e6e8eb;
  --text: #1e2329;
  --muted: #707a8a;
  --muted-2: #a0a8b3;
  --yellow: #f0b90b;
  --yellow-2: #fcd535;
  /* 라이트 배경용 가독성 앰버 — text/icon 등 색만 들어가는 곳에 사용.
     #f0b90b 는 흰 배경에서 약 1.84:1 (가독성 미흡), #946309 는 약 5.15:1 (AA pass). */
  --accent-ink: #946309;
  --green: #03a66d;
  --red: #cf304a;
  --orange: #e2760e;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Roboto, sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  height: 100%;
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; }
a { color: var(--accent-ink); text-decoration: none; }

/* Login */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px 26px;
  width: 100%;
  max-width: 360px;
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
}
.login-brand .dot {
  width: 8px; height: 8px; background: var(--yellow); transform: rotate(45deg);
  border-radius: 1px;
}
.login-brand-text {
  font-size: 14px;
  color: var(--accent-ink);
  font-weight: 700;
  letter-spacing: 1px;
}
.login-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}
.login-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
}
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field label { font-size: 12px; color: var(--muted); }
.field input, .field select, .field textarea {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent-ink); }
.btn {
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-weight: 600;
  font-size: 13px;
  transition: border-color .15s, background .15s, filter .15s;
}
.btn:hover { border-color: var(--muted-2); }
.btn:disabled,
.btn[aria-busy="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}
.btn-primary {
  background: linear-gradient(180deg, var(--yellow-2), var(--yellow));
  color: #000;
  border-color: transparent;
}
.btn-primary:hover { filter: brightness(0.95); }
.btn-danger {
  background: rgba(207,48,74,0.15);
  color: var(--red);
  border-color: rgba(207,48,74,0.35);
}
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.error-msg { color: var(--red); font-size: 12px; min-height: 16px; margin-top: 6px; }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  height: 100vh;
}
.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.sidebar-brand {
  padding: 18px 18px 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand .dot {
  width: 10px; height: 10px; background: var(--yellow); transform: rotate(45deg);
  border-radius: 1px;
}
.sidebar-brand .text {
  font-size: 13px;
  color: var(--accent-ink);
  font-weight: 700;
  letter-spacing: 1px;
}
.sidebar-brand .role {
  font-size: 10px;
  color: var(--muted);
  margin-left: auto;
  letter-spacing: 1px;
}
.sidebar-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: 2px;
  font-weight: 500;
  font-size: 13px;
  border: 1px solid transparent;
}
.nav-item:hover { background: rgba(0,0,0,0.04); color: var(--text); }
.nav-item.active {
  background: rgba(240,185,11,0.12);
  color: var(--accent-ink);
  border-color: rgba(240,185,11,0.25);
}
.nav-group { margin-bottom: 4px; }
.nav-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  user-select: none;
}
.nav-group-head:hover { background: rgba(0,0,0,0.04); color: var(--text); }
.nav-group-head .chev {
  width: 12px; height: 12px;
  transition: transform .18s ease;
}
.nav-group.open .nav-group-head .chev { transform: rotate(180deg); }
.nav-group-body {
  display: none;
  padding-left: 4px;
  padding-top: 2px;
}
.nav-group.open .nav-group-body { display: block; }
.nav-sub {
  padding-left: 22px !important;
  font-size: 12.5px;
}
.sidebar-foot {
  border-top: 1px solid var(--border);
  padding: 12px 14px;
  font-size: 12px;
}
.sidebar-foot .who { color: var(--text); font-weight: 600; }
.sidebar-foot .meta { color: var(--muted); margin-top: 2px; }
.sidebar-foot .logout {
  margin-top: 10px;
  width: 100%;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 6px;
  padding: 6px;
  font-size: 12px;
}
.sidebar-foot .logout:hover { color: var(--red); border-color: rgba(207,48,74,0.4); }

.main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  height: 52px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 22px;
  gap: 14px;
  background: var(--bg);
}
.topbar h1 { font-size: 16px; margin: 0; font-weight: 700; }
.topbar .spacer { flex: 1; }
.tenant-pick {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  color: var(--text);
  font-size: 12px;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
}

/* Cards / KPI */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}
.kpi-label { color: var(--muted); font-size: 11px; letter-spacing: 1px; font-weight: 600; }
.kpi-value { font-size: 22px; font-weight: 700; margin-top: 6px; }

.section-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.section-head {
  display: flex;
  align-items: center;
  margin-bottom: 14px;
  gap: 12px;
}
.section-title {
  font-size: 15px;
  font-weight: 700;
}
.section-head .spacer { flex: 1; }

/* Tables */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.table th, .table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.table th {
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  background: var(--bg-elev);
}
.table tr:hover td { background: rgba(0,0,0,0.03); }
.table .mono { font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace; }
.table .row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.table .empty-row td,
.table .loading-row td {
  text-align: center;
  color: var(--muted);
  padding: 28px 12px;
  font-size: 12px;
}
.table .empty-row:hover td,
.table .loading-row:hover td { background: transparent; }
.copyable { cursor: pointer; transition: color .12s; }
.copyable:hover { color: var(--accent-ink); }

/* Calendars (대시보드 입금/출금예정) */
.cal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 860px) {
  .cal-grid { grid-template-columns: 1fr; }
}
.cal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}
.cal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.cal-head .cal-title { font-size: 14px; font-weight: 700; }
.cal-head .cal-sub { font-size: 11px; color: var(--muted); }
.cal-head .spacer { flex: 1; }
.cal-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cal-nav button {
  width: 28px; height: 28px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.cal-nav button:hover { border-color: var(--muted-2); }
.cal-nav .cal-month {
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-ink);
  min-width: 80px;
  text-align: center;
}
.cal-grid-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-grid-days .cal-dow {
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  padding: 4px 0;
}
.cal-grid-days .cal-dow.sun { color: #d96a78; }
.cal-grid-days .cal-dow.sat { color: #6ea4ff; }
.cal-cell {
  position: relative;
  min-height: 56px;
  padding: 4px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color .12s, transform .08s;
  display: flex;
  flex-direction: column;
}
.cal-cell:hover { border-color: var(--accent-ink); }
.cal-cell:active { transform: scale(0.97); }
.cal-cell.empty { background: transparent; border-color: transparent; cursor: default; }
.cal-cell.empty:hover { border-color: transparent; }
.cal-cell.today { border-color: var(--accent-ink); }
.cal-cell .cal-num { font-size: 11px; font-weight: 600; color: var(--text); }
.cal-cell.sun .cal-num { color: #d96a78; }
.cal-cell.sat .cal-num { color: #6ea4ff; }
.cal-cell .cal-amt {
  margin-top: auto;
  font-size: 10.5px;
  font-weight: 700;
  text-align: right;
  word-break: break-all;
}
.cal-card.deposit .cal-cell.has .cal-amt   { color: var(--accent-ink); }
.cal-card.withdraw .cal-cell.has .cal-amt  { color: var(--green); }
.cal-cell .cal-cnt {
  font-size: 9px;
  color: var(--muted);
  text-align: right;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  vertical-align: middle;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-block {
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.loading-block .spinner { margin-right: 8px; color: var(--muted); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.badge.active,
.badge.rewarded { background: rgba(3,166,109,0.15); color: var(--green); }
.badge.suspended,
.badge.paused,
.badge.joined   { background: rgba(240,185,11,0.15); color: var(--accent-ink); }
.badge.banned,
.badge.expired,
.badge.archived,
.badge.disabled,
.badge.cancelled,
.badge.ended    { background: rgba(207,48,74,0.15); color: var(--red); }
.badge.draft,
.badge.scheduled,
.badge.open     { background: rgba(132,142,156,0.15); color: var(--muted); }

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.toolbar input, .toolbar select {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 12px;
  outline: none;
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--accent-ink); }
.toolbar .spacer { flex: 1; }

/* Modal */
.modal-bd {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
}
.modal-bd.show { display: flex; animation: bd-in .14s ease-out; }
@keyframes bd-in { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  width: 100%;
  max-width: 500px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  animation: modal-in .14s ease-out;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(6px) scale(.985); }
  to   { opacity: 1; transform: none; }
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.modal-close:hover { background: rgba(0,0,0,0.06); color: var(--text); }
.modal-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; padding-right: 28px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal-msg { font-size: 13px; color: var(--text); line-height: 1.5; margin-bottom: 16px; white-space: pre-wrap; }
.modal-pre {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  font-size: 11.5px;
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 320px;
  overflow-y: auto;
  color: var(--text);
}

/* Toast */
.toast {
  position: fixed;
  top: 16px;
  right: 16px;
  background: var(--card-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .2s, transform .2s;
  z-index: 2000;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.ok  { border-color: rgba(3,166,109,0.5); }
.toast.err { border-color: rgba(207,48,74,0.5); }
.toast.ws-blink {
  animation: ws-pulse .35s ease-in-out 3;
  border-color: var(--yellow) !important;
  box-shadow: 0 0 0 0 rgba(240,185,11,0.7);
}
@keyframes ws-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(240,185,11,0.7); }
  50%      { box-shadow: 0 0 0 8px rgba(240,185,11,0); }
}
.toast .toast-msg { flex: 1; min-width: 0; word-break: break-word; }
.toast .toast-close {
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
}
.toast .toast-close:hover { color: var(--text); }

/* Search input clear button */
.input-clear-wrap { position: relative; display: flex; flex: 0 1 auto; }
.input-clear-wrap input { padding-right: 28px !important; }
.input-clear-wrap .input-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  border-radius: 4px;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}
.input-clear-wrap .input-clear:hover { color: var(--text); background: rgba(0,0,0,0.06); }
.input-clear-wrap.has-value .input-clear { display: inline-flex; }

/* Chat */
.chat-shell { display: grid; grid-template-columns: 320px 1fr; gap: 14px; min-height: 540px; }
.thread-list {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-y: auto;
}
.thread-row {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
}
.thread-row:hover { background: rgba(0,0,0,0.03); }
.thread-row.active { background: rgba(240,185,11,0.08); }
.thread-row .top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.thread-row .wallet { font-size: 12px; font-family: ui-monospace, monospace; color: var(--text); }
.thread-row .when { font-size: 10px; color: var(--muted); }
.thread-row .preview { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.thread-detail {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
}
.thread-empty {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 13px;
}
.thread-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}
.thread-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 320px;
}
.msg {
  max-width: 75%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
}
.msg.user { align-self: flex-start; background: var(--bg-elev); }
.msg.admin { align-self: flex-end; background: var(--yellow); color: #000; }
.msg.ai { align-self: flex-start; background: var(--card-2); border: 1px dashed var(--border); }
.msg.system { align-self: center; background: transparent; color: var(--muted); font-size: 11px; }
.msg .time { font-size: 10px; opacity: 0.7; margin-top: 4px; }
.thread-input {
  border-top: 1px solid var(--border);
  padding: 10px 14px;
  display: flex;
  gap: 8px;
}
.thread-input input {
  flex: 1;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 9px 12px;
  outline: none;
}
.thread-input input:focus { border-color: var(--accent-ink); }

/* Mobile menu trigger + drawer overlay */
.menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  align-items: center;
  justify-content: center;
  background: var(--card-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 0;
  flex-shrink: 0;
  position: relative;
  z-index: 110;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: rgba(255,255,255,0.1);
}
.menu-btn:hover { border-color: var(--muted-2); }
.menu-btn:active { transform: scale(0.95); }
.menu-btn svg { width: 18px; height: 18px; display: block; pointer-events: none; }
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 90;
  display: none;
}
.sidebar-backdrop.show { display: block; }

/* ============================================================================
   Tablet / mobile (≤ 860px)
   ============================================================================ */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }

  .sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 260px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform .22s ease;
  }
  .sidebar.open { transform: translateX(0); }

  .menu-btn { display: inline-flex; }

  .topbar {
    height: 48px;
    padding: 0 14px;
    gap: 10px;
  }
  .topbar h1 {
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }
  .tenant-pick {
    max-width: 160px;
    padding: 6px 8px;
    font-size: 11px;
  }

  .content { padding: 14px; }

  .kpi-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
  }
  .kpi-card { padding: 12px 14px; }
  .kpi-value { font-size: 18px; }
  .kpi-label { font-size: 10px; }

  .section-card {
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 12px;
  }
  .section-head {
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 12px;
  }
  .section-title { font-size: 14px; }

  .toolbar { flex-wrap: wrap; gap: 6px; }
  .toolbar input,
  .toolbar select {
    flex: 1 1 140px;
    min-width: 0;
  }

  /* Horizontal scroll for any container that holds a table */
  .section-card > div:has(> .table) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -12px;
    padding: 0 12px;
  }
  /* Tables placed directly inside a section card (dashboard, operating hours) */
  .section-card > .table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
  .table { font-size: 11.5px; }
  .table th, .table td {
    padding: 8px 8px;
    white-space: nowrap;
  }
  .table th { font-size: 10px; }
  .table .row-actions { justify-content: flex-end; flex-wrap: nowrap; }
  .row-actions .btn {
    height: 30px;
    padding: 0 10px;
    font-size: 11px;
  }

  .badge { padding: 2px 6px; font-size: 9px; }

  .btn { height: 38px; padding: 0 12px; font-size: 12.5px; }

  /* Modal */
  .modal-bd { padding: 12px; align-items: flex-start; padding-top: 24px; }
  .modal {
    padding: 18px;
    border-radius: 12px;
    max-height: calc(100vh - 48px);
  }
  .modal-title { font-size: 15px; }

  /* Chat — stack list above detail */
  .chat-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    min-height: 0;
    gap: 10px;
  }
  .thread-list { max-height: 240px; }
  .thread-msgs { min-height: 240px; }
  .msg { max-width: 85%; }

  /* Toast — topbar(48px) 아래로 내려서 햄버거버튼 안 가리게 */
  .toast {
    top: 56px;
    left: 12px;
    right: 12px;
    text-align: center;
  }

  /* Sidebar tweaks for drawer */
  .sidebar-foot { padding: 12px 14px 18px; }
  .nav-item { padding: 11px 12px; }
}

/* ============================================================================
   Small phones (≤ 480px)
   ============================================================================ */
@media (max-width: 480px) {
  .login-card { padding: 22px 18px; border-radius: 12px; }
  .login-title { font-size: 20px; }

  .topbar { padding: 0 12px; gap: 8px; }
  .topbar h1 { font-size: 13px; }
  .content { padding: 12px; }

  .kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }
  .kpi-value { font-size: 16px; }

  .tenant-pick { max-width: 130px; }

  .section-card { padding: 10px; }
  .section-card > div:has(> .table) {
    margin: 0 -10px;
    padding: 0 10px;
  }

  .modal { padding: 14px; }
  .modal-foot { gap: 6px; }
  .modal-foot .btn { flex: 1; }

  .sidebar { width: 240px; }
}

/* ============================================================================
   Popup preview classes (shared with user app for "미리보기" parity)
   ============================================================================ */
.pp-modal-bd {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 2000;
  animation: pp-fade .2s ease-out;
}
@keyframes pp-fade { from { opacity: 0; } to { opacity: 1; } }
.pp-modal {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%; max-width: 380px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  position: relative;
  animation: pp-pop .22s ease-out;
}
@keyframes pp-pop {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to   { opacity: 1; transform: none; }
}
.pp-modal img.pp-image {
  width: 100%; height: auto; display: block;
  border-top-left-radius: 16px; border-top-right-radius: 16px;
}
.pp-modal .pp-body { padding: 18px 20px 16px; }
.pp-modal .pp-title { font-size: 17px; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.pp-modal .pp-content { font-size: 13px; color: var(--muted); line-height: 1.55; word-break: break-word; }
.pp-modal .pp-foot { display: flex; gap: 8px; padding: 0 20px 18px; flex-wrap: wrap; }
.pp-modal .pp-foot .btn {
  flex: 1 1 100px; height: 40px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card-2);
  color: var(--text);
  font-size: 13px; font-weight: 600;
  cursor: pointer;
}
.pp-modal .pp-foot .btn-primary {
  background: linear-gradient(180deg, var(--yellow-2), var(--yellow));
  color: #000; border-color: transparent;
}
.pp-modal .pp-close {
  position: absolute; top: 8px; right: 8px;
  width: 30px; height: 30px;
  border: 0; background: rgba(0,0,0,0.5);
  border-radius: 50%; color: #fff;
  font-size: 18px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  z-index: 1;
}
.pp-modal .pp-close:hover { background: rgba(0,0,0,0.75); }

.pp-toast {
  position: fixed; top: 70px; left: 50%;
  transform: translateX(-50%) translateY(-12px);
  width: calc(100% - 32px); max-width: 380px;
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--yellow);
  border-radius: 10px; padding: 12px 14px;
  z-index: 1900;
  display: flex; gap: 10px; align-items: flex-start;
  opacity: 0; transition: opacity .25s, transform .25s;
  cursor: pointer;
}
.pp-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.pp-toast .pp-toast-body { flex: 1; min-width: 0; }
.pp-toast .pp-toast-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.pp-toast .pp-toast-content {
  font-size: 12px; color: var(--muted); line-height: 1.4;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
}
.pp-toast .pp-toast-close {
  background: transparent; border: 0;
  color: var(--muted); font-size: 16px; cursor: pointer;
  line-height: 1; padding: 0; flex-shrink: 0;
}

.pp-floating {
  position: fixed; left: 16px; bottom: 24px;
  width: 240px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 12px;
  z-index: 95;
  box-shadow: 0 6px 20px rgba(0,0,0,0.45);
  cursor: pointer;
  animation: pp-float-in .3s ease-out;
}
@keyframes pp-float-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: none; }
}
.pp-floating .pp-fl-close {
  position: absolute; top: 4px; right: 4px;
  width: 22px; height: 22px;
  background: transparent; border: 0;
  color: var(--muted); font-size: 14px; cursor: pointer; line-height: 1;
}
.pp-floating .pp-fl-title { font-size: 13px; font-weight: 600; color: var(--accent-ink); margin-bottom: 4px; padding-right: 16px; }
.pp-floating .pp-fl-content { font-size: 11px; color: var(--muted); line-height: 1.4; }
.pp-floating img { width: 100%; border-radius: 8px; margin-bottom: 8px; display: block; }

/* Image preview thumbnail in admin form */
.field-img-preview {
  margin-top: 6px;
  max-width: 220px;
  max-height: 140px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-elev);
  display: none;
  object-fit: contain;
}
.field-img-preview.show { display: block; }
