/*
 * SWX Command — site theme (2026-09-14).
 *
 * The look follows Bootlab's AppStack admin template: a dark 260px sidebar
 * with Feather icons, a white navbar with a hamburger toggle, Inter, a
 * #f5f7fb canvas, white cards with a soft shadow and no border, stat cards
 * with an icon circle, #3b7ddd primary. It is written by hand against this
 * app's plain-HTML markup — no Bootstrap, no template code — so there is no
 * build step and nothing to license.
 *
 * The token names from the first version (--page, --surface, --ink-*,
 * --hairline, --border, --good/--warning/--serious/--critical, --accent) are
 * kept, remapped to the AppStack palette, because the schedule and equipment
 * pages style their own widgets with them.
 */

:root {
  --primary: #3b7ddd;  --primary-rgb: 59, 125, 221;  --primary-dark: #326abc;
  --success: #1cbb8c;  --info: #17a2b8;  --warning: #fcb92c;  --danger: #dc3545;  --orange: #fd7e14;
  --gray-100: #f8f9fa; --gray-200: #e9ecef; --gray-300: #dee2e6; --gray-400: #ced4da;
  --gray-500: #adb5bd; --gray-600: #6c757d; --gray-700: #495057; --gray-800: #343a40; --gray-900: #212529;

  --body-bg: #f5f7fb;
  --sidebar-w: 260px;
  --sidebar-bg: #222e3c;
  --sidebar-fg: rgba(233, 236, 239, .5);
  --sidebar-fg-hover: rgba(233, 236, 239, .75);
  --sidebar-fg-active: #e9ecef;
  --sidebar-header: rgba(233, 236, 239, .4);
  --card-shadow: 0 0 .875rem 0 rgba(33, 40, 50, .05);
  --navbar-shadow: 0 0 2rem 0 rgba(33, 40, 50, .1);
  --radius: .25rem;
  --radius-sm: .2rem;
  --focus-ring: 0 0 0 .2rem rgba(59, 125, 221, .25);

  /* legacy token names used by page-level styles */
  --page: var(--body-bg);  --surface: #fff;
  --ink: var(--gray-900);  --ink-2: var(--gray-700);  --ink-3: var(--gray-600);
  --hairline: var(--gray-300);  --border: rgba(0, 0, 0, .06);
  --good: var(--success);  --serious: var(--orange);  --critical: var(--danger);
  --accent: var(--primary);
}

/* ---------- reboot ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--body-bg); color: var(--gray-700);
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: .875rem; line-height: 1.5; -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--primary-dark); text-decoration: underline; }
b, strong { font-weight: 600; }
p { margin: 0 0 1rem; }
svg.feather { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
              stroke-linejoin: round; fill: none; flex: none; vertical-align: middle; }

/* ---------- shell: sidebar + main ---------- */
.wrapper { display: flex; align-items: stretch; width: 100%; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); min-width: var(--sidebar-w); background: var(--sidebar-bg);
           color: var(--sidebar-fg); transition: margin-left .35s ease-in-out; }
.sidebar-content { position: sticky; top: 0; height: 100vh; overflow-y: auto; display: flex; flex-direction: column; }
.sidebar-brand { display: flex; align-items: center; gap: .65rem; padding: 1.15rem 1.5rem;
                 font-size: 1.15rem; font-weight: 600; color: #f8f9fa; }
.sidebar-brand:hover { color: #fff; text-decoration: none; }
.sidebar-brand svg.feather { width: 30px; height: 30px; color: var(--primary); }
.sidebar-nav { list-style: none; margin: 0; padding: 0 0 1.5rem; }
.sidebar-header { padding: 1.5rem 1.5rem .375rem; font-size: .75rem; color: var(--sidebar-header); }
.sidebar-link { display: flex; align-items: center; gap: .75rem; padding: .625rem 1.625rem .625rem calc(1.625rem - 3px);
                color: var(--sidebar-fg); border-left: 3px solid transparent; transition: color .1s, background .1s; }
.sidebar-link:hover { color: var(--sidebar-fg-hover); text-decoration: none; }
.sidebar-item.active > .sidebar-link {
  color: var(--sidebar-fg-active); border-left-color: var(--primary);
  background: linear-gradient(90deg, rgba(59, 125, 221, .1) 0%, rgba(59, 125, 221, .0875) 50%, transparent 100%);
}
.sidebar-foot { margin-top: auto; padding: 1rem 1.5rem 1.25rem; font-size: .75rem; color: var(--sidebar-header); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; min-height: 100vh; }
.content { flex: 1; width: 100%; max-width: 1600px; margin: 0 auto; padding: 1.5rem 1.5rem .75rem; }
@media (min-width: 768px) { .content { padding: 2rem 2rem 1rem; } }

/* ---------- navbar ---------- */
.navbar { display: flex; align-items: center; gap: 1rem; min-height: 4rem; padding: .875rem 1.375rem;
          background: #fff; box-shadow: var(--navbar-shadow); position: relative; z-index: 2; }
.sidebar-toggle { display: flex; align-items: center; width: 26px; height: 26px; cursor: pointer;
                  border: 0; background: none; padding: 0; margin-right: .5rem; }
.sidebar-toggle:hover { background: none; }
.hamburger, .hamburger::before, .hamburger::after { background: var(--gray-800); border-radius: 1px;
                  height: 3px; width: 24px; transition: background .1s; }
.hamburger { position: relative; display: block; }
.hamburger::before, .hamburger::after { content: ""; position: absolute; left: 0; }
.hamburger::before { top: -7.5px; }
.hamburger::after { bottom: -7.5px; width: 16px; }
.navbar-title { font-weight: 600; color: var(--gray-700); flex: 1; }
.navbar-user { display: flex; align-items: center; gap: .75rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: rgba(var(--primary-rgb), .15);
          color: var(--primary); font-size: .75rem; font-weight: 600; display: flex;
          align-items: center; justify-content: center; letter-spacing: .02em; }
.navbar-user .name { color: var(--gray-900); }
.btn-link, button.btn-link { border: 0; background: none; padding: .35rem .5rem; font: inherit; color: var(--gray-600);
            cursor: pointer; display: inline-flex; align-items: center; gap: .4rem; border-radius: var(--radius-sm); }
.btn-link:hover, button.btn-link:hover { color: var(--gray-900); background: var(--gray-100); border: 0; }

.footer { background: #fff; padding: 1rem 1.375rem; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem;
          justify-content: space-between; color: var(--gray-600); font-size: .8125rem; }

/* ---------- headings ---------- */
h1 { font-size: 1.53125rem; font-weight: 400; line-height: 1.2; color: var(--gray-900); margin: 0 0 1rem; }
h1 strong { font-weight: 600; }
h2 { font-size: .925rem; font-weight: 600; color: var(--gray-700); margin: 1.5rem 0 .75rem; line-height: 1.5; }
h3 { font-size: 1rem; font-weight: 600; color: var(--gray-900); margin: 1rem 0 .5rem; }

/* ---------- stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-bottom: 1.5rem; }
.tile { position: relative; background: #fff; border-radius: var(--radius); box-shadow: var(--card-shadow);
        padding: 1.25rem 1.25rem 1.1rem; }
.tile .label { font-size: .925rem; font-weight: 600; color: var(--gray-700); padding-right: 3rem; }
.tile .value { font-size: 1.875rem; font-weight: 500; line-height: 1.2; color: var(--gray-900); margin-top: .6rem; }
.tile .sub { font-size: .8125rem; color: var(--gray-600); margin-top: .45rem; }
.tile .stat { position: absolute; top: 1rem; right: 1.25rem; width: 40px; height: 40px; border-radius: 50%;
              display: flex; align-items: center; justify-content: center;
              background: rgba(var(--primary-rgb), .15); color: var(--primary); }
.tile .stat.success { background: rgba(28, 187, 140, .15); color: var(--success); }
.tile .stat.warning { background: rgba(252, 185, 44, .2); color: #c98a00; }
.tile .stat.danger  { background: rgba(220, 53, 69, .12); color: var(--danger); }

/* ---------- cards + tables ---------- */
.card { background: #fff; border-radius: var(--radius); box-shadow: var(--card-shadow);
        margin-bottom: 1.5rem; overflow-x: auto; }
/* An <h2> directly before a card becomes that card's header: one visual card,
   the heading's shadow clipped at its bottom edge and the card's at its top so
   the seam is invisible. Browsers without :has() just show a plain heading. */
h2:has(+ .card) { position: relative; z-index: 1; margin: 1.5rem 0 0; padding: 1rem 1.25rem .5rem;
                  background: #fff; border-radius: var(--radius) var(--radius) 0 0;
                  box-shadow: var(--card-shadow); clip-path: inset(-1rem -1rem 0 -1rem); }
h2:has(+ .card) + .card { border-radius: 0 0 var(--radius) var(--radius); clip-path: inset(0 -1rem -1rem -1rem); }

table { width: 100%; border-collapse: collapse; margin: 0; }
th { text-align: left; font-weight: 600; color: var(--gray-700); padding: .75rem .75rem;
     border-bottom: 1px solid var(--gray-300); white-space: nowrap; }
td { padding: .6rem .75rem; border-bottom: 1px solid var(--gray-300); vertical-align: top; }
th:first-child, td:first-child { padding-left: 1.25rem; }
th:last-child, td:last-child { padding-right: 1.25rem; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: rgba(0, 0, 0, .025); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--gray-600); }
.empty { color: var(--gray-600); padding: 1rem 1.25rem; }

/* ---------- badges (solid, always with a text label) ---------- */
.badge { display: inline-flex; align-items: center; gap: .35rem; font-size: .75rem; font-weight: 600;
         line-height: 1; padding: .35em .55em; border-radius: var(--radius-sm); white-space: nowrap;
         color: #fff; background: var(--gray-600); }
.badge .dot { display: none; }
.badge.late { background: var(--danger); }
.badge.done { background: var(--success); }
.badge.progress { background: var(--primary); }
.badge.warn { background: var(--warning); color: var(--gray-900); }

/* ---------- filter pills ---------- */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-bottom: 1rem; }
.filters a { display: inline-block; padding: .3rem .75rem; border-radius: var(--radius-sm);
             background: #fff; border: 1px solid var(--gray-300); color: var(--gray-700); }
.filters a:hover { background: var(--gray-100); text-decoration: none; }
.filters a.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* ---------- forms ---------- */
input, select, textarea, button { font: inherit; }
input:not([type=checkbox], [type=radio], [type=hidden]), select, textarea {
  padding: .25rem .7rem; border: 1px solid var(--gray-400); border-radius: var(--radius-sm);
  background: #fff; color: var(--gray-700); line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: #9dbeee; box-shadow: var(--focus-ring); }
input[type=checkbox], input[type=radio] { accent-color: var(--primary); }
button, .btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
               padding: .25rem .7rem; border-radius: var(--radius-sm); line-height: 1.5; cursor: pointer;
               border: 1px solid var(--primary); background: var(--primary); color: #fff; }
button:hover, .btn:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; text-decoration: none; }
button:focus-visible, .btn:focus-visible { outline: 0; box-shadow: var(--focus-ring); }
.btn-light, button.btn-light { background: #fff; border-color: var(--gray-400); color: var(--gray-700); }
.btn-light:hover, button.btn-light:hover { background: var(--gray-100); border-color: var(--gray-400); color: var(--gray-900); }
.btn-lg { padding: .35rem 1rem; font-size: 1rem; }
label { color: var(--gray-700); }

/* ---------- alerts ---------- */
.flash { border-radius: var(--radius); padding: .75rem .95rem; margin-bottom: 1.5rem;
         background: var(--success); color: #fff; }
.flash.warn { background: var(--warning); color: var(--gray-900); }
.flash.err { background: var(--danger); color: #fff; }

/* ---------- sign-in page ---------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center;
        justify-content: center; padding: 2rem 1rem; }
.auth-head { text-align: center; margin-bottom: 1.5rem; }
.auth-head h1 { font-size: 1.75rem; margin-bottom: .5rem; }
.auth-head .lead { font-size: 1.09375rem; font-weight: 300; color: var(--gray-600); margin: 0; }
.auth-card { width: min(440px, 100%); padding: 2rem 2rem 1.75rem; margin-bottom: 0; overflow: visible; }
.auth-avatar { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 1.5rem;
               background: rgba(var(--primary-rgb), .15); color: var(--primary);
               display: flex; align-items: center; justify-content: center; }
.auth-avatar svg.feather { width: 34px; height: 34px; }
.auth-card label { display: block; font-size: .875rem; margin: 1rem 0 .35rem; }
.auth-card input { width: 100%; padding: .35rem 1rem; font-size: 1rem; }
.auth-card button { width: 100%; margin-top: 1.5rem; }
.auth-error { margin-top: 1rem; padding: .6rem .75rem; border-radius: var(--radius-sm);
              background: rgba(220, 53, 69, .1); color: #b02a37; }
.auth-foot { margin-top: 1.5rem; font-size: .8125rem; color: var(--gray-600); text-align: center; }

/* ---------- responsive ---------- */
@media (min-width: 992px) {
  .wrapper.sidebar-collapsed .sidebar { margin-left: calc(-1 * var(--sidebar-w)); }
}
@media (max-width: 991.98px) {
  .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 10; margin-left: calc(-1 * var(--sidebar-w));
             box-shadow: 0 0 2rem rgba(0, 0, 0, .25); }
  .wrapper.sidebar-collapsed .sidebar { margin-left: 0; }
  .content { padding: 1.25rem 1rem .5rem; }
  .navbar { padding: .75rem 1rem; }
  .navbar-user .name { display: none; }
  .tiles { gap: 1rem; }
  .footer { padding: .75rem 1rem; }
}
@media print {
  .sidebar, .navbar, .footer, .filters { display: none; }
  .card, .tile { box-shadow: none; border: 1px solid var(--gray-300); }
}

/* Reporting visuals share their source with the totals; tables work without JS. */
.report-grid-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 1.5rem; margin: 1.5rem 0; }
.report-panel { min-width: 0; padding: 1.25rem; margin: 0; }
.report-panel h2 { margin: 0 0 .35rem; }
.report-note { color: var(--gray-600); font-size: .8125rem; margin: .4rem 0 1rem; }
.report-chart { margin: 0; }
.report-chart-scroll { overflow-x: auto; }
.report-chart svg { display: block; width: 100%; height: auto; }
.report-chart svg text { fill: var(--gray-600); font: 11px Inter, sans-serif; }
.report-grid { stroke: var(--gray-200); stroke-width: 1; }
.report-tone-primary { background: var(--primary); fill: var(--primary); }
.report-tone-success { background: #168a68; fill: #168a68; }
.report-tone-danger { background: var(--danger); fill: var(--danger); }
.report-tone-warning { background: var(--orange); fill: var(--orange); }
.report-tone-muted { background: var(--gray-500); fill: var(--gray-500); }
.report-legend { display: flex; flex-wrap: wrap; gap: .5rem 1rem; font-size: .75rem; margin: 1rem 0; }
.report-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.report-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.report-chart-data { margin-top: .5rem; font-size: .8125rem; overflow-x: auto; }
.report-chart-data summary { color: var(--primary); cursor: pointer; padding: .5rem 0; }
.report-bars { list-style: none; margin: 1rem 0 0; padding: 0; }
.card > .report-bars, .card > .report-chart { margin: 1rem 1.25rem; }
.report-panel > .report-bars { margin: 1rem 0 0; }
.report-panel > .report-chart { margin: 0; }
.report-bars li { margin: 0 0 1rem; }
.report-bar-label { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-size: .8125rem; margin-bottom: .4rem; }
.report-bar-label span { overflow-wrap: anywhere; }
.report-bar-label strong { text-align: right; font-variant-numeric: tabular-nums; }
.report-bar-track { height: 9px; background: var(--gray-100); position: relative; overflow: hidden; border-radius: 2px; }
.report-bar-fill { position: absolute; height: 100%; top: 0; }
.report-bar-zero { position: absolute; height: 100%; width: 1px; background: var(--gray-400); z-index: 1; }
.report-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }
@media (max-width: 1199px) { .report-grid-layout { grid-template-columns: minmax(0, 1fr); } }
@media print { .report-chart-scroll { overflow: visible; } .report-chart svg { min-width: 0 !important; } .report-panel { break-inside: avoid; } }
