/* ══════════════════════════════════════════════════════════════
   shell.css
   Sidebar navigation and the app shell.
   ══════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════
   SIDEBAR NAVIGATION + DASHBOARD  (v14 — "Command Deck" layout)
   Appended last so it layers over Crimson Slate. Uses the same
   --cs-accent / --cs-head-grad tokens for visual continuity.
   ═══════════════════════════════════════════════════════════════ */

/* ── Shell layout ── */
.app-shell { display: flex; align-items: flex-start; min-height: 100vh; }
.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app { max-width: 1320px; width: 100%; margin: 0 auto; padding: 22px 28px 60px; }
body.dark-mode .app-shell { background: var(--bg); }

/* ── Sidebar ── */
.sidebar {
  width: 258px; flex-shrink: 0; height: 100vh; position: sticky; top: 0;
  display: flex; flex-direction: column;
  background: var(--cs-head-grad);
  box-shadow: 4px 0 26px rgba(17,20,45,.16);
  z-index: 60; transition: width .2s ease;
  overflow-x: hidden;
}
/* Brand block: logo on top, full business name underneath (never truncated) */
.sb-brand {
  display: flex; flex-direction: column; align-items: center; gap: 9px;
  padding: 18px 14px 14px; position: relative; text-align: center;
  border-bottom: 1px solid rgba(255,255,255,.09); margin-bottom: 6px;
}
.sb-brand-logo {
  max-height: 46px; max-width: calc(100% - 6px); height: auto; width: auto;
  object-fit: contain; border-radius: 8px; box-shadow: 0 3px 12px rgba(0,0,0,.32); flex-shrink: 0;
}
.sb-brand > #brandFallbackIcon { color: #fff; font-size: 30px; }
.sb-brand-text { display: flex; flex-direction: column; align-items: center; gap: 2px; line-height: 1.25; width: 100%; min-width: 0; }
.sb-brand-text #headerBrandText {
  color: #fff; font-weight: 800; font-size: 13.5px; letter-spacing: .03em; text-transform: uppercase;
  white-space: normal; overflow-wrap: anywhere; line-height: 1.3; max-width: 100%;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.sb-brand-text .header-sub {
  color: rgba(255,255,255,.55); font-size: 9.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  background: rgba(255,255,255,.1); border-radius: 20px; padding: 1px 9px;
}
.sb-collapse-btn {
  position: absolute; top: 12px; right: 10px;
  width: 24px; height: 24px; border-radius: 7px; border: none; flex-shrink: 0;
  background: rgba(255,255,255,.1); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .2s;
}
.sb-collapse-btn:hover { background: rgba(255,255,255,.22); }

.sb-newjob { margin: 4px 14px 14px; justify-content: center; white-space: nowrap; }

.sb-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 0 10px 10px; scrollbar-width: thin; }
.sb-nav::-webkit-scrollbar { width: 5px; }
.sb-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 3px; }
.sb-section-label { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .09em; color: rgba(255,255,255,.32); padding: 14px 10px 6px; white-space: nowrap; }
.sb-section-label:first-child { padding-top: 6px; }

.sb-item {
  width: 100%; display: flex; align-items: center; gap: 11px; padding: 9px 11px; margin-bottom: 2px;
  border-radius: 10px; font-size: 13px; font-weight: 500; color: rgba(255,255,255,.72);
  white-space: nowrap; position: relative;
}
.sb-item i { font-size: 17px; width: 18px; text-align: center; flex-shrink: 0; opacity: .9; }
.sb-item:hover:not(.active) { background: rgba(255,255,255,.08); color: #fff; }
.sb-item.active { background: var(--cs-accent-grad); color: #fff; box-shadow: 0 4px 14px rgba(224,51,29,.38); }
.sb-item .tab-badge { margin-left: auto; }
.sb-item .sb-label { overflow: hidden; text-overflow: ellipsis; }

.sb-footer { padding: 12px 14px 16px; border-top: 1px solid rgba(255,255,255,.1); }
.sb-saving { display: flex; align-items: center; gap: 6px; font-size: 11px; color: rgba(255,255,255,.55); opacity: 0; transition: opacity .3s; margin-bottom: 10px; white-space: nowrap; }
.sb-footer-actions { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.sb-icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: none; background: rgba(255,255,255,.1); color: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 15px; flex-shrink: 0;
  transition: background .15s, transform .15s;
}
.sb-icon-btn:hover { background: rgba(255,255,255,.22); transform: translateY(-1px); }
.sb-icon-btn.sb-logout { margin-left: auto; color: #ffd1c9; }

/* ── Collapsed (desktop mini) mode ── */
body.sb-collapsed .sidebar { width: 74px; }
body.sb-collapsed .sb-label,
body.sb-collapsed .sb-section-label,
body.sb-collapsed .sb-brand-text,
body.sb-collapsed .sb-saving { display: none; }
body.sb-collapsed .sb-brand { justify-content: center; padding: 42px 8px 14px; }
body.sb-collapsed .sb-brand-logo { max-height: 34px; }
body.sb-collapsed .sb-collapse-btn { position: absolute; right: 50%; top: 12px; transform: translateX(50%); background: var(--cs-accent); box-shadow: 0 2px 8px rgba(0,0,0,.3); }
body.sb-collapsed .sb-collapse-btn i { transform: rotate(180deg); }
body.sb-collapsed .sb-newjob { padding: 9px; margin: 4px 10px 14px; }
body.sb-collapsed .sb-item { justify-content: center; padding: 10px; }
body.sb-collapsed .sb-item .tab-badge { position: absolute; top: 2px; right: 2px; margin: 0; }
body.sb-collapsed .sb-footer-actions { flex-wrap: wrap; justify-content: center; }
body.sb-collapsed .sb-icon-btn.sb-logout { margin-left: 0; }

/* ── Mobile topbar + off-canvas sidebar ── */
.mobile-topbar { display: none; }
.sb-overlay { display: none; }
.sb-burger { background: rgba(255,255,255,.12); border: none; color: #fff; width: 34px; height: 34px; border-radius: 9px; font-size: 18px; cursor: pointer; display: flex; align-items: center; justify-content: center; }

@media (max-width: 980px) {
  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    background: var(--cs-head-grad); height: 56px; padding: 0 14px; position: sticky; top: 0; z-index: 70;
    box-shadow: 0 4px 16px rgba(17,20,45,.2);
  }
  .mobile-topbar .header-brand { color: #fff; font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px; }
  .mobile-topbar .header-logo { height: 26px; border-radius: 6px; }
  .sidebar {
    position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%);
    box-shadow: 8px 0 30px rgba(0,0,0,.35); transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); }
  body.sb-collapsed .sidebar { width: 258px; }
  body.sb-collapsed .sb-label, body.sb-collapsed .sb-section-label, body.sb-collapsed .sb-brand-text, body.sb-collapsed .sb-saving { display: revert; }
  body.sb-collapsed .sb-brand { justify-content: flex-start; padding: 18px 14px 14px; }
  body.sb-collapsed .sb-brand-logo { max-height: 46px; }
  body.sb-collapsed .sb-item { justify-content: flex-start; padding: 9px 11px; }
  .sb-collapse-btn { display: none; }
  .sb-overlay {
    display: block; position: fixed; inset: 0; background: rgba(17,20,45,.5); backdrop-filter: blur(2px);
    opacity: 0; pointer-events: none; transition: opacity .2s ease; z-index: 55;
  }
  .sb-overlay.open { opacity: 1; pointer-events: auto; }
  .app { padding: 18px 14px 50px; }
  .page-head-newjob { display: none; }
}

/* ── Desktop page header ── */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; flex-wrap: wrap; }
.page-title { font-size: 21px; font-weight: 800; letter-spacing: -.01em; color: var(--text); }
.page-sub { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }

/* hide the generic stats/today strip on the dashboard — it has its own richer widgets */
.app.dash-active #statsRow, .app.dash-active #todayStrip { display: none; }
