/* ============================================================================
   MiniPlanner theme
   ----------------------------------------------------------------------------
   Design tokens first, Bootstrap variable overrides second, components last.
   Dark mode rides Bootstrap 5.3's native [data-bs-theme="dark"] - do not add
   body.dark-mode overrides, they were removed on purpose.

   The signature device is the CHANNEL STRIP: modules are laid out as channels
   on a pixel controller, each with its own hue from a fixed spectrum ramp. The
   hue follows a module everywhere it appears (nav, page rule, KPI accents), so
   colour is wayfinding, not decoration. Chrome stays quiet so the ramp carries
   the identity.
   ========================================================================== */

:root {
  /* Surfaces - twilight-tinted neutrals, not corporate grey */
  --mp-ink:        #16161d;
  --mp-ink-2:      #23232e;
  --mp-page:       #efeef3;
  --mp-surface:    #ffffff;
  --mp-surface-2:  #f7f6fa;
  --mp-line:       #dddbe5;
  --mp-text:       #1b1b23;
  --mp-muted:      #64637a;

  /* Channel ramp - one hue per module, spectrum order */
  --ch-people:   #c2185b;
  --ch-vendors:  #e8590c;
  --ch-tasks:    #a17c0b;
  --ch-finance:  #2e7d32;
  --ch-prizes:   #0f8b8d;
  --ch-agenda:   #1d4ed8;
  --ch-builds:   #6d28d9;
  --ch-coupons:  #a21caf;
  --ch-core:     #4b5563;

  /* Active module hue. Page templates re-point this; everything accent-coloured
     reads from it, so one attribute themes a whole page. */
  --mp-accent:     var(--ch-core);

  --mp-radius:     10px;
  --mp-radius-sm:  6px;
  --mp-shadow:     0 1px 2px rgba(22, 22, 29, .06), 0 4px 16px rgba(22, 22, 29, .06);
  --mp-shadow-lg:  0 8px 32px rgba(22, 22, 29, .12);

  --mp-font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --mp-font-body:    "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mp-font-data:    "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  /* Bootstrap overrides */
  --bs-body-bg:            var(--mp-page);
  --bs-body-color:         var(--mp-text);
  --bs-body-font-family:   var(--mp-font-body);
  --bs-border-color:       var(--mp-line);
  --bs-border-radius:      var(--mp-radius);
  --bs-border-radius-sm:   var(--mp-radius-sm);
  --bs-link-color:         var(--mp-accent);
  --bs-link-hover-color:   var(--mp-ink);
  --bs-emphasis-color:     var(--mp-ink);
  --bs-secondary-color:    var(--mp-muted);
  --bs-heading-color:      var(--mp-ink);
}

[data-bs-theme="dark"] {
  --mp-page:      #101015;
  --mp-surface:   #1a1a22;
  --mp-surface-2: #22222c;
  --mp-line:      #33323f;
  --mp-text:      #e6e5ee;
  --mp-muted:     #9997ad;

  /* Hues lift in dark mode so they keep contrast against the near-black */
  --ch-people:   #f0629b;
  --ch-vendors:  #ff9a4d;
  --ch-tasks:    #e0bb45;
  --ch-finance:  #63c168;
  --ch-prizes:   #3ec3c5;
  --ch-agenda:   #7ba0ff;
  --ch-builds:   #b18cf5;
  --ch-coupons:  #e879f9;
  --ch-core:     #a2a3b3;

  --mp-shadow:    0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  --mp-shadow-lg: 0 8px 32px rgba(0, 0, 0, .5);

  --bs-body-bg:        var(--mp-page);
  --bs-body-color:     var(--mp-text);
  --bs-border-color:   var(--mp-line);
  --bs-emphasis-color: var(--mp-text);
  --bs-heading-color:  var(--mp-text);
}

/* Module hue scopes. Set data-module on the page wrapper and every accent
   on that page follows. */
[data-module="people"]   { --mp-accent: var(--ch-people); }
[data-module="vendors"]  { --mp-accent: var(--ch-vendors); }
[data-module="tasks"]    { --mp-accent: var(--ch-tasks); }
[data-module="finance"]  { --mp-accent: var(--ch-finance); }
[data-module="prizes"]   { --mp-accent: var(--ch-prizes); }
[data-module="agenda"]   { --mp-accent: var(--ch-agenda); }
[data-module="builds"]   { --mp-accent: var(--ch-builds); }
[data-module="coupons"]  { --mp-accent: var(--ch-coupons); }
[data-module="core"]     { --mp-accent: var(--ch-core); }

/* ── Base ─────────────────────────────────────────────────────────────────── */

html { font-size: 15px; position: relative; min-height: 100%; }
@media (min-width: 768px) { html { font-size: 16px; } }

body {
  font-family: var(--mp-font-body);
  background-color: var(--mp-page);
  color: var(--mp-text);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6, .mp-display {
  font-family: var(--mp-font-display);
  font-weight: 600;
  letter-spacing: -.015em;
  color: var(--mp-ink);
}
[data-bs-theme="dark"] h1, [data-bs-theme="dark"] h2, [data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4, [data-bs-theme="dark"] h5, [data-bs-theme="dark"] h6,
[data-bs-theme="dark"] .mp-display { color: var(--mp-text); }

/* Numbers, codes, cabins, ticket numbers - anything you read as data */
.mp-data, .mp-money, td.mp-data, .mp-code {
  font-family: var(--mp-font-data);
  font-variant-numeric: tabular-nums;
  font-size: .92em;
}
.mp-code { letter-spacing: .02em; }

a { text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--mp-accent);
  outline-offset: 2px;
  border-radius: var(--mp-radius-sm);
}

/* ── Channel strip: the signature ─────────────────────────────────────────── */

.mp-channel-strip {
  height: 3px;
  width: 100%;
  background: linear-gradient(90deg,
    var(--ch-people)  0%,
    var(--ch-vendors) 14%,
    var(--ch-tasks)   28%,
    var(--ch-finance) 42%,
    var(--ch-prizes)  57%,
    var(--ch-agenda)  71%,
    var(--ch-builds)  85%,
    var(--ch-coupons) 100%);
}
.mp-channel-strip--tall { height: 6px; border-radius: 3px; }

/* ── Top bar ──────────────────────────────────────────────────────────────── */

.mp-topbar {
  background: var(--mp-ink);
  border: 0;
}
.mp-topbar .navbar-brand {
  font-family: var(--mp-font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -.02em;
  color: #fff;
}
.mp-topbar .navbar-brand:hover { color: #fff; text-decoration: none; }
.mp-topbar .nav-link,
.mp-topbar .btn-link { color: rgba(255, 255, 255, .78); }
.mp-topbar .nav-link:hover,
.mp-topbar .btn-link:hover { color: #fff; }
.mp-topbar .navbar-toggler {
  border-color: rgba(255, 255, 255, .25);
  color: rgba(255, 255, 255, .8);
}
.mp-topbar .navbar-toggler:focus { box-shadow: none; outline: 2px solid rgba(255, 255, 255, .6); }
.mp-topbar .navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba%28255,255,255,0.8%29' stroke-linecap='round' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Conference switcher - the app's core mental model, so it gets real presence */
.mp-conf-switch {
  background: rgba(255, 255, 255, .08);
  border: 1px solid rgba(255, 255, 255, .16);
  color: #fff;
  border-radius: var(--mp-radius-sm);
  padding: .3rem .7rem;
  font-size: .875rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  max-width: 100%;
}
.mp-conf-switch:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.mp-conf-switch .mp-conf-series {
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgba(255, 255, 255, .6);
}

/* ── Module nav ───────────────────────────────────────────────────────────── */

.mp-modulebar {
  background: var(--mp-surface);
  border-bottom: 1px solid var(--mp-line);
}
.mp-modulebar .nav-link {
  --mp-accent: var(--ch-core);
  color: var(--mp-muted);
  font-size: .9rem;
  font-weight: 500;
  padding: .7rem .85rem;
  border-bottom: 2px solid transparent;
  display: flex;
  align-items: center;
  gap: .45rem;
  white-space: nowrap;
}
.mp-modulebar .nav-link:hover { color: var(--mp-text); text-decoration: none; }
.mp-modulebar .nav-link .mp-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--mp-accent);
  flex-shrink: 0;
  opacity: .55;
}
.mp-modulebar .nav-link:hover .mp-dot,
.mp-modulebar .nav-link.active .mp-dot { opacity: 1; }
.mp-modulebar .nav-link.active {
  color: var(--mp-text);
  border-bottom-color: var(--mp-accent);
  font-weight: 600;
}

@media (max-width: 991.98px) {
  .mp-modulebar .nav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .mp-modulebar .nav::-webkit-scrollbar { display: none; }
  .mp-modulebar { scrollbar-width: none; }
}

/* ── Page header ──────────────────────────────────────────────────────────── */

.mp-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--mp-line);
}
.mp-page-head h1 {
  font-size: 1.6rem;
  margin: 0;
  display: flex;
  align-items: center;
  gap: .6rem;
}
.mp-page-head h1::before {
  content: "";
  width: 4px;
  height: 1.35em;
  border-radius: 2px;
  background: var(--mp-accent);
  flex-shrink: 0;
}
.mp-page-head .mp-sub {
  color: var(--mp-muted);
  font-size: .9rem;
  margin: .35rem 0 0 calc(4px + .6rem);
}
.mp-page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ── Cards ────────────────────────────────────────────────────────────────── */

.card {
  --bs-card-bg: var(--mp-surface);
  --bs-card-border-color: var(--mp-line);
  --bs-card-border-radius: var(--mp-radius);
  --bs-card-cap-bg: transparent;
  box-shadow: var(--mp-shadow);
}
.card-header {
  border-bottom: 1px solid var(--mp-line);
  font-weight: 600;
  font-family: var(--mp-font-display);
  letter-spacing: -.01em;
}

/* ── KPI tiles ────────────────────────────────────────────────────────────── */

.mp-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.mp-kpi {
  background: var(--mp-surface);
  border: 1px solid var(--mp-line);
  border-radius: var(--mp-radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--mp-shadow);
  position: relative;
  overflow: hidden;
}
.mp-kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--mp-accent);
}
.mp-kpi-value {
  font-family: var(--mp-font-data);
  font-size: 1.65rem;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  color: var(--mp-ink);
}
[data-bs-theme="dark"] .mp-kpi-value { color: var(--mp-text); }
.mp-kpi-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--mp-muted);
  margin-top: .3rem;
  font-weight: 500;
}

/* A KPI that filters the list under it. The left edge is already the module hue,
   so hover lifts the card rather than recolouring it. */
a.mp-kpi {
  display: block;
  text-decoration: none;
  color: inherit;
  transition: border-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
a.mp-kpi:hover,
a.mp-kpi:focus-visible {
  border-color: var(--mp-accent);
  box-shadow: var(--mp-shadow-lg);
  transform: translateY(-1px);
}
a.mp-kpi:focus-visible { outline: 2px solid var(--mp-accent); outline-offset: 2px; }
a.mp-kpi::before { width: 3px; }

/* The filter this list is currently showing. */
.mp-kpi.is-active {
  border-color: var(--mp-accent);
  background: color-mix(in srgb, var(--mp-accent) 7%, var(--mp-surface));
}
.mp-kpi.is-active::before { width: 5px; }
.mp-kpi-clear {
  font-size: .72rem;
  color: var(--mp-muted);
  margin-top: .35rem;
}

/* ── Buttons: quiet chrome, ink not colour ────────────────────────────────── */

.btn { --bs-btn-border-radius: var(--mp-radius-sm); font-weight: 500; }

.btn-primary {
  --bs-btn-bg: var(--mp-ink);
  --bs-btn-border-color: var(--mp-ink);
  --bs-btn-hover-bg: var(--mp-ink-2);
  --bs-btn-hover-border-color: var(--mp-ink-2);
  --bs-btn-active-bg: #000;
  --bs-btn-active-border-color: #000;
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
  --bs-btn-disabled-bg: var(--mp-muted);
  --bs-btn-disabled-border-color: var(--mp-muted);
}
[data-bs-theme="dark"] .btn-primary {
  --bs-btn-bg: var(--mp-text);
  --bs-btn-border-color: var(--mp-text);
  --bs-btn-color: var(--mp-ink);
  --bs-btn-hover-bg: #fff;
  --bs-btn-hover-border-color: #fff;
  --bs-btn-hover-color: var(--mp-ink);
}

/* The one accent-coloured button: the primary action of the current module */
.btn-accent {
  --bs-btn-bg: var(--mp-accent);
  --bs-btn-border-color: var(--mp-accent);
  --bs-btn-color: #fff;
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: color-mix(in srgb, var(--mp-accent) 85%, #000);
  --bs-btn-hover-border-color: color-mix(in srgb, var(--mp-accent) 85%, #000);
  --bs-btn-active-bg: color-mix(in srgb, var(--mp-accent) 75%, #000);
}
[data-bs-theme="dark"] .btn-accent {
  --bs-btn-color: var(--mp-ink);
  --bs-btn-hover-color: var(--mp-ink);
}

.btn-outline-secondary {
  --bs-btn-color: var(--mp-text);
  --bs-btn-border-color: var(--mp-line);
  --bs-btn-hover-bg: var(--mp-surface-2);
  --bs-btn-hover-border-color: var(--mp-muted);
  --bs-btn-hover-color: var(--mp-text);
}

/* ── Forms ────────────────────────────────────────────────────────────────── */

.form-control, .form-select {
  --bs-border-radius: var(--mp-radius-sm);
  background-color: var(--mp-surface);
  border-color: var(--mp-line);
  color: var(--mp-text);
}
.form-control:focus, .form-select:focus {
  border-color: var(--mp-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mp-accent) 18%, transparent);
  background-color: var(--mp-surface);
  color: var(--mp-text);
}
.form-label { font-weight: 500; font-size: .875rem; color: var(--mp-text); }
.form-text { color: var(--mp-muted); }

/* ── Tables ───────────────────────────────────────────────────────────────── */

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--mp-text);
  --bs-table-border-color: var(--mp-line);
  --bs-table-striped-bg: var(--mp-surface-2);
  --bs-table-striped-color: var(--mp-text);
  --bs-table-hover-bg: color-mix(in srgb, var(--mp-accent) 6%, transparent);
  --bs-table-hover-color: var(--mp-text);
}
.table > thead th {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--mp-muted);
  font-weight: 600;
  border-bottom: 1px solid var(--mp-line);
  background: transparent;
  white-space: nowrap;
}
.table > tbody td { vertical-align: middle; }

/* ── Badges / status pills ────────────────────────────────────────────────── */

.mp-badge {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .74rem;
  font-weight: 600;
  letter-spacing: .01em;
  padding: .2rem .55rem;
  border-radius: 999px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.mp-badge--neutral { background: var(--mp-surface-2); color: var(--mp-muted); border-color: var(--mp-line); }
.mp-badge--accent  { background: color-mix(in srgb, var(--mp-accent) 12%, transparent); color: var(--mp-accent); border-color: color-mix(in srgb, var(--mp-accent) 30%, transparent); }
.mp-badge--good    { background: color-mix(in srgb, var(--ch-finance) 12%, transparent); color: var(--ch-finance); border-color: color-mix(in srgb, var(--ch-finance) 30%, transparent); }
.mp-badge--warn    { background: color-mix(in srgb, var(--ch-vendors) 12%, transparent); color: var(--ch-vendors); border-color: color-mix(in srgb, var(--ch-vendors) 30%, transparent); }
.mp-badge--bad     { background: color-mix(in srgb, var(--ch-people) 12%, transparent);  color: var(--ch-people);  border-color: color-mix(in srgb, var(--ch-people) 30%, transparent); }

/* ── Auth pages ───────────────────────────────────────────────────────────── */

.mp-auth {
  min-height: calc(100vh - 190px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 0;
}
.mp-auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--mp-surface);
  border: 1px solid var(--mp-line);
  border-radius: var(--mp-radius);
  box-shadow: var(--mp-shadow-lg);
  overflow: hidden;
}
.mp-auth-card > .mp-channel-strip { height: 4px; }
.mp-auth-body { padding: 2rem; }
.mp-auth-body h1 { font-size: 1.4rem; margin-bottom: .3rem; }
.mp-auth-body .mp-sub { color: var(--mp-muted); font-size: .9rem; margin-bottom: 1.5rem; }

/* ── Empty states ─────────────────────────────────────────────────────────── */

.mp-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--mp-muted);
}
.mp-empty i { font-size: 1.75rem; opacity: .35; margin-bottom: .75rem; display: block; }
.mp-empty h3 { font-size: 1.05rem; margin-bottom: .35rem; }

/* ── Footer ───────────────────────────────────────────────────────────────── */

.mp-footer {
  border-top: 1px solid var(--mp-line);
  color: var(--mp-muted);
  font-size: .82rem;
  padding: 1rem 0;
  margin-top: 3rem;
}

/* ── DataTables: keep it in the theme ─────────────────────────────────────── */

.dt-container .dt-search input,
.dt-container .dt-length select {
  background: var(--mp-surface);
  border: 1px solid var(--mp-line);
  color: var(--mp-text);
  border-radius: var(--mp-radius-sm);
  padding: .3rem .5rem;
}
.dt-container .dt-paging .dt-paging-button.current {
  background: var(--mp-accent) !important;
  border-color: var(--mp-accent) !important;
  color: #fff !important;
  border-radius: var(--mp-radius-sm);
}
.dt-container .dt-info, .dt-container label { color: var(--mp-muted); font-size: .85rem; }

td.child { white-space: normal !important; }
td.child ul.dtr-details { width: 100%; display: block; }
td.child ul.dtr-details li {
  display: flex;
  gap: .5rem;
  border-bottom: 1px solid var(--mp-line);
  padding: .3rem 0;
}
td.child ul.dtr-details li:last-child { border-bottom: none; }
td.child ul.dtr-details span.dtr-title { font-weight: 600; min-width: 120px; flex-shrink: 0; }
td.child ul.dtr-details span.dtr-data { flex: 1; }

/* ── Motion ───────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}

/* ── Print ────────────────────────────────────────────────────────────────── */

@media print {
  .mp-topbar, .mp-modulebar, .mp-footer, .mp-page-actions { display: none !important; }
  body { background: #fff !important; color: #000 !important; }
  .card { box-shadow: none !important; border-color: #ccc !important; }
}
