#app { width: 100%; min-height: 100vh; display: flex; flex-direction: column; background: var(--cp-bg); color: var(--cp-text); position: relative; overflow: hidden; }

/* ── login ── */
.login-wrap {
  flex: 1; display: flex; align-items: center; justify-content: center; overflow: auto; min-height: 100vh;
  padding: 24px 20px; background: url('../img/login-bg.jpg') center/cover no-repeat fixed, var(--cp-bg);
}
.login-form-wrap { width: 100%; display: flex; align-items: center; justify-content: center; }
.login-form {
  width: 100%; max-width: 400px; background: var(--cp-card); border: 1px solid var(--cp-line);
  border-radius: 28px; padding: 28px 26px; box-shadow: var(--shadow-lg);
}

/* ── shell ── */
.shell { flex: 1; min-height: 0; display: flex; flex-direction: row; }
.sidebar {
  width: 236px; flex: none; background: var(--cp-surface); border-left: 1px solid var(--cp-line);
  display: none; flex-direction: column; padding: 18px 14px; gap: 4px;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 0 6px 18px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; border-radius: 16px;
  cursor: pointer; font: inherit; font-size: 13.5px; font-weight: 500; border: none; text-align: right;
  background: transparent; color: var(--cp-text);
}
.nav-item.on { background: var(--cp-accent); color: #fffaf1; font-weight: 700; }
.nav-item .badge { background: var(--cp-accent); color: #fffaf1; font-size: 11px; min-width: 20px; height: 20px; border-radius: 999px; display: grid; place-items: center; padding: 0 6px; margin-right: auto; }
.nav-item.on .badge { background: #fffaf1; color: var(--cp-accent); }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 14px; }
.pillbtn { display: flex; align-items: center; gap: 10px; background: none; border: 1px solid var(--cp-line); border-radius: 999px; padding: 8px 12px; cursor: pointer; color: var(--cp-text); font: inherit; font-size: 13px; }
.pillbtn.danger { border-color: transparent; color: var(--cp-err); }

.main-col { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.topbar { flex: none; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--cp-line); background: var(--cp-bg); }
.topbar .title { font-family: var(--cp-display); font-size: 18px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .sub { font-size: 12px; color: var(--cp-muted); }
.user-pill { display: flex; align-items: center; gap: 9px; background: var(--cp-card); border: 1px solid var(--cp-line); border-radius: 999px; padding: 5px 12px 5px 6px; cursor: pointer; color: var(--cp-text); font: inherit; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--cp-accent-soft); color: var(--cp-accent); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }

main.screen { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 14px 12px 18px; }

.bottom-nav { flex: none; display: none; background: var(--cp-surface); border-top: 1px solid var(--cp-line); padding: 6px 4px 8px; }
.bn-item { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 2px; background: none; border: none; cursor: pointer; color: var(--cp-muted); font: inherit; }
.bn-item.on { color: var(--cp-accent); }

.drawer-backdrop { position: absolute; inset: 0; z-index: 40; display: flex; justify-content: flex-end; background: rgba(32, 30, 29, .45); animation: cpIn .16s ease; }
:root[data-theme="dark"] .drawer-backdrop { background: rgba(0, 0, 0, .55); }
.drawer { width: 82%; max-width: 300px; background: var(--cp-bg); height: 100%; padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow-lg); }

.notif-backdrop { position: absolute; inset: 0; z-index: 45; background: rgba(32, 30, 29, .4); display: flex; justify-content: flex-start; padding: 10px; animation: cpIn .16s ease; }
.notif-panel { width: 100%; max-width: 380px; max-height: 100%; overflow: auto; background: var(--cp-bg); border: 1px solid var(--cp-line); border-radius: 24px; box-shadow: var(--shadow-lg); padding: 16px; }
.notif-row { display: flex; align-items: flex-start; gap: 10px; width: 100%; text-align: right; background: none; border: none; cursor: pointer; font: inherit; color: var(--cp-text); padding: 10px 8px; border-radius: 14px; }
.notif-row:hover { background: color-mix(in srgb, var(--cp-text) 5%, transparent); }
.notif-icon { width: 34px; height: 34px; border-radius: 12px; flex: none; display: grid; place-items: center; }

.viewer-overlay { position: absolute; inset: 0; z-index: 50; background: rgba(20, 18, 24, .92); display: flex; flex-direction: column; animation: cpIn .16s ease; }

/* ── shared content utilities (used across screens) ── */
.screen-stack { display: flex; flex-direction: column; gap: 14px; }
.card-pad { padding: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.stat-card { background: var(--cp-card); border: 1px solid var(--cp-line); border-radius: 20px; padding: 14px 15px; display: flex; flex-direction: column; gap: 6px; }
.stat-card .k { display: flex; align-items: center; gap: 7px; color: var(--cp-muted); font-size: 12px; }
.stat-card .v { display: flex; align-items: baseline; gap: 6px; }
.stat-card .v b { font-family: var(--cp-display); font-size: 28px; line-height: 1; font-weight: 400; }
.stat-card .v span { font-size: 12px; color: var(--cp-muted); }
.row-item { display: flex; align-items: center; gap: 11px; padding: 11px 0; border-top: 1px solid var(--cp-line); }
.row-item:first-child { border-top: none; }
.row-item .amt { width: 44px; flex: none; text-align: center; font-family: var(--cp-display); font-size: 17px; }
.row-item .rt { flex: 1; min-width: 0; }
.row-item .rt b { display: block; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-item .rt small { display: block; font-size: 11.5px; color: var(--cp-muted); }
.empty-state { text-align: center; padding: 44px 20px; background: var(--cp-card); border: 1px dashed var(--cp-line); border-radius: 24px; }
.empty-state .ico { width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 50%; background: var(--cp-card-2); display: grid; place-items: center; color: var(--cp-muted); }
.section-title { font-family: var(--cp-display); font-size: 18px; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.chip {
  flex: none; padding: 7px 14px; border-radius: 999px; font-size: 13px; cursor: pointer; font: inherit;
  border: 1px solid var(--cp-line); background: var(--cp-card); color: var(--cp-text);
}
.chip.on { background: var(--cp-accent); color: #fffaf1; border-color: var(--cp-accent); }
.progress-track { display: block; height: 6px; border-radius: 999px; background: var(--cp-card-2); overflow: hidden; }
.progress-fill { display: block; height: 100%; border-radius: 999px; background: var(--cp-accent); transition: width .2s ease; }
.icon-badge { display: grid; place-items: center; border-radius: 12px; flex: none; }

.desktop-only { display: none; }
.mobile-only { display: inline-flex; }

/* ── responsive: desktop >= 900px ── */
@media (min-width: 900px) {
  .sidebar { display: flex; }
  .bottom-nav { display: none !important; }
  .topbar { padding: 14px 24px; }
  .topbar .title { font-size: 22px; }
  main.screen { padding: 24px; }
  .screen-stack { gap: 20px; }
  .card-pad { padding: 20px; }
  .stat-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .two-col { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); }
  .two-col.even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .desktop-only { display: block; }
  .mobile-only { display: none !important; }
}
@media (max-width: 899.98px) {
  .bottom-nav { display: flex; }
}
