/* ============================================================
   layout.css — estructura general: topbar, sidebar, main
   ============================================================ */

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 18px;
  background: rgba(14, 17, 22, .88);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}

.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand:hover { text-decoration: none; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 9px;
  background: linear-gradient(140deg, var(--accent), #1f7f95);
  color: #05221c;
  font-weight: 800;
  font-size: .75rem;
  letter-spacing: .04em;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-size: .93rem; }
.brand-text small { color: var(--text-3); font-size: .74rem; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 16px; }

.global-progress { display: flex; align-items: center; gap: 8px; }
.global-progress-bar {
  width: 120px; height: 6px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
}
.global-progress-bar span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--blue));
  border-radius: 99px;
  transition: width .35s ease;
}
#global-progress-text { font-size: .78rem; color: var(--text-2); font-variant-numeric: tabular-nums; min-width: 34px; }

/* ---------- Shell ---------- */
.shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-h));
}

/* ---------- Sidebar ---------- */
.sidebar {
  border-right: 1px solid var(--border-soft);
  background: var(--bg-2);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
}

.sidebar-head { padding: 16px 16px 12px; border-bottom: 1px solid var(--border-soft); }
.sidebar-head h2 {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .13em;
  color: var(--text-3); margin-bottom: 10px;
}
.sidebar-head input {
  width: 100%;
  padding: 8px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
}
.sidebar-head input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sidebar-head input::placeholder { color: var(--text-3); }

.sidebar-list { flex: 1; overflow-y: auto; padding: 10px 10px 20px; }

.sidebar-foot {
  padding: 10px 16px;
  border-top: 1px solid var(--border-soft);
  font-size: .74rem;
  color: var(--text-3);
}

.sidebar-scrim { display: none; }

/* ---------- Main ---------- */
.main { min-width: 0; }
.page { max-width: 980px; margin: 0 auto; padding: 32px 28px 90px; }
.page-wide { max-width: 1180px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  :root { --sidebar-w: 260px; }
  .brand-text small { display: none; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    width: min(320px, 86vw);
    z-index: 35;
    transform: translateX(-102%);
    transition: transform .22s ease;
    box-shadow: 0 18px 50px rgba(0,0,0,.5);
  }
  .sidebar.open { transform: translateX(0); }

  .sidebar-scrim {
    display: block;
    position: fixed;
    inset: var(--topbar-h) 0 0 0;
    background: rgba(0,0,0,.55);
    z-index: 34;
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s ease;
  }
  .sidebar-scrim.open { opacity: 1; pointer-events: auto; }

  .page { padding: 22px 16px 80px; }
  .global-progress { display: none; }
  #btn-reset { display: none; }
  .switch-label { display: none; }
}

@media (min-width: 861px) {
  .only-mobile { display: none !important; }
}
