/* ============================================================
   CardiBee — Logged-in App Shell
   ------------------------------------------------------------
   Sidebar (left) + top bar + main canvas, shared across:
   Dashboard, My Offers, My Cards, Profile
   ============================================================ */

body.app {
  background: var(--bg);
  min-height: 100vh;
  margin: 0;
}

.app-shell {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
}

/* ============== SIDEBAR ============== */
.sidebar {
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 28px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sb-brand {
  padding: 4px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.sb-brand .brand-mark {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--honey);
  display: grid; place-items: center;
}

.sb-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sb-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 12px 12px 6px;
}
.sb-link {
  display: flex;
  align-items: center;
  gap: 12px;
  height: 44px;
  padding: 0 12px;
  border-radius: 11px;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
  opacity: .72;
  text-decoration: none;
  transition: background .15s ease, opacity .15s ease, color .15s ease;
  position: relative;
}
.sb-link:hover {
  opacity: 1;
  background: rgba(14,22,58,.04);
}
.sb-link.active {
  background: var(--honey-soft);
  color: var(--ink);
  opacity: 1;
}
.sb-link.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 4px;
  height: 22px;
  border-radius: 0 4px 4px 0;
  background: var(--honey);
}
.sb-link .ic {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  color: inherit;
}
.sb-link .badge {
  margin-left: auto;
  background: var(--honey);
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  padding: 2px 8px;
  min-width: 22px;
  text-align: center;
}
.sb-link.active .badge {
  background: var(--ink);
  color: var(--honey);
}

.sb-cta {
  margin-top: auto;
  background: var(--ink);
  color: #fff;
  border-radius: 18px;
  padding: 20px;
  position: relative;
  overflow: hidden;
}
.sb-cta::before {
  content: "";
  position: absolute;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(245,176,39,.25), transparent 70%);
  top: -60px; right: -60px;
  filter: blur(20px);
}
.sb-cta-title {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.01em;
  display: flex; align-items: center; gap: 6px;
  position: relative;
}
.sb-cta-title .star {
  width: 18px; height: 18px;
  background: var(--honey);
  border-radius: 5px;
  display: inline-grid; place-items: center;
  color: var(--ink);
}
.sb-cta-desc {
  font-size: 12.5px;
  color: rgba(255,255,255,.65);
  margin-top: 6px;
  line-height: 1.5;
  position: relative;
}
.sb-cta-btn {
  margin-top: 14px;
  width: 100%;
  height: 36px;
  background: var(--honey);
  color: var(--ink);
  border: 0;
  border-radius: 999px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
}

/* ============== MAIN ============== */
.app-main {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* === Top bar === */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(246,242,233,.85);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
  padding: 14px 36px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.tb-search {
  flex: 1;
  min-width: 0;
  max-width: 560px;
  height: 44px;
  background: rgba(14,22,58,.04);
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: background .2s ease, border-color .2s ease;
}
.tb-search:focus-within {
  background: #fff;
  border-color: var(--honey);
}
.tb-search svg { color: var(--muted); flex-shrink: 0; }
.tb-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
}
.tb-search input::placeholder { color: rgba(14,22,58,.36); }
.tb-search kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 6px;
  background: rgba(14,22,58,.06);
  border-radius: 4px;
  color: var(--muted);
  font-weight: 600;
}

.tb-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}
.tb-icon-btn {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(14,22,58,.04);
  display: grid; place-items: center;
  color: var(--ink);
  position: relative;
  transition: background .15s ease;
  cursor: pointer;
}
.tb-icon-btn:hover { background: rgba(14,22,58,.08); }
.tb-icon-btn .dot {
  position: absolute;
  top: 8px; right: 9px;
  width: 7px; height: 7px;
  background: var(--orange);
  border-radius: 50%;
  border: 2px solid var(--bg);
}
.tb-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: rgba(14,22,58,.04);
  cursor: pointer;
  transition: background .15s ease;
}
.tb-user:hover { background: rgba(14,22,58,.08); }
.tb-user .avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--honey);
  color: var(--ink);
  display: grid; place-items: center;
  font-size: 12px;
  font-weight: 800;
}
.tb-user .who {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

/* === Page canvas === */
.canvas {
  padding: 32px 36px 80px;
  max-width: 1280px;
  width: 100%;
}

.page-head {
  margin-bottom: 32px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}
.page-head h1 {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0;
}
.page-head .sub {
  font-size: 15px;
  color: var(--muted);
  margin-top: 6px;
}
.page-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
@media (max-width: 760px) {
  .page-head {
    align-items: stretch;
    gap: 16px;
    margin-bottom: 24px;
  }
  .page-head h1 { font-size: 26px; }
  .page-head .sub { font-size: 13.5px; }
  .page-head-actions { flex-wrap: wrap; }
  .page-head-actions .btn { flex: 1 1 auto; justify-content: center; }
}

/* Section title */
.sec-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}
.sec-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
}
.sec-link {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}
.sec-link:hover { color: var(--ink); }

/* ============== Mobile collapse ============== */
@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed;
    top: 0; left: 0;
    z-index: 100;
    height: 100vh;
    width: 280px;
    transform: translateX(-100%);
    transition: transform .3s ease;
  }
  .sidebar.open { transform: translateX(0); }
  .topbar { padding: 12px 20px; }
  .canvas { padding: 24px 20px 60px; }
  .tb-user .who { display: none; }
  .tb-search kbd { display: none; }
}
