/* ═══════════════════════════════════════════════════════════════════
   DESIGN TOKENS  —  Material Design 3 adapted for dark trading UI
   ═══════════════════════════════════════════════════════════════════ */
:root {

  /* ── Color ─────────────────────────────────────────────────────── */
  --color-bg:        #17212b;   /* M3: background */
  --color-surface:   #242f3d;   /* M3: surface */
  --color-surface2:  #2b5278;   /* M3: surface variant */
  --color-outline:   #3a4a5c;   /* M3: outline */
  --color-on-bg:     #f5f5f5;   /* M3: on-background */
  --color-on-dim:    #8d9db5;   /* M3: on-surface-variant */
  --color-primary:   #5288c1;   /* M3: primary */
  --color-primary-h: #6499d1;   /* primary hover */
  --color-green:     #4caf50;
  --color-orange:    #f4a261;
  --color-red:       #e63946;

  /* legacy aliases so existing code keeps working */
  --bg:      var(--color-bg);
  --surface: var(--color-surface);
  --surface2: var(--color-surface2);
  --border:  var(--color-outline);
  --text:    var(--color-on-bg);
  --text2:   var(--color-on-dim);
  --accent:  var(--color-primary);
  --green:   var(--color-green);
  --orange:  var(--color-orange);
  --red:     var(--color-red);

  /* ── Typography  (MD3 Type Scale, min 12 px) ───────────────────── */
  /*
   *  Role           │ Size │  LH  │ Weight │ Usage
   * ────────────────┼──────┼──────┼────────┼──────────────────────────
   *  --t-display    │ 28px │ 36px │  400   │ equity total, big number
   *  --t-headline   │ 20px │ 28px │  400   │ section highlight value
   *  --t-title-lg   │ 18px │ 24px │  600   │ page header
   *  --t-title-md   │ 16px │ 24px │  500   │ sub-section title
   *  --t-title-sm   │ 14px │ 20px │  500   │ toast title, emphasis
   *  --t-label-lg   │ 14px │ 20px │  600   │ button, action label
   *  --t-label-md   │ 12px │ 16px │  600   │ badge, card-title
   *  --t-label-sm   │ 12px │ 18px │  500   │ nav tab, meta, caption
   *  --t-body-lg    │ 16px │ 24px │  400   │ form input
   *  --t-body-md    │ 14px │ 20px │  400   │ body text  ← BASE
   *  --t-body-sm    │ 12px │ 18px │  400   │ support text, secondary
   */
  --t-display:   28px;  --lh-display:  36px;
  --t-headline:  20px;  --lh-headline: 28px;
  --t-title-lg:  18px;  --lh-title-lg: 24px;
  --t-title-md:  16px;  --lh-title-md: 24px;
  --t-title-sm:  14px;  --lh-title-sm: 20px;
  --t-label-lg:  14px;  --lh-label-lg: 20px;
  --t-label-md:  12px;  --lh-label-md: 16px;
  --t-label-sm:  12px;  --lh-label-sm: 18px;
  --t-body-lg:   16px;  --lh-body-lg:  24px;
  --t-body-md:   14px;  --lh-body-md:  20px;
  --t-body-sm:   12px;  --lh-body-sm:  18px;

  /* ── Spacing (8 pt grid) ────────────────────────────────────────── */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 20px;
  --sp-6: 24px;

  /* ── Shape ──────────────────────────────────────────────────────── */
  --radius-sm:  6px;
  --radius-md:  10px;
  --radius-lg:  12px;
  --radius-xl:  16px;
  --radius-pill: 100px;

  /* ── Motion ─────────────────────────────────────────────────────── */
  --duration-short:  150ms;
  --duration-medium: 300ms;
  --easing-standard: cubic-bezier(0.2, 0, 0, 1);

  /* ── Layout ─────────────────────────────────────────────────────── */
  --nav-h: 60px;
}


/* ═══════════════════════════════════════════════════════════════════
   RESET
   ═══════════════════════════════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }


/* ═══════════════════════════════════════════════════════════════════
   BASE
   ═══════════════════════════════════════════════════════════════════ */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background:  var(--color-bg);
  color:       var(--color-on-bg);
  font-size:   var(--t-body-md);
  line-height: var(--lh-body-md);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom));
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); }
::selection { background: var(--color-primary); color: #fff; }


/* ═══════════════════════════════════════════════════════════════════
   TYPOGRAPHY UTILITIES
   (use these classes in templates for semantic sizing)
   ═══════════════════════════════════════════════════════════════════ */

/* Display — крупные числовые значения */
.type-display   { font-size: var(--t-display);  line-height: var(--lh-display);  font-weight: 400; }

/* Headline — выделенные значения секций */
.type-headline  { font-size: var(--t-headline); line-height: var(--lh-headline); font-weight: 400; }

/* Title — заголовки страниц и секций */
.type-title-lg  { font-size: var(--t-title-lg); line-height: var(--lh-title-lg); font-weight: 600; }
.type-title-md  { font-size: var(--t-title-md); line-height: var(--lh-title-md); font-weight: 500; letter-spacing: 0.01em; }
.type-title-sm  { font-size: var(--t-title-sm); line-height: var(--lh-title-sm); font-weight: 500; letter-spacing: 0.01em; }

/* Label — кнопки, бейджи, навигация */
.type-label-lg  { font-size: var(--t-label-lg); line-height: var(--lh-label-lg); font-weight: 600; letter-spacing: 0.01em; }
.type-label-md  { font-size: var(--t-label-md); line-height: var(--lh-label-md); font-weight: 600; letter-spacing: 0.04em; }
.type-label-sm  { font-size: var(--t-label-sm); line-height: var(--lh-label-sm); font-weight: 500; }

/* Body — основной и вторичный текст */
.type-body-lg   { font-size: var(--t-body-lg);  line-height: var(--lh-body-lg);  font-weight: 400; }
.type-body-md   { font-size: var(--t-body-md);  line-height: var(--lh-body-md);  font-weight: 400; }
.type-body-sm   { font-size: var(--t-body-sm);  line-height: var(--lh-body-sm);  font-weight: 400; }


/* ═══════════════════════════════════════════════════════════════════
   LAYOUT
   ═══════════════════════════════════════════════════════════════════ */
.container {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--sp-4);
}

.page-header {
  max-width: 600px;
  margin: 0 auto;
  padding: var(--sp-4) var(--sp-4) var(--sp-2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size:   var(--t-title-lg);
  font-weight: 600;
  line-height: var(--lh-title-lg);
}
.page-header a {
  font-size:   var(--t-label-sm);
  color:       var(--color-on-dim);
  text-decoration: none;
}

.row        { display: flex; gap: var(--sp-3); }
.row > *    { flex: 1; }
.divider    { height: 1px; background: var(--color-outline); margin: var(--sp-3) 0; }
hr          { border: none; border-top: 1px solid var(--color-outline); margin: var(--sp-3) 0; }


/* ═══════════════════════════════════════════════════════════════════
   COMPONENT: Card
   ═══════════════════════════════════════════════════════════════════ */
.card {
  background:    var(--color-surface);
  border-radius: var(--radius-lg);
  padding:       var(--sp-4);
  margin-bottom: var(--sp-3);
}

/* MD3: "Label Medium" — uppercase overline for card sections */
.card-title {
  font-size:      var(--t-label-md);
  line-height:    var(--lh-label-md);
  font-weight:    600;
  color:          var(--color-on-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom:  var(--sp-3);
}


/* ═══════════════════════════════════════════════════════════════════
   COMPONENT: Badge
   ═══════════════════════════════════════════════════════════════════ */
.badge {
  display:       inline-block;
  padding:       2px 8px;
  border-radius: var(--radius-pill);
  font-size:     var(--t-label-md);
  font-weight:   600;
  line-height:   var(--lh-label-md);
}
.badge-info    { background: var(--color-primary);  color: #fff; }
.badge-warning { background: var(--color-orange);   color: #1a1a1a; }
.badge-danger  { background: var(--color-red);      color: #fff; }
.badge-ok      { background: var(--color-green);    color: #fff; }


/* ═══════════════════════════════════════════════════════════════════
   COMPONENT: Button
   ═══════════════════════════════════════════════════════════════════ */
.btn {
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  gap:             var(--sp-2);
  padding:         12px var(--sp-5);
  border-radius:   var(--radius-md);
  border:          none;
  font-size:       var(--t-label-lg);
  font-weight:     600;
  line-height:     var(--lh-label-lg);
  cursor:          pointer;
  text-decoration: none;
  min-height:      44px;
  transition:      background var(--duration-short) var(--easing-standard),
                   opacity    var(--duration-short) var(--easing-standard);
}
.btn:active { opacity: 0.8; }

.btn-primary             { background: var(--color-primary);   color: #fff; width: 100%; }
.btn-primary:hover       { background: var(--color-primary-h); }
.btn-danger              { background: var(--color-red);       color: #fff; }
.btn-secondary           { background: var(--color-surface2);  color: var(--color-on-bg); }

/* Small variant — "Label Medium" */
.btn-sm {
  padding:    var(--sp-2) var(--sp-3);
  font-size:  var(--t-label-md);
  min-height: 36px;
}

/* Square icon button — used in page-header */
.btn-refresh {
  width:           32px;
  height:          32px;
  padding:         0;
  border:          none;
  border-radius:   var(--radius-sm);
  background:      var(--color-surface2);
  color:           var(--color-on-bg);
  font-size:       var(--t-body-md);
  cursor:          pointer;
  display:         inline-flex;
  align-items:     center;
  justify-content: center;
  line-height:     1;
  transition:      opacity var(--duration-short);
}
.btn-refresh:active { opacity: 0.7; }


/* ═══════════════════════════════════════════════════════════════════
   COMPONENT: Form
   ═══════════════════════════════════════════════════════════════════ */
label {
  display:       block;
  font-size:     var(--t-label-sm);
  color:         var(--color-on-dim);
  margin-bottom: var(--sp-1);
}

input[type="text"],
input[type="password"],
input[type="time"],
select,
textarea {
  width:              100%;
  background:         var(--color-bg);
  border:             1px solid var(--color-outline);
  border-radius:      var(--radius-md);
  color:              var(--color-on-bg);
  padding:            10px 12px;
  font-size:          var(--t-body-lg);
  line-height:        var(--lh-body-lg);
  margin-bottom:      var(--sp-3);
  outline:            none;
  -webkit-appearance: none;
  transition:         border-color var(--duration-short);
}
input:focus, select:focus, textarea:focus { border-color: var(--color-primary); }
select option { background: var(--color-surface); }


/* ═══════════════════════════════════════════════════════════════════
   COMPONENT: Message / Alert
   ═══════════════════════════════════════════════════════════════════ */
.msg-success,
.msg-error {
  border-radius: var(--radius-md);
  padding:       10px var(--sp-3);
  margin-bottom: var(--sp-3);
  font-size:     var(--t-body-sm);
  line-height:   var(--lh-body-sm);
}
.msg-success {
  background: rgba(76,175,80,0.12);
  border:     1px solid var(--color-green);
  color:      var(--color-green);
}
.msg-error {
  background: rgba(230,57,70,0.12);
  border:     1px solid var(--color-red);
  color:      var(--color-red);
}


/* ═══════════════════════════════════════════════════════════════════
   COMPONENT: Bottom Navigation  (MD3 Navigation Bar)
   ═══════════════════════════════════════════════════════════════════ */
.bottom-nav {
  position:       fixed;
  bottom:         0; left: 0; right: 0;
  max-width:      600px;
  margin:         0 auto;
  height:         calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background:     var(--color-surface);
  border-top:     1px solid var(--color-outline);
  display:        flex;
  z-index:        100;
}
.nav-item {
  flex:            1;
  display:         flex;
  flex-direction:  column;
  align-items:     center;
  justify-content: center;
  text-decoration: none;
  color:           var(--color-on-dim);
  font-size:       var(--t-label-sm);  /* 12px — MD3 nav label */
  font-weight:     500;
  gap:             var(--sp-1);
  min-height:      44px;
  transition:      color var(--duration-short);
}
.nav-item.active, .nav-item:active { color: var(--color-primary); }
.nav-icon { font-size: 22px; line-height: 1; }


/* ═══════════════════════════════════════════════════════════════════
   COMPONENT: Toast  (MD3 Snackbar)
   ═══════════════════════════════════════════════════════════════════ */
#toasts {
  position:       fixed;
  top:            var(--sp-4);
  left:           var(--sp-4);
  right:          var(--sp-4);
  z-index:        200;
  pointer-events: none;
  max-width:      568px;
  margin:         0 auto;
}
.toast {
  background:      var(--color-surface);
  border-radius:   var(--radius-md);
  padding:         12px var(--sp-4);
  margin-bottom:   var(--sp-2);
  border-left:     4px solid var(--color-primary);
  box-shadow:      0 4px 20px rgba(0,0,0,0.4);
  animation:       toast-in var(--duration-medium) var(--easing-standard);
  pointer-events:  auto;
  display:         flex;
  justify-content: space-between;
  align-items:     flex-start;
  gap:             var(--sp-2);
}
.toast-warning  { border-left-color: var(--color-orange); }
.toast-critical { border-left-color: var(--color-red);    }
.toast-body-wrap { flex: 1; }
.toast-title {
  font-size:   var(--t-title-sm);
  font-weight: 500;
  margin-bottom: 2px;
}
.toast-body  {
  font-size: var(--t-body-sm);
  color:     var(--color-on-dim);
}
.toast-close {
  color:     var(--color-on-dim);
  cursor:    pointer;
  font-size: var(--t-body-lg);
  line-height: 1;
}

@keyframes toast-in {
  from { transform: translateY(-12px); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}


/* ═══════════════════════════════════════════════════════════════════
   PAGE: Actions  (grid of operation buttons)
   ═══════════════════════════════════════════════════════════════════ */
.action-grid {
  display:               grid;
  grid-template-columns: 1fr 1fr;
  gap:                   10px;
  margin-bottom:         var(--sp-3);
}
.action-btn {
  background:    var(--color-surface);
  border:        1px solid var(--color-outline);
  border-radius: var(--radius-lg);
  padding:       var(--sp-4) var(--sp-3);
  display:       flex;
  flex-direction:column;
  align-items:   center;
  gap:           var(--sp-1);
  cursor:        pointer;
  color:         var(--color-on-bg);
  text-align:    center;
  min-height:    90px;
  position:      relative;
  transition:    background var(--duration-short) var(--easing-standard);
}
.action-btn:active  { background: var(--color-surface2); }
.action-btn-wide    { grid-column: span 2; flex-direction: row; justify-content: center; gap: var(--sp-3); min-height: 60px; }
.action-icon        { font-size: 26px; line-height: 1; }
.action-label       { font-size: var(--t-label-lg); font-weight: 600; }
.action-sub         { font-size: var(--t-body-sm);  color: var(--color-on-dim); line-height: 1.4; }
.action-spin        { position: absolute; top: var(--sp-2); right: var(--sp-2); font-size: var(--t-body-md); }


/* ═══════════════════════════════════════════════════════════════════
   UTILITIES
   ═══════════════════════════════════════════════════════════════════ */
.text-muted { color: var(--color-on-dim); font-size: var(--t-body-sm); }

details summary {
  cursor:      pointer;
  color:       var(--color-on-dim);
  font-size:   var(--t-body-sm);
  list-style:  none;
  padding:     var(--sp-1) 0;
}
details summary::before       { content: '▶ '; }
details[open] summary::before { content: '▼ '; }


/* ═══════════════════════════════════════════════════════════════════
   COMPONENT: Chat  (Strategist page)
   ═══════════════════════════════════════════════════════════════════ */
.chat-container  { display: flex; flex-direction: column; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.chat-msg        { display: flex; flex-direction: column; }
.chat-msg.chat-user   { align-items: flex-end; }
.chat-msg.chat-ai,
.chat-msg.chat-system { align-items: flex-start; }

.chat-role {
  font-size:     var(--t-label-sm);  /* 12px min */
  color:         var(--color-on-dim);
  margin-bottom: 3px;
  padding:       0 4px;
}
.chat-bubble-user {
  background:    var(--color-primary);
  color:         #fff;
  border-radius: 14px 14px 4px 14px;
  padding:       10px 14px;
  font-size:     var(--t-body-md);
  max-width:     85%;
  word-break:    break-word;
}
.chat-bubble-ai {
  background:    var(--color-surface);
  border-radius: 14px 14px 14px 4px;
  padding:       10px 14px;
  font-size:     var(--t-body-md);
  line-height:   1.7;
  max-width:     100%;
  white-space:   pre-wrap;
  word-break:    break-word;
}
.chat-bubble-system {
  background:    var(--color-surface);
  border-left:   3px solid var(--color-primary);
  padding:       8px 12px;
  font-size:     var(--t-body-sm);
  color:         var(--color-on-dim);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  max-width:     100%;
}
.chat-input-area {
  position:   sticky;
  bottom:     calc(var(--nav-h) + env(safe-area-inset-bottom) + 8px);
  background: var(--color-bg);
  padding:    var(--sp-2) 0 0;
}
.chat-form { display: flex; gap: var(--sp-2); align-items: flex-end; }
.chat-form textarea {
  flex:        1;
  resize:      none;
  height:      44px;
  min-height:  44px;
  max-height:  120px;
  overflow-y:  auto;
  margin-bottom: 0;
  border-radius: 22px;
  padding:     10px 16px;
  font-size:   var(--t-body-md);
}
.chat-send-btn {
  background:    var(--color-primary);
  color:         #fff;
  border:        none;
  border-radius: 22px;
  padding:       0 18px;
  height:        44px;
  cursor:        pointer;
  font-size:     18px;
  flex-shrink:   0;
  transition:    opacity var(--duration-short);
}
.chat-send-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.typing-bubble { display: flex; align-items: center; gap: 4px; padding: 10px 14px; background: var(--color-surface); border-radius: 14px 14px 14px 4px; }
.typing-dot {
  display:       inline-block;
  width: 7px; height: 7px;
  background:    var(--color-on-dim);
  border-radius: 50%;
  margin:        0 2px;
  animation:     typing-blink 1.2s infinite;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-blink {
  0%, 60%, 100% { transform: translateY(0); opacity: 1; }
  30%           { transform: translateY(-4px); opacity: 0.4; }
}


/* ═══════════════════════════════════════════════════════════════════
   COMPONENT: Status cards
   ═══════════════════════════════════════════════════════════════════ */
.status-row  { display: flex; gap: var(--sp-2); margin-bottom: var(--sp-2); }
.status-cell { flex: 1; background: var(--color-bg); border-radius: var(--radius-md); padding: var(--sp-2) var(--sp-3); }
.status-label { font-size: var(--t-label-md); color: var(--color-on-dim); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 4px; }
.status-value { font-size: var(--t-body-sm); font-weight: 500; }
.status-warn  { color: var(--color-orange); }
.status-dot   { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.status-dot-ok { background: var(--color-green); }
.status-dot-err { background: var(--color-red); }


/* ═══════════════════════════════════════════════════════════════════
   COMPONENT: Costs table
   ═══════════════════════════════════════════════════════════════════ */
.costs-row {
  display:     grid;
  grid-template-columns: 2fr 1fr 2fr 2fr 2fr;
  gap:         var(--sp-1);
  padding:     8px var(--sp-3);
  font-size:   var(--t-body-sm);
  border-bottom: 1px solid var(--color-outline);
}
.costs-row:last-child { border-bottom: none; }
.costs-header {
  background:  var(--color-bg);
  font-size:   var(--t-label-md);
  font-weight: 600;
  color:       var(--color-on-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.costs-month { background: rgba(82,136,193,0.08); }

.progress-track { height: 4px; background: var(--color-outline); border-radius: var(--radius-pill); overflow: hidden; }
.progress-bar   { height: 100%; background: var(--color-primary); border-radius: var(--radius-pill); transition: width 0.4s var(--easing-standard); }
.progress-warn  { background: var(--color-orange); }
.progress-danger{ background: var(--color-red); }


/* ═══════════════════════════════════════════════════════════════════
   COMPONENT: Lock indicator (actions page)
   ═══════════════════════════════════════════════════════════════════ */
.lock-banner {
  background:    rgba(244,162,97,0.12);
  border:        1px solid var(--color-orange);
  border-radius: var(--radius-md);
  padding:       10px var(--sp-3);
  color:         var(--color-orange);
  font-size:     var(--t-body-sm);
  margin-bottom: var(--sp-3);
  display:       flex;
  align-items:   center;
  gap:           var(--sp-2);
}
.action-btn.locked { opacity: 0.45; pointer-events: none; }


/* ═══════════════════════════════════════════════════════════════════
   COMPONENT: Notification history panel
   ═══════════════════════════════════════════════════════════════════ */
.notif-fab {
  position:   relative;
  display:    inline-flex;
  align-items: center;
  justify-content: center;
}
.notif-badge {
  position:      absolute;
  top:           -4px;
  right:         -4px;
  background:    var(--color-red);
  color:         #fff;
  font-size:     10px;
  font-weight:   700;
  width:         16px;
  height:        16px;
  border-radius: 50%;
  display:       flex;
  align-items:   center;
  justify-content: center;
  display:       none;
}
.notif-badge.visible { display: flex; }

.notif-panel {
  position:      fixed;
  bottom:        0;
  left:          0; right: 0;
  max-width:     600px;              /* #169: шириной с блок контента (.container), по центру — не во всю ширину */
  margin:        0 auto;
  max-height:    70vh;
  background:    var(--color-surface);
  border-top:    1px solid var(--color-outline);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  z-index:       150;
  overflow-y:    auto;
  transform:     translateY(100%);
  transition:    transform var(--duration-medium) var(--easing-standard);
  padding:       var(--sp-4);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + var(--sp-4));
  pointer-events: none;
}
.notif-panel.open {
  transform:     translateY(0);
  pointer-events: auto;
}

.notif-panel-header {
  display:       flex;
  justify-content: space-between;
  align-items:   center;
  margin-bottom: var(--sp-3);
}
.notif-panel-title { font-size: var(--t-title-sm); font-weight: 600; }

.notif-item {
  padding:       var(--sp-2) 0;
  border-bottom: 1px solid var(--color-outline);
}
.notif-item:last-child { border-bottom: none; }
.notif-item-title { font-size: var(--t-body-sm); font-weight: 500; }
.notif-item-body  { font-size: var(--t-body-sm); color: var(--color-on-dim); }
.notif-item-time  { font-size: var(--t-label-sm); color: var(--color-on-dim); margin-top: 2px; }
.notif-item.sev-warning .notif-item-title { color: var(--color-orange); }
.notif-item.sev-critical .notif-item-title { color: var(--color-red); }

.notif-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 149;
  display: none;
}
.notif-overlay.open { display: block; }


/* ═══════════════════════════════════════════════════════════════════
   COMPONENT: Offline indicator
   ═══════════════════════════════════════════════════════════════════ */
.offline-banner {
  position:   fixed;
  top:        0; left: 0; right: 0;
  background: var(--color-red);
  color:      #fff;
  font-size:  var(--t-label-sm);
  font-weight: 600;
  text-align: center;
  padding:    8px var(--sp-4);
  z-index:    300;
  transform:  translateY(-100%);
  transition: transform var(--duration-medium) var(--easing-standard);
}
.offline-banner.visible { transform: translateY(0); }


/* ═══════════════════════════════════════════════════════════════════
   COMPONENT: Journal filter bar
   ═══════════════════════════════════════════════════════════════════ */
.filter-bar { display: flex; gap: var(--sp-1); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.filter-chip {
  padding:       4px 12px;
  border-radius: var(--radius-pill);
  border:        1px solid var(--color-outline);
  background:    var(--color-surface);
  color:         var(--color-on-dim);
  font-size:     var(--t-label-sm);
  cursor:        pointer;
  transition:    background var(--duration-short), color var(--duration-short), border-color var(--duration-short);
  user-select:   none;
}
.filter-chip.active {
  background:    var(--color-primary);
  border-color:  var(--color-primary);
  color:         #fff;
}


/* ═══════════════════════════════════════════════════════════════════
   COMPONENT: Stats mini-grid
   ═══════════════════════════════════════════════════════════════════ */
.stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); margin-bottom: var(--sp-3); }
.stat-cell  { background: var(--color-surface); border-radius: var(--radius-md); padding: var(--sp-2) var(--sp-3); text-align: center; }
.stat-value { font-size: var(--t-title-md); font-weight: 600; line-height: 1.2; }
.stat-label { font-size: var(--t-label-sm); color: var(--color-on-dim); margin-top: 2px; }


/* ── HTMX ─────────────────────────────────────────────────────────── */
.htmx-indicator                  { display: none; }
.htmx-request .htmx-indicator    { display: inline; }
.htmx-request.htmx-indicator     { display: inline; }

@keyframes working-pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }
.working-card {
  animation:  working-pulse 2s ease-in-out infinite;
  text-align: center;
  padding:    20px 0;
  color:      var(--color-on-dim);
}
