/* KDes CMS — dark admin theme mirroring the kdeslive_web palette. */
:root {
  color-scheme: dark;

  --bg: #08080C;
  --surface: #13131A;
  --surface-alt: #16161C;
  --surface-chip: #22222A;
  --border: #1F1F27;
  --border-alt: #23232C;

  --text: #FFFFFF;
  --text-body: #CFCFD4;
  --text-secondary: #9E9EA6;
  --text-muted: #6D6D77;

  --brand: #E5323E;
  --brand-press: #C4262F;
  --brand-soft: rgba(229, 50, 62, 0.14);
  --success: #3BB273;
  --danger: #E5323E;
  --warn: #EBB800;
  --chart-2: #5B8DEF;

  --radius-card: 14px;
  --radius-input: 12px;
  --radius-pill: 999px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
          "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic",
          "Helvetica Neue", Arial, sans-serif;

  --topbar-h: 56px;
  --sidebar-w: 230px;
  --content-max: 1180px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-body);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }

/* ---- shell layout ---- */
#root { min-height: 100vh; }

.main {
  margin-left: var(--sidebar-w);
  min-width: 0;
  transition: margin-left 0.18s ease;
}
body.sb-collapsed .main { margin-left: 0; }

/* ---- sidebar ---- */
.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 30;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--border);
  transform: translateX(0);
  transition: transform 0.18s ease;
}
body.sb-collapsed .sidebar { transform: translateX(-100%); }

.sb-brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  padding: 0 18px;
  color: var(--text);
  font-weight: 700;
  font-size: 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sb-nav {
  flex: 1;
  overflow-y: auto;
  padding: 10px 10px 16px;
}
.sb-group { margin-top: 14px; }
.sb-group-title {
  padding: 4px 10px 4px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.sb-item {
  display: block;
  padding: 8px 12px;
  margin: 1px 0;
  border-radius: 10px;
  color: var(--text-secondary);
  font-size: 13px;
}
.sb-item:hover { color: var(--text); background: var(--surface-alt); }
.sb-item.active { color: var(--text); background: var(--brand-soft); }
.sb-item.depth1 { font-weight: 600; font-size: 14px; }

.sb-footer {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}
.sb-footer .admin-name {
  color: var(--text-secondary);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* scrim behind the drawer on narrow screens */
.scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 25;
  background: rgba(0, 0, 0, 0.55);
}

@media (max-width: 899px) {
  .main { margin-left: 0; }
  .sidebar { transform: translateX(-100%); box-shadow: 0 0 40px rgba(0,0,0,0.5); }
  body.sb-open .sidebar { transform: translateX(0); }
  body.sb-open .scrim { display: block; }
}

/* ---- topbar ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
}
.page-title {
  margin: 0;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-right { display: flex; align-items: center; gap: 12px; }

.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 36px;
  height: 36px;
  padding: 8px;
  background: none;
  border: 1px solid var(--border-alt);
  border-radius: 10px;
  cursor: pointer;
}
.hamburger span {
  display: block;
  height: 2px;
  border-radius: 2px;
  background: var(--text-secondary);
}
.hamburger:hover span { background: var(--text); }

.lang-btn, .logout-btn {
  background: var(--surface-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border-alt);
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font: inherit;
  cursor: pointer;
}
.lang-btn:hover, .logout-btn:hover { color: var(--text); }

/* ---- layout ---- */
.app { max-width: var(--content-max); margin: 0 auto; padding: 20px; }
.page { display: flex; flex-direction: column; gap: 16px; }
.center-note { text-align: center; color: var(--text-muted); padding: 48px 0; }
.center-note.error { color: var(--danger); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
}

/* ---- forms ---- */
.input {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border-alt);
  border-radius: var(--radius-input);
  padding: 8px 12px;
  font: inherit;
}
.input:focus { outline: none; border-color: var(--brand); }
select.input.small { padding: 4px 8px; border-radius: 8px; font-size: 12px; }
.btn {
  background: var(--surface-alt);
  color: var(--text-body);
  border: 1px solid var(--border-alt);
  border-radius: var(--radius-input);
  padding: 8px 16px;
  font: inherit;
  cursor: pointer;
}
.btn:disabled { opacity: 0.4; cursor: default; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-press); }
.btn.small { padding: 4px 10px; font-size: 12px; border-radius: 8px; }
.form-error { color: var(--danger); font-size: 13px; }
.form-ok { color: var(--success); font-size: 13px; }

/* ---- login ---- */
.login-wrap { display: flex; justify-content: center; padding-top: 12vh; }
.login-card {
  width: 340px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card h1 { margin: 0; font-size: 20px; color: var(--text); }
.login-card h2 { margin: 0 0 6px; font-size: 14px; font-weight: 400; color: var(--text-secondary); }
.login-card label, .settings-card label, .dialog label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 13px;
}
.login-card input, .settings-card input,
.dialog input, .dialog textarea, .dialog select {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--border-alt);
  border-radius: var(--radius-input);
  padding: 9px 12px;
  font: inherit;
}
.login-card input:focus, .settings-card input:focus,
.dialog input:focus, .dialog textarea:focus, .dialog select:focus {
  outline: none;
  border-color: var(--brand);
}

/* ---- dashboard / stats ---- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}
.stat-card {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-value { color: var(--text); font-size: 22px; font-weight: 700; }
.stat-label { color: var(--text-secondary); font-size: 12px; }

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 12px;
}
.chart-card { padding: 16px 18px; }
.chart-card h3 { margin: 0 0 14px; color: var(--text); font-size: 14px; }
.chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 140px;
}
.chart-col {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
  min-width: 0;
}
.chart-val { color: var(--text-muted); font-size: 10px; line-height: 1; }
.chart-dense .chart-val { display: none; }
.chart-bar {
  width: 100%;
  min-height: 2px;
  background: var(--brand);
  border-radius: 3px 3px 0 0;
  opacity: 0.85;
}
.chart-day { color: var(--text-muted); font-size: 10px; overflow: hidden; max-width: 100%; }
.chart-empty { align-self: center; width: 100%; text-align: center; color: var(--text-muted); padding: 40px 0; }
.chart-dense .chart-day { font-size: 9px; }

/* SVG time-series charts */
.svg-chart svg { display: block; width: 100%; height: auto; }
.cg-grid { stroke: var(--border); stroke-width: 1; }
.cg-ylabel, .cg-xlabel { fill: var(--text-muted); font-size: 10px; font-family: var(--font); }
.cg-hover:hover { fill: rgba(255, 255, 255, 0.04); }
.cg-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; }
.cg-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 12px;
}
.cg-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* day-range picker */
.range-tabs { display: flex; gap: 4px; }

/* ---- filters ---- */
.filter-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filter-bar .input.grow { flex: 1; min-width: 200px; }
.filter-bar .spacer { flex: 1; }

/* ---- tables ---- */
.table-card { overflow: hidden; }
.table-title {
  margin: 0;
  padding: 14px 18px 0;
  color: var(--text);
  font-size: 14px;
}
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th, td { padding: 10px 14px; text-align: left; }
th {
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  border-bottom: 1px solid var(--border);
}
td { border-bottom: 1px solid var(--border); color: var(--text-body); }
tr:last-child td { border-bottom: none; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.empty { text-align: center; color: var(--text-muted); padding: 32px; }
td .sub { display: block; color: var(--text-muted); font-size: 12px; }
.row-deleted td { color: var(--text-muted); }
tr.row-click { cursor: pointer; }
tr.row-click:hover td { background: var(--surface-alt); }

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  background: var(--surface-chip);
  color: var(--text-secondary);
  font-size: 12px;
}
.badge.danger { background: var(--brand-soft); color: var(--danger); }
.badge.ok { background: rgba(59, 178, 115, 0.15); color: var(--success); }
.badge.status-Y, .badge.admin-Y, .badge.rstatus-completed { background: rgba(59, 178, 115, 0.15); color: var(--success); }
.badge.status-B, .badge.admin-N, .badge.rstatus-upcoming { background: rgba(235, 184, 0, 0.12); color: var(--warn); }
.badge.status-N { background: var(--surface-chip); color: var(--text-secondary); }
.badge.admin-C, .badge.rstatus-cancelled, .badge.rstatus-no_show { background: var(--brand-soft); color: var(--danger); }
.badge.rstatus-in_progress { background: var(--brand-soft); color: var(--brand); }

.badge.istatus-approved, .badge.qstatus-resolved { background: rgba(59, 178, 115, 0.15); color: var(--success); }
.badge.istatus-pending, .badge.qstatus-open, .badge.qstatus-in_progress { background: rgba(235, 184, 0, 0.12); color: var(--warn); }
.badge.istatus-suspended { background: var(--brand-soft); color: var(--danger); }
.badge.qstatus-closed { background: var(--surface-chip); color: var(--text-muted); }
.badge.verified { background: rgba(59, 178, 115, 0.15); color: var(--success); }

/* ---- status tabs ---- */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.tab {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); background: var(--brand-soft); border-color: var(--brand); }

/* ---- review moderation table ---- */
td.review-cell { max-width: 340px; white-space: normal; }
td.actions-cell { white-space: nowrap; }
.link-btn {
  border: none;
  background: none;
  color: var(--brand);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}
.link-btn:hover { text-decoration: underline; }

/* ---- inquiry detail row ---- */
tr.detail-row > td {
  background: var(--surface-alt);
  white-space: normal;
  padding: 16px 18px;
}
.inq-full {
  color: var(--text-body);
  white-space: pre-wrap;
  margin: 0 0 12px;
  max-width: 720px;
}
.inq-prev-reply {
  border-left: 3px solid var(--border-alt);
  padding: 6px 12px;
  margin: 0 0 12px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  max-width: 720px;
}
.inq-prev-reply .sub { display: block; font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.reply-form { display: flex; flex-direction: column; gap: 10px; max-width: 720px; }
.reply-form textarea {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-alt);
  border-radius: var(--radius-input);
  padding: 9px 12px;
  font: inherit;
  min-height: 90px;
  resize: vertical;
}
.reply-form textarea:focus { outline: none; border-color: var(--brand); }
.reply-form .reply-actions { display: flex; align-items: center; gap: 10px; }

/* ---- dialogs ---- */
dialog.dialog {
  background: var(--surface);
  color: var(--text-body);
  border: 1px solid var(--border-alt);
  border-radius: var(--radius-card);
  padding: 24px;
  width: 520px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}
dialog.dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.dialog h2 { margin: 0 0 16px; color: var(--text); font-size: 16px; }
.dialog form { display: flex; flex-direction: column; gap: 12px; }
.dialog textarea { min-height: 80px; resize: vertical; }
.dialog .dialog-row { display: flex; gap: 10px; }
.dialog .dialog-row > label { flex: 1; }
.dialog .dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.dialog .check-label { flex-direction: row; align-items: center; gap: 8px; }
.dialog fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
}
.dialog fieldset legend { color: var(--text-muted); font-size: 12px; padding: 0 6px; }

/* ---- pager ---- */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 14px;
}
.pager-label { color: var(--text-secondary); font-size: 13px; }

/* ---- settings ---- */
.settings-card {
  width: 380px;
  max-width: 100%;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.settings-card h2 { margin: 0; color: var(--text); font-size: 16px; }

/* ---- fx ---- */
.fx-card {
  padding: 20px 22px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}
.fx-rate { color: var(--text); font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }
.fx-meta { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 160px; }
.fx-meta span { color: var(--text-secondary); font-size: 12px; }

/* ---- toasts ---- */
.toast-holder {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  background: var(--surface-chip);
  color: var(--text);
  border: 1px solid var(--border-alt);
  border-radius: var(--radius-pill);
  padding: 8px 18px;
  font-size: 13px;
  max-width: min(90vw, 480px);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.45);
  animation: toast-in 0.18s ease;
  transition: opacity 0.35s;
}
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.out { opacity: 0; }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
}

/* ---- interpreter priority + avatar ---- */
.avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 8px;
  background: var(--surface-chip);
}
td.name-cell { white-space: nowrap; }
.prio-input { width: 76px; text-align: right; }
.table-caption { margin: -6px 0 0; color: var(--text-muted); font-size: 12px; }

/* ---- badge tones ---- */
.badge.warn { background: rgba(235, 184, 0, 0.12); color: var(--warn); cursor: help; }

/* ---- dialog text blocks (reservation confirm/cancel) ---- */
.dialog .dialog-text { margin: 0; color: var(--text-body); }
.dialog .dialog-text.sub-line { color: var(--text-secondary); font-size: 12px; }
.dialog .dialog-warn { margin: 0; color: var(--warn); font-size: 12px; }
.dialog .radio-label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

@media (max-width: 720px) {
  .chart-grid { grid-template-columns: 1fr; }
  .fx-card { gap: 12px; }
}
