/* ==========================================================================
   TRACE — global layout (sidebar shell)
   Loaded from base.html. Home-page specific styles live in tickets/css/home.css
   ========================================================================== */

:root {
  --trace-blue-dark: #1e40af;
  --trace-blue: #2563eb;
  --ibe-green: #00883A;
  --sidebar-width: 280px;
  --sidebar-bg: #f8fafc;
  --sidebar-border: #e5e9f0;
  --text-main: #1d2939;
  --text-muted: #667085;
}

html { scrollbar-gutter: stable; }

@supports not (scrollbar-gutter: stable) {
  html { overflow-y: scroll; }
}

body { color: var(--text-main); }

/* ---------- Utilities preserved from the old base.html ---------- */
a.disabled {
  color: Gray;
  cursor: not-allowed;
  pointer-events: none;
}
.disabled-element { cursor: not-allowed; }

svg.markmap {
  width: 100% !important;
  height: 60vh !important;
  display: block;
  margin: 0 auto;
  padding: 0;
}

.btn-soft-neutral {
  background: #f8fafc;
  border: 1px solid #d0d5dd;
  color: #344054;
  border-radius: 999px;
  padding: 0.55rem 1rem;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  transition: all 0.18s ease;
}
.btn-soft-neutral:hover,
.btn-soft-neutral:focus {
  background: #f2f4f7;
  border-color: #98a2b3;
  color: #1d2939;
  box-shadow: 0 4px 12px rgba(16, 24, 40, 0.08);
}
.btn-soft-neutral:active {
  background: #eaecf0;
  border-color: #98a2b3;
  color: #1d2939;
}

/* ---------- App shell ---------- */
.app-shell { display: flex; min-height: 100vh; }

.main {
  flex: 1 1 auto;
  min-width: 0;               /* prevent flex overflow with wide content */
  display: flex;
  flex-direction: column;
}

/* content grows, footer sticks to the bottom of short pages */
.main > footer.mini-footer { margin-top: auto; }

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 1rem 1.1rem;
  border-bottom: 1px solid var(--sidebar-border);
}

.brand-icon {
  width: 40px;
  height: 40px;
  border-radius: .55rem;
  background: linear-gradient(135deg, var(--trace-blue-dark), var(--trace-blue));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.brand-icon-img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  display: block;
}

.brand-text { line-height: 1.15; }
.brand-text .brand-name {
  display: block;
  font-weight: 700;
  color: var(--text-main);
}
.brand-text .brand-sub {
  font-size: .72rem;
  color: var(--ibe-green);
  font-weight: 600;
  text-decoration: none;
}
.brand-text .brand-sub:hover { color: #006d2e; }

.sidebar-scroll {
  flex: 1 1 auto;
  padding: .75rem .65rem 1rem;
  overflow-y: auto;
}

.side-section-label {
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: .9rem .55rem .35rem;
}

.side-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .48rem .55rem;
  border-radius: .5rem;
  color: var(--text-main);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  transition: background .12s ease;
}
.side-link i {
  font-size: 1rem;
  color: var(--text-muted);
  width: 1.2rem;
  text-align: center;
}
.side-link:hover { background: #eef2f7; color: var(--text-main); }
.side-link.active {
  background: #e7eefc;
  color: var(--trace-blue-dark);
}
.side-link.active i { color: var(--trace-blue-dark); }

.side-link .badge-ext {
  margin-left: auto;
  font-size: .65rem;
  color: var(--text-muted);
}

/* Collapsible groups (Tickets) */
.side-group-toggle {
  cursor: pointer;
  user-select: none;
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
}
.side-group-toggle .chev {
  margin-left: auto;
  transition: transform .18s ease;
  font-size: .8rem;
  color: var(--text-muted);
}
.side-group-toggle[aria-expanded="true"] .chev { transform: rotate(90deg); }
.side-sub { padding-left: 1.5rem; }
.side-sub .side-link { font-size: .85rem; padding: .38rem .55rem; }

.sidebar-footer {
  border-top: 1px solid var(--sidebar-border);
  padding: .75rem .65rem;
}

.btn-new-ticket {
  background: linear-gradient(135deg, var(--trace-blue-dark), var(--trace-blue));
  color: #fff;
  border: 0;
  border-radius: .6rem;
  font-weight: 600;
  font-size: .9rem;
  width: 100%;
  padding: .55rem;
}
.btn-new-ticket:hover,
.btn-new-ticket:focus { color: #fff; filter: brightness(1.08); }

.sidebar-user .side-link { font-size: .85rem; }

/* ---------- Mobile topbar / offcanvas ---------- */
.mobile-topbar {
  display: flex;
  align-items: center;
  gap: .7rem;
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--sidebar-border);
  background: #fff;
  position: sticky;
  top: 0;
  z-index: 1030;
}

.offcanvas .sidebar-inner { height: 100%; }
.offcanvas .sidebar-scroll { overflow-y: auto; }

/* ---------- Footer ---------- */
footer.mini-footer {
  padding: 1.25rem 0;
  border-top: 1px solid var(--sidebar-border);
  background: #fff;
  margin-top: 3rem;
}

/* ---------- Cookie card (moved from inline styles) ---------- */
#cookieCard {
  z-index: 1090;
  max-width: 460px;
  border-radius: .75rem;
}
#cookieCard .cookie-icon { font-size: 1.5rem; }
#cookieCard .cookie-actions { margin-top: .75rem; }

@media (max-width: 576px) {
  #cookieCard {
    left: .75rem !important;
    right: .75rem !important;
    max-width: none;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .side-link,
  .side-group-toggle .chev,
  .btn-soft-neutral { transition: none; }
}