/* ============================================================================
   WorkManager - "Bahi-Khata" (ink & ledger)
   ----------------------------------------------------------------------------
   Grounded in the cloth-bound Indian account book: ruled columns, aligned
   figures, a saffron-stitched spine.

   HOW THIS FILE WORKS
   Bootstrap 5.3 resolves every component through CSS custom properties at
   runtime, so section 2 maps our tokens onto the --bs-* namespace and all 55
   templates inherit the identity without being edited. Section 3 exists
   because a handful of Bootstrap components (buttons, form focus, progress)
   compile *literal* hex into their component vars and therefore ignore
   --bs-primary; those have to be re-declared by hand.

   CONTRAST RULE - do not break this
   --wm-saffron is ~3.1:1 on paper. It is the identity accent and is used ONLY
   for non-text marks: the active-nav rail, the Day Rail now-marker, focus
   rings. Anything that carries text uses --wm-saffron-deep (~5.2:1, AA).
   Bootstrap's --bs-warning is deliberately wired to the deep stop so a badge
   can never accidentally become unreadable.
   ========================================================================== */

/* 1 -------------------------------------------------------------- TOKENS -- */

:root {
  /* surfaces & text */
  --wm-paper:        #F1F1F5;   /* app ground - cool grey-lilac, NOT cream */
  --wm-paper-2:      #E8E8F0;   /* table heads, hover, inset wells */
  --wm-card:         #FFFFFF;
  --wm-ink:          #16171F;
  --wm-muted:        #6B6D7C;
  --wm-line:         #DEDEE6;
  --wm-line-strong:  #C8C8D4;

  /* indigo - every interactive element */
  --wm-indigo:        #25286B;  /* links, active nav, text */
  --wm-indigo-solid:  #25286B;  /* button fill (always white text) */
  --wm-indigo-hover:  #1B1D50;
  --wm-indigo-soft:   #E4E5F1;  /* active nav bed */

  /* saffron - identity accent */
  --wm-saffron:       #E8710A;  /* marks only, never text */
  --wm-saffron-deep:  #C2410C;  /* when text sits on or in it */
  --wm-saffron-ring:  rgba(232, 113, 10, .32);

  /* semantics */
  --wm-red:    #B3261E;
  --wm-green:  #1E7A3C;
  --wm-teal:   #0E6B7D;

  /* Day Rail block hues, keyed to TimeBlock.block_type */
  --wm-blk-work:      #25286B;
  --wm-blk-meeting:   #B3261E;
  --wm-blk-break:     #1E7A3C;
  --wm-blk-learning:  #6A3FA0;
  --wm-blk-personal:  #C2410C;
  --wm-blk-other:     #6B6D7C;

  /* type */
  --wm-font-sans: 'Public Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --wm-font-mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Menlo, Consolas, monospace;

  /* metrics */
  --navbar-height: 52px;
  --sidebar-width: 232px;
  --wm-radius:     10px;
  --wm-shadow:     0 1px 2px rgba(22, 23, 31, .05);
  --wm-shadow-pop: 0 6px 20px rgba(22, 23, 31, .13);
}

[data-bs-theme="dark"] {
  --wm-paper:        #14161D;
  --wm-paper-2:      #232733;
  --wm-card:         #1C1F28;
  --wm-ink:          #E6E7EC;
  --wm-muted:        #9A9CAC;
  --wm-line:         #2A2E3A;
  --wm-line-strong:  #3A3F4F;

  --wm-indigo:        #A5A8F0;  /* lifted so links stay legible on dark */
  --wm-indigo-solid:  #4A4FA8;  /* still dark enough for white button text */
  --wm-indigo-hover:  #5A5FC0;
  --wm-indigo-soft:   #262B45;

  --wm-saffron:       #F08C2E;
  --wm-saffron-deep:  #C2410C;
  --wm-saffron-ring:  rgba(240, 140, 46, .34);

  --wm-red:    #FF6B6B;
  --wm-green:  #51CF66;
  --wm-teal:   #56C7DC;

  --wm-blk-work:      #7A7FD8;
  --wm-blk-meeting:   #E06A6A;
  --wm-blk-break:     #4FBF6B;
  --wm-blk-learning:  #A98BE0;
  --wm-blk-personal:  #E8934F;
  --wm-blk-other:     #7C8092;

  --wm-shadow:     0 1px 2px rgba(0, 0, 0, .4);
  --wm-shadow-pop: 0 6px 20px rgba(0, 0, 0, .55);
}

/* 2 ------------------------------------------------- BOOTSTRAP TOKEN BRIDGE -- */
/* Setting these restyles every stock component across all templates at once.  */

:root,
[data-bs-theme="light"],
[data-bs-theme="dark"] {
  --bs-body-bg:          var(--wm-paper);
  --bs-body-color:       var(--wm-ink);
  --bs-emphasis-color:   var(--wm-ink);
  --bs-secondary-color:  var(--wm-muted);
  --bs-secondary-bg:     var(--wm-paper-2);
  --bs-tertiary-bg:      var(--wm-paper-2);
  --bs-tertiary-color:   var(--wm-muted);
  --bs-border-color:     var(--wm-line);
  --bs-border-color-translucent: var(--wm-line);

  --bs-body-font-family: var(--wm-font-sans);
  --bs-body-font-size:   .875rem;          /* 14px - density for daily use */
  --bs-body-line-height: 1.55;

  --bs-border-radius:    var(--wm-radius);
  --bs-border-radius-sm: 6px;
  --bs-border-radius-lg: var(--wm-radius);
  --bs-border-radius-xl: var(--wm-radius);

  --bs-primary:      var(--wm-indigo);
  --bs-primary-rgb:  37, 40, 107;
  --bs-link-color:   var(--wm-indigo);
  --bs-link-color-rgb: 37, 40, 107;
  --bs-link-hover-color: var(--wm-indigo-hover);

  --bs-danger:  var(--wm-red);   --bs-danger-rgb:  179, 38, 30;
  --bs-success: var(--wm-green); --bs-success-rgb: 30, 122, 60;
  --bs-warning: var(--wm-saffron-deep); --bs-warning-rgb: 194, 65, 12;
  --bs-info:    var(--wm-teal);  --bs-info-rgb:    14, 107, 125;
  --bs-secondary: var(--wm-muted); --bs-secondary-rgb: 107, 109, 124;

  /* subtle/emphasis trio - alerts and .bg-*-subtle read from these */
  --bs-primary-bg-subtle: var(--wm-indigo-soft);
  --bs-primary-border-subtle: var(--wm-line-strong);
  --bs-primary-text-emphasis: var(--wm-indigo);
  --bs-danger-bg-subtle:  rgba(179, 38, 30, .10);
  --bs-danger-border-subtle: rgba(179, 38, 30, .30);
  --bs-danger-text-emphasis: var(--wm-red);
  --bs-success-bg-subtle: rgba(30, 122, 60, .10);
  --bs-success-border-subtle: rgba(30, 122, 60, .30);
  --bs-success-text-emphasis: var(--wm-green);
  --bs-warning-bg-subtle: rgba(194, 65, 12, .10);
  --bs-warning-border-subtle: rgba(194, 65, 12, .30);
  --bs-warning-text-emphasis: var(--wm-saffron-deep);
  --bs-info-bg-subtle: rgba(14, 107, 125, .10);
  --bs-info-border-subtle: rgba(14, 107, 125, .30);
  --bs-info-text-emphasis: var(--wm-teal);
}

[data-bs-theme="dark"] {
  --bs-primary-rgb: 165, 168, 240;
  --bs-link-color-rgb: 165, 168, 240;
  --bs-danger-rgb:  255, 107, 107;
  --bs-success-rgb: 81, 207, 102;
  --bs-warning-rgb: 240, 140, 46;
  --bs-warning: var(--wm-saffron);          /* deep stop is too dark on dark */
  --bs-warning-text-emphasis: var(--wm-saffron);
  --bs-info-rgb:    86, 199, 220;
  --bs-secondary-rgb: 154, 156, 172;
}

/* 3 --------------------------------- COMPONENTS THAT COMPILE LITERAL HEX -- */
/* These ignore --bs-primary because Bootstrap bakes hex into their own vars. */

.btn-primary {
  --bs-btn-color: #fff;
  --bs-btn-bg: var(--wm-indigo-solid);
  --bs-btn-border-color: var(--wm-indigo-solid);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--wm-indigo-hover);
  --bs-btn-hover-border-color: var(--wm-indigo-hover);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--wm-indigo-hover);
  --bs-btn-active-border-color: var(--wm-indigo-hover);
  --bs-btn-disabled-color: #fff;
  --bs-btn-disabled-bg: var(--wm-indigo-solid);
  --bs-btn-disabled-border-color: var(--wm-indigo-solid);
}

.btn-outline-primary {
  --bs-btn-color: var(--wm-indigo);
  --bs-btn-border-color: var(--wm-line-strong);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--wm-indigo-solid);
  --bs-btn-hover-border-color: var(--wm-indigo-solid);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--wm-indigo-hover);
  --bs-btn-active-border-color: var(--wm-indigo-hover);
  --bs-btn-disabled-color: var(--wm-muted);
  --bs-btn-disabled-border-color: var(--wm-line);
}

.btn-outline-secondary {
  --bs-btn-color: var(--wm-muted);
  --bs-btn-border-color: var(--wm-line-strong);
  --bs-btn-hover-color: var(--wm-ink);
  --bs-btn-hover-bg: var(--wm-paper-2);
  --bs-btn-hover-border-color: var(--wm-line-strong);
  --bs-btn-active-color: var(--wm-ink);
  --bs-btn-active-bg: var(--wm-paper-2);
  --bs-btn-active-border-color: var(--wm-line-strong);
}

.btn-outline-danger {
  --bs-btn-color: var(--wm-red);
  --bs-btn-border-color: var(--wm-line-strong);
  --bs-btn-hover-color: #fff;
  --bs-btn-hover-bg: var(--wm-red);
  --bs-btn-hover-border-color: var(--wm-red);
  --bs-btn-active-color: #fff;
  --bs-btn-active-bg: var(--wm-red);
  --bs-btn-active-border-color: var(--wm-red);
}

.btn {
  --bs-btn-font-family: var(--wm-font-sans);
  --bs-btn-font-size: .8125rem;
  --bs-btn-font-weight: 600;
  --bs-btn-padding-y: .375rem;
  --bs-btn-padding-x: .75rem;
  --bs-btn-border-radius: 7px;
  letter-spacing: .005em;
}

.btn-sm { --bs-btn-font-size: .75rem; --bs-btn-padding-y: .25rem; --bs-btn-padding-x: .5rem; }
.btn-link { --bs-btn-color: var(--wm-indigo); --bs-btn-hover-color: var(--wm-indigo-hover); }

.form-control, .form-select {
  background-color: var(--wm-card);
  border-color: var(--wm-line-strong);
  color: var(--wm-ink);
  border-radius: 7px;
}
.form-control:focus, .form-select:focus {
  background-color: var(--wm-card);
  border-color: var(--wm-indigo);
  color: var(--wm-ink);
  box-shadow: 0 0 0 3px var(--wm-saffron-ring);
}
.form-control::placeholder { color: var(--wm-muted); opacity: .8; }
.form-check-input:checked { background-color: var(--wm-indigo-solid); border-color: var(--wm-indigo-solid); }
.form-check-input:focus { border-color: var(--wm-indigo); box-shadow: 0 0 0 3px var(--wm-saffron-ring); }
.form-label { font-size: .75rem; font-weight: 600; color: var(--wm-muted); }

.progress { --bs-progress-bg: var(--wm-paper-2); --bs-progress-border-radius: 999px; }
.progress-bar { background-color: var(--wm-indigo-solid); }

/* Django's ERROR message tag renders `alert-error`, which Bootstrap does not
   ship. Alias it rather than changing MESSAGE_TAGS in settings. */
.alert-error {
  --bs-alert-color: var(--wm-red);
  --bs-alert-bg: rgba(179, 38, 30, .10);
  --bs-alert-border-color: rgba(179, 38, 30, .30);
  color: var(--wm-red);
  background-color: rgba(179, 38, 30, .10);
  border-color: rgba(179, 38, 30, .30);
}
.alert { border-radius: var(--wm-radius); font-size: .8125rem; }

/* Normalise the ~30 template-level `rounded-4` calls to the house radius
   instead of editing each of them. */
.rounded-4, .rounded-3 { border-radius: var(--wm-radius) !important; }
.shadow-sm { box-shadow: var(--wm-shadow) !important; }
.shadow     { box-shadow: var(--wm-shadow-pop) !important; }

/* 4 ---------------------------------------------------- BASE & TYPOGRAPHY -- */

body {
  background-color: var(--wm-paper);
  color: var(--wm-ink);
  font-family: var(--wm-font-sans);
  font-size: .875rem;
  -webkit-font-smoothing: antialiased;
}

/* The monospace is the display face - page titles and every figure share one
   voice, which is what makes the whole app read as a ledger. */
h1, h2, h3, h4, h5, h6, .wm-display {
  font-family: var(--wm-font-mono);
  font-weight: 600;
  letter-spacing: -.02em;
  color: var(--wm-ink);
}

.page-header {
  margin-bottom: 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--wm-line);   /* the ruled line */
}
.page-header h1 {
  font-size: 1.375rem;
  font-weight: 600;
  margin-bottom: 0;
  color: var(--wm-ink);
}
.page-header h1 .bi { color: var(--wm-muted); font-size: .95em; }
.page-header p { font-size: .8125rem; color: var(--wm-muted); }

/* Figures. Tabular so digits sit in fixed columns and the eye can scan down a
   money row without re-fixating. */
.wm-num, .wm-money, .stat-card .fs-2, .badge {
  font-family: var(--wm-font-mono);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}
.wm-money { text-align: right; white-space: nowrap; font-weight: 500; }
.wm-money .cur { color: var(--wm-muted); margin-right: .15em; font-weight: 400; }
.wm-num-lg { font-family: var(--wm-font-mono); font-variant-numeric: tabular-nums;
             font-size: 1.5rem; font-weight: 600; letter-spacing: -.03em; line-height: 1.1; }

/* Small uppercase mono label - the ledger column heading */
.wm-label {
  font-family: var(--wm-font-mono);
  font-size: .625rem;
  font-weight: 500;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--wm-muted);
}

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

/* 5 ------------------------------------------------------------- LAYOUT -- */

.navbar.wm-navbar {
  height: var(--navbar-height);
  min-height: var(--navbar-height);
  padding: 0;
  background: var(--wm-card);
  border-bottom: 1px solid var(--wm-line);
  box-shadow: none;
}
/* Bootstrap sets flex-wrap:wrap on the navbar container, so on a phone the
   search box dropped to a second row and was clipped by the fixed 52px height. */
.navbar.wm-navbar > .container-fluid { flex-wrap: nowrap; }
.wm-brand {
  display: flex; align-items: center; gap: .5rem;
  font-family: var(--wm-font-mono);
  font-weight: 600; font-size: .9375rem; letter-spacing: -.02em;
  color: var(--wm-ink);
}
.wm-brand:hover { color: var(--wm-ink); }
/* the stitched spine */
.wm-brand::before {
  content: ""; width: 3px; height: 18px; border-radius: 2px;
  background: var(--wm-saffron); flex: none;
}
.wm-navbar .wm-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 7px;
  border: 0; background: transparent; color: var(--wm-muted);
  position: relative;
}
.wm-navbar .wm-iconbtn:hover { background: var(--wm-paper-2); color: var(--wm-ink); }

/* Global search - now sits on a light ground, so the old white-on-blue
   treatment is gone. */
/* min-width:0 lets the flex item actually shrink; without it the input's
   intrinsic width keeps the row from fitting on a narrow screen. */
.wm-search { position: relative; flex: 1 1 auto; min-width: 0; max-width: 460px; }
.wm-search input {
  width: 100%; height: 34px;
  padding: 0 4.25rem 0 2rem;
  font-size: .8125rem;
  background: var(--wm-paper);
  border: 1px solid var(--wm-line);
  border-radius: 8px;
  color: var(--wm-ink);
}
.wm-search input::placeholder { color: var(--wm-muted); }
.wm-search input:focus {
  outline: none; background: var(--wm-card);
  border-color: var(--wm-indigo);
  box-shadow: 0 0 0 3px var(--wm-saffron-ring);
}
.wm-search .wm-search-ico {
  position: absolute; left: .625rem; top: 50%; transform: translateY(-50%);
  color: var(--wm-muted); font-size: .8125rem; pointer-events: none;
}
.wm-search kbd {
  position: absolute; right: .5rem; top: 50%; transform: translateY(-50%);
  font-family: var(--wm-font-mono); font-size: .625rem; font-weight: 500;
  padding: .15rem .3rem; border-radius: 4px;
  background: var(--wm-paper-2); color: var(--wm-muted);
  border: 1px solid var(--wm-line); pointer-events: none;
}
.wm-search input:focus ~ kbd { display: none; }
#globalSearchResults {
  background: var(--wm-card);
  border: 1px solid var(--wm-line);
  border-radius: var(--wm-radius);
  box-shadow: var(--wm-shadow-pop);
}
.search-result-item:hover { background: var(--wm-paper-2); }
.search-result-item.is-active { background: var(--wm-indigo-soft); }

.sidebar {
  position: fixed;
  top: var(--navbar-height); left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--navbar-height));
  background: var(--wm-card);
  border-right: 1px solid var(--wm-line);
  overflow-y: auto;
  z-index: 1030;
  transition: transform .18s ease;
  box-shadow: none !important;
}
.sidebar.collapsed { width: 0; overflow: hidden; border-right: 0; }

.sidebar-heading {
  font-family: var(--wm-font-mono);
  font-size: .625rem; font-weight: 500;
  letter-spacing: .11em; text-transform: uppercase;
  color: var(--wm-muted);
  padding: 0 .625rem;
  margin: 1rem 0 .25rem;
}
.sidebar .nav-link {
  position: relative;
  display: flex; align-items: center;
  color: var(--wm-ink);
  font-size: .8125rem; font-weight: 500;
  border-radius: 7px;
  padding: .4375rem .625rem;
  margin-bottom: 1px;
  transition: background .12s ease, color .12s ease;
}
.sidebar .nav-link .bi { color: var(--wm-muted); font-size: .9375rem; width: 1.25rem; }
.sidebar .nav-link:hover { background: var(--wm-paper-2); }
.sidebar .nav-link.active {
  background: var(--wm-indigo-soft);
  color: var(--wm-indigo);
  font-weight: 600;
}
.sidebar .nav-link.active .bi { color: var(--wm-indigo); }
/* the saffron rail - one of only three places the accent appears */
.sidebar .nav-link.active::before {
  content: ""; position: absolute; left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 60%; border-radius: 0 2px 2px 0;
  background: var(--wm-saffron);
}

.main-content {
  margin-top: var(--navbar-height);
  margin-left: var(--sidebar-width);
  min-height: calc(100vh - var(--navbar-height));
  transition: margin-left .18s ease;
}
.main-content.expanded { margin-left: 0; }

#wm-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 11, 16, .5);
  z-index: 1029;
  display: none;
}
#wm-backdrop.show { display: block; }

/* 6 -------------------------------------------------- CARDS, TABLES, DROPS -- */

.card {
  --bs-card-bg: var(--wm-card);
  --bs-card-border-color: var(--wm-line);
  --bs-card-border-radius: var(--wm-radius);
  --bs-card-inner-border-radius: var(--wm-radius);
  border: 1px solid var(--wm-line);
  box-shadow: var(--wm-shadow);
}
.card-header {
  background: transparent;
  border-bottom: 1px solid var(--wm-line);
  font-weight: 600;
}

/* A ledger reads by its rules, not by glow: swap the hover lift for an instant
   border change. Cards that jump under the cursor slow down grid scanning. */
.stat-card, .learning-card { border-radius: var(--wm-radius); transition: border-color .12s ease; }
.stat-card:hover, .learning-card:hover {
  transform: none;
  border-color: var(--wm-line-strong);
  box-shadow: var(--wm-shadow) !important;
}
.stat-card .stat-icon {
  width: 38px; height: 38px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; flex: none;
}

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--wm-ink);
  --bs-table-border-color: var(--wm-line);
  --bs-table-hover-bg: var(--wm-paper-2);
  --bs-table-hover-color: var(--wm-ink);
  font-size: .8125rem;
  margin-bottom: 0;
}
.table > thead > tr > th {
  font-family: var(--wm-font-mono);
  font-size: .625rem; font-weight: 500;
  letter-spacing: .1em; text-transform: uppercase;
  color: var(--wm-muted);
  background: var(--wm-paper-2);
  border-bottom: 1px solid var(--wm-line);
  padding: .5rem .625rem;
  white-space: nowrap;
}
.table > tbody > tr > td { padding: .5rem .625rem; border-color: var(--wm-line); vertical-align: middle; }
.table > tbody > tr:last-child > td { border-bottom: 0; }
/* Totals rows. Templates used `tfoot.table-light` for this, which ignored the
   theme; the distinction now comes from the tokens instead. */
.table > tfoot > tr > td, .table > tfoot > tr > th {
  background: var(--wm-paper-2);
  border-top: 2px solid var(--wm-line-strong);
  font-weight: 600;
  padding: .5rem .625rem;
}
.table > tfoot { font-variant-numeric: tabular-nums; }

.badge {
  font-weight: 600; font-size: .625rem;
  letter-spacing: .02em; padding: .3em .55em;
  border-radius: 5px;
}
.badge.rounded-pill { border-radius: 999px !important; }

/* The semantic tokens are LIFTED in dark mode so they stay legible as text on
   a dark ground - which means that as badge BACKGROUNDS they are now pale, and
   Bootstrap's default white badge text fails against them. Invert to dark ink.
   Light mode is unaffected: its semantics are deep enough for white text. */
[data-bs-theme="dark"] .badge.bg-primary,
[data-bs-theme="dark"] .badge.bg-secondary,
[data-bs-theme="dark"] .badge.bg-success,
[data-bs-theme="dark"] .badge.bg-danger,
[data-bs-theme="dark"] .badge.bg-warning,
[data-bs-theme="dark"] .badge.bg-info {
  color: #14161D;
}

.dropdown-menu {
  --bs-dropdown-bg: var(--wm-card);
  --bs-dropdown-border-color: var(--wm-line);
  --bs-dropdown-border-radius: var(--wm-radius);
  --bs-dropdown-link-color: var(--wm-ink);
  --bs-dropdown-link-hover-bg: var(--wm-paper-2);
  --bs-dropdown-link-hover-color: var(--wm-ink);
  --bs-dropdown-link-active-bg: var(--wm-indigo-soft);
  --bs-dropdown-link-active-color: var(--wm-indigo);
  --bs-dropdown-header-color: var(--wm-muted);
  --bs-dropdown-divider-bg: var(--wm-line);
  --bs-dropdown-font-size: .8125rem;
  box-shadow: var(--wm-shadow-pop);
}
.dropdown-header {
  font-family: var(--wm-font-mono);
  font-size: .625rem; letter-spacing: .11em; text-transform: uppercase;
}

.list-group {
  --bs-list-group-bg: transparent;
  --bs-list-group-border-color: var(--wm-line);
  --bs-list-group-color: var(--wm-ink);
  --bs-list-group-action-hover-bg: var(--wm-paper-2);
  --bs-list-group-action-hover-color: var(--wm-ink);
}

/* 7 ------------------------------------------------------------ DAY RAIL -- */
/* The signature. A fixed 07:00-23:00 window, so a given hour always lands at
   the same x-position and the geometry becomes learnable day to day. */

.wm-rail { margin-bottom: 1rem; }
.wm-rail__head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-bottom: .625rem;
}
.wm-rail__date {
  font-family: var(--wm-font-mono);
  font-size: 1.375rem; font-weight: 600;
  letter-spacing: -.02em; margin: 0; color: var(--wm-ink);
}
.wm-rail__now {
  font-family: var(--wm-font-mono);
  font-size: .75rem; font-variant-numeric: tabular-nums;
  color: var(--wm-muted); white-space: nowrap;
}
.wm-rail__now b { color: var(--wm-saffron-deep); font-weight: 600; }
[data-bs-theme="dark"] .wm-rail__now b { color: var(--wm-saffron); }

.wm-rail__scale { position: relative; height: 14px; margin-bottom: 2px; }
.wm-rail__hour {
  position: absolute; top: 0;
  font-family: var(--wm-font-mono);
  font-size: .625rem; font-variant-numeric: tabular-nums;
  color: var(--wm-muted);
  transform: translateX(-50%);
  user-select: none;
}
/* The 07 and 23 labels sit at 0% and 100%; centring them there would push half
   of each outside the track and trigger horizontal page scroll. */
.wm-rail__hour:first-child { transform: translateX(0); }
.wm-rail__hour:last-child  { transform: translateX(-100%); }

.wm-rail__track {
  position: relative;
  height: 46px;
  background: var(--wm-card);
  border: 1px solid var(--wm-line);
  border-radius: 8px;
  overflow: hidden;
}
/* hour gridlines, drawn every 2h to match the scale labels */
.wm-rail__grid {
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(
    to right,
    var(--wm-line) 0 1px,
    transparent 1px calc(100% / 8)
  );
  opacity: .7; pointer-events: none;
}
.wm-rail__block {
  position: absolute; top: 6px; bottom: 6px;
  min-width: 3px;
  border-radius: 5px;
  background: var(--wm-blk-other);
  display: flex; align-items: center;
  padding: 0 .4rem;
  overflow: hidden;
  color: #fff;
  font-size: .6875rem; font-weight: 600;
}
/* A flex child will not shrink below its intrinsic width without min-width:0,
   which is why a long title in a short block was cut mid-word with no ellipsis. */
.wm-rail__label {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.wm-rail__block[data-block-type="work"]     { background: var(--wm-blk-work); }
.wm-rail__block[data-block-type="meeting"]  { background: var(--wm-blk-meeting); }
.wm-rail__block[data-block-type="break"]    { background: var(--wm-blk-break); }
.wm-rail__block[data-block-type="learning"] { background: var(--wm-blk-learning); }
.wm-rail__block[data-block-type="personal"] { background: var(--wm-blk-personal); }
.wm-rail__block[data-block-type="other"]    { background: var(--wm-blk-other); }
[data-bs-theme="dark"] .wm-rail__block { color: #14161D; }

/* the now-marker - the second of three saffron appearances */
.wm-rail__nowmark {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--wm-saffron);
  z-index: 3; pointer-events: none;
  transition: left .5s linear;
}
.wm-rail__nowmark::before {
  content: ""; position: absolute; top: -1px; left: 50%;
  transform: translateX(-50%);
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--wm-saffron);
}
.wm-rail__empty {
  display: flex; align-items: center; justify-content: center;
  height: 100%; gap: .4rem;
  font-size: .75rem; color: var(--wm-muted);
}

.wm-rail__legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .75rem;
  margin-top: .5rem;
}
.wm-chip {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .75rem; color: var(--wm-ink);
  background: var(--wm-card);
  border: 1px solid var(--wm-line);
  border-radius: 999px;
  padding: .1875rem .5rem .1875rem .4rem;
  max-width: 100%;
}
.wm-chip:hover { border-color: var(--wm-line-strong); color: var(--wm-ink); }
.wm-chip__dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--wm-muted); }
.wm-chip__dot[data-priority="urgent"] { background: var(--wm-red); }
.wm-chip__dot[data-priority="high"]   { background: var(--wm-saffron-deep); }
.wm-chip__dot[data-priority="medium"] { background: var(--wm-teal); }
.wm-chip__dot[data-priority="low"]    { background: var(--wm-green); }
.wm-chip__text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 15rem; }

/* The day's figures as one ruled summary line rather than a grid of seven
   cards - the counts stay available without competing with the rail. */
.wm-summary {
  display: flex; flex-wrap: wrap;
  gap: .375rem 1.75rem;
  margin-top: .875rem; padding-top: .75rem;
  border-top: 1px solid var(--wm-line);
}
.wm-summary__item { display: flex; align-items: baseline; gap: .4rem; }
.wm-summary__val {
  font-family: var(--wm-font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 1rem; font-weight: 600; letter-spacing: -.02em;
  color: var(--wm-ink);
}

/* money band */
.wm-ledger { width: 100%; font-size: .8125rem; }
.wm-ledger th { padding-bottom: .375rem; border-bottom: 1px solid var(--wm-line); }
.wm-ledger td { padding: .4375rem 0; border-bottom: 1px solid var(--wm-line); }
.wm-ledger tr:last-child td { border-bottom: 0; }
.wm-ledger .wm-ref { font-family: var(--wm-font-mono); font-size: .75rem; color: var(--wm-muted); }
/* One treatment for "due in N days" and "N days overdue" - colour is the only
   thing that should differ between them, not casing and letter-spacing. */
.wm-due {
  font-family: var(--wm-font-mono);
  font-variant-numeric: tabular-nums;
  font-size: .6875rem;
  color: var(--wm-muted);
  white-space: nowrap;
}
.wm-due--over { color: var(--wm-red); font-weight: 600; }
.wm-ledger__total {
  font-family: var(--wm-font-mono); font-variant-numeric: tabular-nums;
  font-size: 1.375rem; font-weight: 600; letter-spacing: -.03em;
}
.wm-overdue { color: var(--wm-red); font-weight: 600; }

/* 8 --------------------------------------------------- KANBAN & PRIORITY -- */

.kanban-col {
  min-height: 480px;
  border-radius: var(--wm-radius);
  background: var(--wm-card);
  border: 1px solid var(--wm-line);
  box-shadow: none !important;
  overflow: hidden;
}
.kanban-col-header {
  display: flex; align-items: center; gap: .5rem;
  padding: .625rem .75rem;
  border-bottom: 1px solid var(--wm-line);
  background: var(--wm-paper-2);
  border-radius: 0;
  font-family: var(--wm-font-mono);
  font-size: .6875rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--wm-ink);
}
.kanban-col-header .wm-dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.kanban-col-header .wm-dot[data-col="todo"]        { background: var(--wm-muted); }
.kanban-col-header .wm-dot[data-col="in_progress"] { background: var(--wm-indigo); }
.kanban-col-header .wm-dot[data-col="done"]        { background: var(--wm-green); }
.kanban-col-header .wm-count {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  color: var(--wm-muted);
}
.kanban-card {
  background: var(--wm-card);
  border: 1px solid var(--wm-line);
  border-radius: 8px;
  padding: .625rem;
  margin-bottom: .375rem;
  cursor: grab;
  transition: border-color .12s ease;
}
.kanban-card:hover { transform: none; box-shadow: none; border-color: var(--wm-line-strong); }
.kanban-card.sortable-ghost { opacity: .35; background: var(--wm-indigo-soft); }
.kanban-card.sortable-chosen { cursor: grabbing; box-shadow: var(--wm-shadow-pop); }

.priority-low    { border-left: 3px solid var(--wm-green) !important; }
.priority-medium { border-left: 3px solid var(--wm-teal) !important; }
.priority-high   { border-left: 3px solid var(--wm-saffron-deep) !important; }
.priority-urgent { border-left: 3px solid var(--wm-red) !important; }

.time-block { border-radius: 6px; padding: .5rem .75rem; margin-bottom: .375rem; color: #fff; font-size: .8125rem; }

/* 9 ------------------------------------------------ FOCUS, MOTION, SCROLL -- */

/* the third and last saffron appearance */
:focus-visible {
  outline: 2px solid var(--wm-saffron);
  outline-offset: 2px;
  border-radius: 4px;
}
.btn:focus-visible, .form-control:focus-visible, .form-select:focus-visible { outline-offset: 1px; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--wm-line-strong); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--wm-muted); }

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

/* 10 ------------------------------------------------------------ MOBILE -- */
/* The old rule parked the sidebar at translateX(-100%) and relied on a
   `.mobile-open` class that nothing ever added, so there was no navigation at
   all below the breakpoint. wm-app.js now toggles it. */

@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-width); }
  .sidebar.mobile-open { transform: translateX(0); box-shadow: var(--wm-shadow-pop) !important; }
  .sidebar.collapsed { width: var(--sidebar-width); }   /* desktop-only concept */
  .main-content, .main-content.expanded { margin-left: 0; }
  .wm-search { max-width: none; }
  .wm-search kbd { display: none; }
  .wm-rail__block { font-size: 0; padding: 0; }         /* bars only - labels move to the chip row */
  .wm-rail__date { font-size: 1.125rem; }
}

@media (max-width: 575.98px) {
  .container-fluid { padding-left: .75rem !important; padding-right: .75rem !important; }
  .page-header h1 { font-size: 1.125rem; }
  .wm-rail__hour:nth-child(even) { display: none; }
  /* Drop the wordmark but keep the saffron spine, so the search keeps its room. */
  .wm-brand { font-size: 0; gap: 0; }
  .wm-navbar .wm-iconbtn { width: 28px; height: 28px; }
  .wm-summary { gap: .375rem 1rem; }
}
