/* ─────────────────────────────────────────────────────────────
   Layout + Components
   ───────────────────────────────────────────────────────────── */

/* ─── App Shell ─── */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ─── */
.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  height: var(--topbar-h);
}
.sidebar-brand-mark {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: var(--r-sm);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: -0.02em;
}
.sidebar-brand-name {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.01em;
}
.sidebar-brand-sub {
  font-size: 11px;
  color: var(--fg-subtle);
  margin-top: 1px;
}

.sidebar-section {
  padding: 14px 10px 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--fg-faint);
  text-transform: uppercase;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sidebar-section-action {
  background: transparent;
  border: 0;
  color: var(--fg-subtle);
  cursor: pointer;
  padding: 2px;
  border-radius: var(--r-xs);
  display: grid; place-items: center;
}
.sidebar-section-action:hover { background: var(--bg-hover); color: var(--fg); }

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 0 8px;
}
.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: var(--r-sm);
  color: var(--fg-muted);
  font-size: 13px;
  cursor: pointer;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  position: relative;
}
.sidebar-nav-item:hover { background: var(--bg-hover); color: var(--fg); }
.sidebar-nav-item.active {
  background: var(--bg-active);
  color: var(--fg);
}
.sidebar-nav-item .count {
  margin-left: auto;
  font-size: 11px;
  color: var(--fg-subtle);
  font-family: var(--font-mono);
}

/* Account list */
.sidebar-accounts {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px 12px;
}
.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
  position: relative;
}
.account-row:hover { background: var(--bg-hover); }
.account-row.active {
  background: var(--bg-active);
}
.account-row.active::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.account-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 11px;
  flex: 0 0 auto;
  color: white;
  position: relative;
}
.account-avatar .status-dot {
  position: absolute;
  bottom: -1px; right: -1px;
  width: 9px; height: 9px;
  border-radius: 50%;
  border: 2px solid var(--bg-surface);
}
.account-row.active .account-avatar .status-dot { border-color: var(--bg-active); }
.status-dot.online { background: var(--status-published-dot); }
.status-dot.idle   { background: var(--status-held-dot); }
.status-dot.offline{ background: var(--fg-faint); }
.status-dot.error  { background: var(--status-failed-dot); }

.account-meta { min-width: 0; flex: 1; }
.account-handle {
  font-size: 12.5px;
  color: var(--fg);
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-sub {
  font-size: 10.5px;
  color: var(--fg-subtle);
  margin-top: 1px;
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
}
.account-pulse {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-elevated);
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--fg-muted);
  margin-left: auto;
  flex: 0 0 auto;
}
.account-pulse.ok { color: var(--status-published-fg); }
.account-pulse.warn { color: var(--status-held-fg); }
.account-pulse.err { color: var(--status-failed-fg); }

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

/* ─── Main Column ─── */
.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 14px;
  background: var(--bg-canvas);
  flex: 0 0 auto;
}
.topbar-path {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  min-width: 0;
}
.topbar-path .sep { color: var(--fg-faint); }
.topbar-path .crumb { color: var(--fg-muted); }
.topbar-path .crumb.current { color: var(--fg); font-weight: 500; }
.topbar-path .account-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px 3px 4px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 11.5px;
  color: var(--fg);
}
.topbar-path .account-chip .account-avatar { width: 18px; height: 18px; font-size: 9px; }

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px 48px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.page-title {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0;
}
.page-subtitle {
  font-size: 12.5px;
  color: var(--fg-subtle);
  margin-top: 4px;
}

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--r-sm);
  font-size: 12.5px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--fg);
  cursor: pointer;
  line-height: 1;
  white-space: nowrap;
  transition: background 0.08s, border-color 0.08s;
}
.btn:hover { background: var(--bg-hover); border-color: var(--border-strong); }
.btn.primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
  font-weight: 600;
}
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.icon { padding: 6px; }
.btn.sm { padding: 4px 8px; font-size: 11.5px; }
.btn.danger { color: var(--status-failed-fg); }
.btn.danger:hover { background: var(--status-failed-bg); border-color: var(--status-failed-fg); }

/* ─── Cards / Surfaces ─── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
}
.card-header {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 10px;
}
.card-title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.card-sub {
  font-size: 11.5px;
  color: var(--fg-subtle);
  margin-top: 2px;
}
.card-body { padding: 16px; }

/* ─── Badges / Status Pills ─── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.badge .dot {
  width: 5px; height: 5px; border-radius: 50%;
  flex: 0 0 auto;
}
.badge.pending   { color: var(--status-pending-fg);   background: var(--status-pending-bg); }
.badge.pending .dot   { background: var(--status-pending-dot); }
.badge.approved  { color: var(--status-approved-fg);  background: var(--status-approved-bg); }
.badge.approved .dot  { background: var(--status-approved-dot); }
.badge.scheduled { color: var(--status-scheduled-fg); background: var(--status-scheduled-bg); }
.badge.scheduled .dot { background: var(--status-scheduled-dot); }
.badge.published { color: var(--status-published-fg); background: var(--status-published-bg); }
.badge.published .dot { background: var(--status-published-dot); }
.badge.failed    { color: var(--status-failed-fg);    background: var(--status-failed-bg); }
.badge.failed .dot    { background: var(--status-failed-dot); }
.badge.held      { color: var(--status-held-fg);      background: var(--status-held-bg); }
.badge.held .dot      { background: var(--status-held-dot); }
.badge.draft {
  color: var(--fg-muted);
  background: transparent;
  border: 1px dashed var(--border);
}

/* ─── KPI Tiles ─── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.kpi {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  position: relative;
  overflow: hidden;
}
.kpi-label {
  font-size: 11.5px;
  color: var(--fg-subtle);
  display: flex;
  align-items: center;
  gap: 6px;
}
.kpi-value {
  margin-top: 8px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-mono);
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.kpi-value .unit {
  font-size: 13px;
  font-weight: 400;
  color: var(--fg-subtle);
}
.kpi-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  font-family: var(--font-mono);
  margin-left: 8px;
}
.kpi-delta.up { color: var(--status-published-fg); }
.kpi-delta.down { color: var(--status-failed-fg); }
.kpi-hint {
  font-size: 11px;
  color: var(--fg-faint);
  margin-top: 6px;
  font-family: var(--font-mono);
}
.kpi-spark {
  position: absolute;
  right: 12px; bottom: 12px;
  opacity: 0.9;
  pointer-events: none;
}

/* ─── Post card (list row) ─── */
.post-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
  align-items: center;
  cursor: pointer;
  transition: background 0.08s;
}
.post-row:last-child { border-bottom: 0; }
.post-row:hover { background: var(--bg-hover); }
.post-row .zodiac {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: var(--bg-elevated);
  font-size: 14px;
  border: 1px solid var(--border-subtle);
}
.post-body { min-width: 0; }
.post-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--fg-subtle);
  margin-bottom: 4px;
  flex-wrap: wrap;
}
.post-head .mono { color: var(--fg-muted); }
.post-head .dot-sep { color: var(--fg-faint); }
.post-text {
  font-size: 13px;
  color: var(--fg);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.5;
}
.post-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

/* ─── Table ─── */
.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12.5px;
}
.table th {
  text-align: left;
  font-weight: 500;
  color: var(--fg-subtle);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--bg-surface);
  position: sticky;
  top: 0;
}
.table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.table tr:hover td { background: var(--bg-hover); }

/* ─── Filters / Tabs ─── */
.filters {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.filter-tab {
  padding: 5px 10px;
  border-radius: var(--r-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.filter-tab:hover { background: var(--bg-hover); color: var(--fg); }
.filter-tab.active {
  background: var(--bg-surface);
  border-color: var(--border);
  color: var(--fg);
}
.filter-tab .count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--fg-subtle);
  padding: 1px 5px;
  background: var(--bg-elevated);
  border-radius: 4px;
}
.filter-tab.active .count { color: var(--fg-muted); }

.search {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  padding: 5px 10px;
  min-width: 220px;
}
.search input {
  border: 0; background: transparent; outline: none;
  color: var(--fg); font-family: inherit; font-size: 12.5px;
  flex: 1; width: 100%;
}
.search input::placeholder { color: var(--fg-faint); }

/* ─── Inputs / Forms ─── */
.input, .textarea, .select {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 10px;
  color: var(--fg);
  font-family: inherit;
  font-size: 12.5px;
  outline: none;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.textarea {
  resize: vertical;
  min-height: 90px;
  line-height: 1.5;
  font-family: inherit;
}

.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 11.5px;
  color: var(--fg-muted);
  font-weight: 500;
  display: flex; align-items: center; justify-content: space-between;
}
.field-hint { font-size: 11px; color: var(--fg-faint); }

/* ─── Pills, chips ─── */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 11px;
  color: var(--fg-muted);
}
.chip.zodiac-chip { padding-left: 4px; }
.chip .zodiac-ico { font-size: 12px; }

/* ─── Timeline (status flow visual) ─── */
.flow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--fg-subtle);
}
.flow-step {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-surface);
}
.flow-step.done { color: var(--status-published-fg); border-color: var(--status-published-dot); }
.flow-step.current { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.flow-step.pending { color: var(--fg-faint); }
.flow-arrow { color: var(--fg-faint); }

/* ─── Scheduler / Timeline rail ─── */
.rail {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 12px;
  align-items: start;
}
.rail-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-subtle);
  padding-top: 6px;
  text-align: right;
}
.rail-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: 10px 12px;
  border-left: 2px solid var(--accent);
}

/* ─── Split view ─── */
.split-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.split-3 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 20px;
}
@media (max-width: 1100px) {
  .split-3 { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ─── Calendar grid ─── */
.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  overflow: hidden;
}
.cal-head, .cal-cell {
  background: var(--bg-surface);
  padding: 8px 10px;
  min-height: 96px;
}
.cal-head {
  min-height: 0;
  font-size: 10.5px;
  color: var(--fg-subtle);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: center;
}
.cal-cell {
  position: relative;
}
.cal-cell.dim { background: var(--bg-canvas); }
.cal-cell.today .cal-num { color: var(--accent); font-weight: 600; }
.cal-num {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--fg-muted);
}
.cal-chip {
  display: block;
  font-size: 10.5px;
  padding: 2px 5px;
  border-radius: 3px;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
  cursor: pointer;
}
.cal-chip.pending   { background: var(--status-pending-bg); color: var(--status-pending-fg); }
.cal-chip.approved  { background: var(--status-approved-bg); color: var(--status-approved-fg); }
.cal-chip.scheduled { background: var(--status-scheduled-bg); color: var(--status-scheduled-fg); }
.cal-chip.published { background: var(--status-published-bg); color: var(--status-published-fg); }
.cal-chip.failed    { background: var(--status-failed-bg); color: var(--status-failed-fg); }

/* ─── View toggle ─── */
.view-toggle {
  display: inline-flex;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-sm);
  padding: 2px;
}
.view-toggle button {
  background: transparent;
  border: 0;
  color: var(--fg-muted);
  padding: 4px 10px;
  font-size: 11.5px;
  cursor: pointer;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: inherit;
}
.view-toggle button.active {
  background: var(--bg-elevated);
  color: var(--fg);
}

/* ─── Kanban ─── */
.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}
.kanban-col {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 400px;
}
.kanban-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 500;
}
.kanban-head .count {
  font-family: var(--font-mono);
  color: var(--fg-subtle);
  margin-left: auto;
  font-size: 11px;
}
.kanban-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  overflow-y: auto;
}
.kanban-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  padding: 10px;
  cursor: pointer;
  transition: border-color 0.1s;
}
.kanban-card:hover { border-color: var(--border-strong); }
.kanban-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--fg-subtle);
}
.kanban-card-text {
  font-size: 12px;
  line-height: 1.45;
  color: var(--fg);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.kanban-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 10.5px;
  font-family: var(--font-mono);
  color: var(--fg-subtle);
}

/* ─── Misc ─── */
.divider { height: 1px; background: var(--border-subtle); margin: 16px 0; }
.empty {
  padding: 40px;
  text-align: center;
  color: var(--fg-subtle);
  font-size: 12.5px;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.switch {
  width: 30px; height: 16px;
  background: var(--bg-elevated);
  border-radius: 999px;
  position: relative;
  cursor: pointer;
  border: 1px solid var(--border);
  flex: 0 0 auto;
}
.switch::after {
  content: "";
  position: absolute;
  top: 1px; left: 1px;
  width: 12px; height: 12px;
  background: var(--fg-muted);
  border-radius: 50%;
  transition: all 0.15s;
}
.switch.on { background: var(--accent); border-color: var(--accent); }
.switch.on::after { left: 15px; background: var(--accent-fg); }

.kbd {
  display: inline-block;
  padding: 1px 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  border-radius: 4px;
  color: var(--fg-muted);
}

/* ─── Tweaks panel ─── */
.tweaks {
  position: fixed;
  right: 18px; bottom: 18px;
  width: 280px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  z-index: 100;
  display: none;
  font-size: 12px;
}
.tweaks.open { display: block; }
.tweaks-head {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 600;
  font-size: 12.5px;
}
.tweaks-body { padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.tweaks-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.tweaks-label {
  font-size: 11.5px;
  color: var(--fg-muted);
}
.swatch-row { display: flex; gap: 6px; }
.swatch {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
}
.swatch.active { border-color: var(--fg); }

/* Auto-reply is disabled for now; hide the bundled demo card. */
.split-3 > div:last-child > .card:nth-child(2) {
  display: none;
}

/* ─────────────────────────────────────────────────────────────
   Responsive — 폰 / 작은 태블릿 (모바일에서 작업용)
   ───────────────────────────────────────────────────────────── */
@media (max-width: 820px) {
  /* 앱 셸: 사이드바+메인을 세로로 쌓고 자연 스크롤 */
  .app {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  /* 사이드바 → 상단 고정 가로 네비 바(탭이 가로 스크롤) */
  .sidebar {
    flex-direction: row;
    align-items: center;
    gap: 8px;
    height: auto;
    overflow-x: auto;
    overflow-y: hidden;
    border-right: 0;
    border-bottom: 1px solid var(--border-subtle);
    padding: 8px 10px;
    position: sticky;
    top: 0;
    z-index: 50;
  }
  .sidebar-nav { flex-direction: row; gap: 4px; flex: 1; overflow-x: auto; }
  .sidebar-nav-item { white-space: nowrap; flex-shrink: 0; padding: 8px 10px; }
  .sidebar-nav-item .count { margin-left: 6px; }
  /* 상단 바를 슬림하게 유지: 부제·섹션·계정 목록은 폰에서 숨김 */
  .sidebar-brand-sub,
  .sidebar-section,
  .sidebar-accounts { display: none; }

  /* 메인 콘텐츠: 폭 꽉 채우고 패딩 축소 */
  .main { min-width: 0; }
  .content { padding: 14px 12px; }

  /* 다단 그리드 → 단일/2단으로 */
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .split-2, .split-3 { grid-template-columns: 1fr; }

  /* 툴바·버튼 묶음 줄바꿈 */
  .toolbar { flex-wrap: wrap; }
  .btn-row, .sd-actions { flex-wrap: wrap; }

  /* 표는 넘치지 않게 가로 스크롤 */
  .table { display: block; overflow-x: auto; white-space: nowrap; }

  /* 이미지·영상·캔버스가 화면을 넘지 않게 */
  img, video, canvas { max-width: 100%; height: auto; }
}

/* 아주 좁은 폰 */
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .content { padding: 12px 10px; }
}
