/* Sub-Blue theme -- admin-selectable alternate to the default Sub-White look
   (Admin -> Theme). Loaded AFTER style.css, and ONLY when this theme is
   active (layout.js emits this <link> conditionally), so every rule below
   takes effect only for Sub-Blue -- Sub-White's CSS and markup are
   completely untouched.

   Two parts:
   1. A neutral/brand palette shift (the original approach): surface, page,
      text, border and the --series-blue accent move from the warm
      off-white/soft-blue default to the richer blue palette the admin
      supplied as a reference. Every existing component already reads these
      through var(--...), so most of the app re-themes with no per-component
      overrides.
   2. A left sidebar + solid-blue top header (new, added per the admin's
      reference mockup). The sidebar markup itself is only emitted by
      layout.js when this theme is active (see src/views/layout.js), so it
      never appears for Sub-White. The topbar/nav rules here re-skin the
      *existing* shared topbar markup (same HTML as Sub-White uses) to a
      solid blue bar instead of the frosted-glass bar, by locally
      re-pointing the neutral custom properties within .topbar -- the
      existing .main-nav/.brand/.user-chip/.role-badge/.logout-link rules
      already read those properties, so they pick up white text
      automatically without needing their own overrides.

   Organization sidebar links (UAE/Egypt/UK/Client) all point at
   /subscriptions -- the app has no per-country deep link today, so these
   are simple shortcuts to the Subscriptions page rather than pre-filtered
   views. The sidebar is hidden below 1100px, the same breakpoint where the
   existing top nav already collapses to its mobile hamburger menu, so
   mobile navigation keeps working exactly as it does today. */

:root {
  --series-blue: #0d66e0;
  --surface-1: #fbfdff;
  --page: #d8e8fd;
  --text-primary: #0b1b2e;
  --text-secondary: #3c5674;
  --text-muted: #7489a3;
  --gridline: #cddbee;
  --baseline: #a9bfdb;
  --border: rgba(13, 37, 69, 0.14);
  /* Premium-pass tokens (design-tokens.css palette), merged into this single
     :root block rather than a second :root rule later in the file -- some
     browsers' CSSOM silently drop a second same-file :root{} ruleset, which
     made var(--db-header-gradient) etc. resolve to nothing further down. */
  --db-950: #09245b;
  --db-900: #073b91;
  --db-800: #0754c9;
  --db-700: #1166e8;
  --db-600: #1878f5;
  --db-500: #268cff;
  --db-300: #93c5fd;
  --db-100: #dbeafe;
  --db-50: #eff6ff;
  --db-shadow-card: 0 10px 32px rgba(20, 65, 132, 0.1);
  --db-shadow-card-hover: 0 16px 40px rgba(20, 65, 132, 0.16);
  --db-header-gradient: linear-gradient(105deg, #06378a 0%, #0754c9 52%, #1684f6 100%);
  --db-radius-lg: 20px;
  --db-radius-md: 14px;
  --db-radius-sm: 10px;
  /* The app's existing "Total Yearly" KPI-card icon (Subscriptions page) and
     any other spot that reads var(--series-violet) is retinted to the same
     deep blue used for the Yearly chart segment/legend dot below, so no
     violet/purple survives anywhere on the Sub-Blue surface. */
  --series-violet: #073b91;
}

/* ---- Top header: solid blue bar instead of the frosted-glass bar ---- */
.topbar {
  background: #0a52c0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: none;
  box-shadow: 0 2px 10px rgba(5, 40, 110, 0.25);
  /* Locally re-point the neutral tokens so every existing topbar child
     (brand name/small, .main-nav a, .user-chip-name, .role-badge,
     .logout-link, .nav-toggle) reads white/translucent-white through the
     var(--...) references already in style.css, with no per-class rules. */
  --text-primary: #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.92);
  --text-muted: rgba(255, 255, 255, 0.72);
  --page: rgba(255, 255, 255, 0.16);
  --border: rgba(255, 255, 255, 0.28);
  --surface-2: rgba(255, 255, 255, 0.14);
}

.topbar .brand-name { color: #ffffff; }
/* The signed-in user's name inherits body's dark text color (body resolves
   --text-primary before .topbar re-points it), so set it explicitly. Also
   applies to 9Yards Brand, which loads this file too. */
.topbar .user-chip-name { color: #ffffff; }
/* .main-nav a.active reads --series-blue directly (not a neutral token),
   so it needs its own override -- otherwise "active" text would render as
   mid-blue-on-blue and disappear. */
.main-nav a.active {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}
.logout-link { color: rgba(255, 255, 255, 0.85); }
.role-badge {
  background: rgba(255, 255, 255, 0.22) !important;
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #ffffff;
}

/* ---- Left sidebar (new for this theme) ---- */
.shell-body {
  display: flex;
  align-items: flex-start;
}
.sidebar {
  width: 234px;
  flex-shrink: 0;
  box-sizing: border-box;
  background: var(--surface-1);
  border-right: 1px solid var(--border);
  min-height: calc(100vh - 60px);
  padding: 18px 12px 20px;
  position: sticky;
  top: 60px;
  align-self: flex-start;
}
.shell-body .content { flex: 1; min-width: 0; }
.sidebar-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 10px;
  margin: 18px 0 8px;
}
.sidebar-section-label:first-child { margin-top: 4px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 13.5px;
  text-decoration: none;
}
.sidebar-nav a svg { width: 17px; height: 17px; flex-shrink: 0; }
.sidebar-nav a:hover { background: var(--page); color: var(--text-primary); }
.sidebar-nav a.active { background: var(--series-blue); color: #ffffff; }
.sidebar-footer {
  margin-top: 26px;
  padding: 14px 10px 4px;
  text-align: center;
  opacity: 0.55;
}
.sidebar-footer .brand { justify-content: center; }
.sidebar-footer .brand-name { font-size: 12.5px; }

/* Decorative skyline above the 9Yards wordmark, per the admin's reference
   image. Pure line art -- color + fade both come from here, inheriting the
   footer's existing opacity:0.55 so it reads as the same faint tint as the
   rest of the footer, not a second separately-tuned fade. */
.sidebar-skyline {
  display: block;
  width: 100%;
  height: auto;
  max-height: 56px;
  margin: 0 0 10px;
  color: var(--series-blue);
}

@media (max-width: 1100px) {
  /* Same breakpoint where the existing top nav already collapses to its
     mobile hamburger menu -- keep mobile navigation exactly as-is rather
     than cramming the sidebar in too. */
  .sidebar { display: none; }
}

/* ---- Desktop: hide the top nav links, now redundant with the sidebar ---- */
@media (min-width: 1101px) {
  /* The sidebar's MAIN section already duplicates these same links (same
     hrefs, same active-state logic) -- showing both is redundant, so hide
     the top nav here. Scoped to desktop only (min-width, the mirror of the
     1100px breakpoint above): below that width the sidebar hides itself and
     the top nav -- revealed via the existing .nav-toggle hamburger button --
     is the only navigation available, so it must stay untouched there. */
  .main-nav { display: none; }
  .nav-panel { justify-content: flex-end; }
}

/* =========================================================================
   PREMIUM BLUE REDESIGN PASS
   Admin-supplied "9yards-blue-design" package (design-tokens.css + reference
   screenshot). Everything below is an ADDITIVE visual polish on top of the
   Sub-Blue skeleton above -- no new markup is required and nothing here
   touches style.css, so Sub-White stays byte-for-byte unaffected. Rules are
   ordered so later ones in this same file win ties with earlier ones above,
   and all of them win over style.css by load order (style.css loads first).

   Palette additions, named after the admin's design-tokens.css so the two
   are easy to cross-reference; the --series-blue, --surface-1, --page,
   --text-*, --border, --db-*, --series-violet tokens are all declared in the
   single :root block near the top of this file, which also feeds the rules
   added in this section. ========== */

/* ---- Top header: premium blue gradient instead of a flat fill ---- */
.topbar {
  background: var(--db-header-gradient);
}

/* ---- Page canvas: a calm, subtle blue wash instead of the default
   theme's animated multi-hue blob gradient. Sets `animation` back to
   `none` on the same `body` selector style.css uses, which -- combined
   with this file loading after style.css -- is enough to cancel the
   keyframe animation without needing to know its exact name, and then
   replaces the background itself with a static two-stop ice-blue wash. */
body {
  animation: none;
  background: radial-gradient(1100px 620px at 14% -8%, var(--db-100) 0%, transparent 60%),
    radial-gradient(900px 560px at 100% 0%, var(--db-50) 0%, transparent 55%),
    var(--page);
  background-attachment: fixed;
}

/* ---- Cards: solid white "floating" surface with a soft blue shadow,
   replacing the frosted-glass look, per "white floating KPI cards with
   soft shadows" in the reference brief. ---- */
.card {
  background: var(--surface-1);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: 1px solid var(--border);
  border-radius: var(--db-radius-lg);
  box-shadow: var(--db-shadow-card);
  transition: box-shadow 0.18s ease, transform 0.18s ease;
}
.card:hover {
  box-shadow: var(--db-shadow-card-hover);
  transform: translateY(-1px);
}
.modal {
  background: var(--surface-1);
  box-shadow: 0 24px 64px rgba(10, 35, 80, 0.28);
}

/* ---- Stat tiles: crisper numerals, softer icon badge ring ---- */
.stat-tile .icon {
  border-radius: 11px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}
.stat-tile .value {
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

/* ---- Segmented pill filters: rounded track + premium active fill ---- */
.pill-tabs {
  background: var(--db-50);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
}
.pill-tabs button,
.pill-tabs a {
  border-radius: 999px;
  transition: background 0.15s ease, color 0.15s ease;
}
.pill-tabs .active {
  background: var(--db-header-gradient);
  color: #fff;
  box-shadow: 0 4px 12px rgba(7, 84, 201, 0.3);
}

/* ---- Primary CTA: deeper blue, premium hover/focus states ---- */
.btn-primary {
  background: var(--db-700);
  border: 0;
  border-radius: var(--db-radius-sm);
  font-weight: 650;
  box-shadow: 0 6px 16px rgba(17, 102, 232, 0.28);
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
}
.btn-primary:hover {
  background: var(--db-800);
  box-shadow: 0 8px 20px rgba(17, 102, 232, 0.36);
}
.btn-primary:active {
  transform: translateY(1px);
}
.btn-primary:focus-visible,
.btn-secondary:focus-visible,
.btn-danger:focus-visible,
.ui-input:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.icon-btn:focus-visible,
.icon-btn-text:focus-visible {
  outline: 3px solid var(--db-300);
  outline-offset: 2px;
}

/* ---- Inputs / search / toolbar: ice-blue bordered fields ---- */
input,
select,
textarea,
.toolbar .field input,
.date-input-wrap input {
  background: #fff;
  border-color: var(--border);
  border-radius: var(--db-radius-sm);
}
.toolbar .field.grow {
  border-radius: var(--db-radius-sm);
}

/* ---- Icon buttons: clean outline chrome, matching the reference's
   rounded action buttons. Danger/archive/flagged keep their existing
   semantic colors untouched -- only shape/hover polish here. ---- */
.icon-btn,
.icon-btn-text {
  border-radius: var(--db-radius-sm);
  border-color: var(--border);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover,
.icon-btn-text:hover {
  background: var(--db-50);
  border-color: var(--db-300);
}

/* ---- Tables: light ice-blue header row, calmer hover highlight ---- */
.data-table th {
  background: var(--db-50);
  color: var(--text-secondary);
  font-weight: 650;
  letter-spacing: 0.02em;
}
.data-table tr:hover td {
  background: rgba(239, 246, 255, 0.6);
}
.data-table,
.matrix-table {
  border-radius: var(--db-radius-md);
  overflow: hidden;
}

/* ---- Status/period badges: rounder chips; recolor the two
   decorative (non-semantic) period chips onto the blue family so no
   violet/purple survives anywhere in the Sub-Blue surface, matching the
   chart-color requirement in spirit. days-good/warning/critical and
   status-* keep their existing semantic colors untouched. ---- */
.badge {
  border-radius: 999px;
  font-weight: 650;
}
.badge.yearly {
  background: var(--db-100);
  color: var(--db-900);
}
.badge.monthly {
  background: var(--db-50);
  color: var(--db-800);
}

/* ---- Legend dots used beside charts: default to the blue family
   unless a row sets its own inline color (e.g. a per-series dot). ---- */
.legend-dot {
  background: var(--db-700);
}

/* ---- Section/service group headers + count badges: subtle ice tint ---- */
.section-title-row .count-badge,
.service-group-header {
  background: var(--db-50);
  border-radius: var(--db-radius-sm);
}

/* ---- Empty states: tie to the ice-blue palette ---- */
.empty-state {
  color: var(--text-muted);
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .btn-primary,
  .pill-tabs button,
  .pill-tabs a,
  .icon-btn,
  .icon-btn-text {
    transition-duration: 0.01ms !important;
  }
}

/* ---- Mobile menu panel: solid, readable sheet below the header ----
   style.css draws the opened hamburger panel as translucent white glass,
   but in this theme the menu text is white (re-pointed tokens in .topbar),
   so it was white-on-white. Give it a solid surface that matches the
   header. Also covers 9Yards Brand/Glass, which load this file too (and
   whose glass header would stop a nested backdrop blur from working). */
@media (max-width: 1100px) {
  .nav-panel {
    background: #0a4bb0;
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom: 0;
    box-shadow: 0 18px 40px rgba(5, 30, 80, 0.35);
  }
  .nav-panel .main-nav a { color: #ffffff; }
  .nav-panel .main-nav a:hover { background: rgba(255, 255, 255, 0.12); }
  .nav-panel .topbar-right { border-top-color: rgba(255, 255, 255, 0.18); }
}
