  :root {
    --bg: #0d1117; --bg2: #161b22; --bg3: #1c2333; --border: #30363d;
    --accent: #f97316; --accent2: #fb923c; --accent-glow: rgba(249,115,22,0.25);
    --green: #22c55e; --green-dim: rgba(34,197,94,0.15);
    --red: #ef4444; --red-dim: rgba(239,68,68,0.12);
    --blue: #3b82f6; --blue-dim: rgba(59,130,246,0.12);
    --yellow: #eab308; --yellow-dim: rgba(234,179,8,0.12);
    --purple: #a855f7; --purple-dim: rgba(168,85,247,0.12);
    --babyblue: #38bdf8; --babyblue-dim: rgba(56,189,248,0.12);
    --teal: #14b8a6; --teal-dim: rgba(20,184,166,0.12);
    --orange: #f97316; --orange-dim: rgba(249,115,22,0.12);
    --text: #e6edf3; --text2: #8b949e; --text3: #484f58;
    --color-bg: var(--bg); --color-surface: var(--bg2); --color-surface-raised: var(--bg3); --color-border: var(--border);
    --color-text: var(--text); --color-text-muted: var(--text2); --color-text-subtle: var(--text3);
    --color-accent: var(--accent); --color-accent-strong: var(--accent2); --focus-ring: var(--accent-glow);
    --color-success: var(--green); --color-success-soft: var(--green-dim);
    --color-danger: var(--red); --color-danger-soft: var(--red-dim);
    --color-info: var(--blue); --color-info-soft: var(--blue-dim);
    --color-warning: var(--yellow); --color-warning-soft: var(--yellow-dim);
    --color-purple: var(--purple); --color-purple-soft: var(--purple-dim);
    --color-babyblue: var(--babyblue); --color-babyblue-soft: var(--babyblue-dim);
    --color-teal: var(--teal); --color-teal-soft: var(--teal-dim);
    --color-orange: var(--orange); --color-orange-soft: var(--orange-dim);

    /* Generic Theme Engine Customisations */
    --theme-bg-pattern: none;
    --theme-bg-pattern-size: auto;
    --theme-bg-pattern-opacity: 1;
    --theme-panel-bg: var(--color-surface, var(--bg2));
    --theme-panel-backdrop-filter: none;
    --theme-panel-border-color: var(--color-border, var(--border));
    --theme-panel-shadow: var(--shadow-card, 0 2px 12px rgba(0,0,0,0.2));
    --theme-active-shadow: none;
    --theme-pill-bg: var(--color-surface-raised, var(--bg3));
    --theme-pill-border-color: var(--color-border, var(--border));
    --theme-pill-text-color: inherit;
    --theme-card-overlay: none;
    --theme-card-overlay-blend: normal;

    /* Theme-agnostic dynamic status & category colors */
    --status-color-red: var(--color-danger, var(--red));
    --status-color-red-dim: var(--color-danger-soft, var(--red-dim));
    --status-color-green: var(--color-success, var(--green));
    --status-color-green-dim: var(--color-success-soft, var(--green-dim));
    --status-color-yellow: var(--color-warning, var(--yellow));
    --status-color-yellow-dim: var(--color-warning-soft, var(--yellow-dim));
    --status-color-purple: var(--color-purple, var(--purple));
    --status-color-purple-dim: var(--color-purple-soft, var(--purple-dim));
    --status-color-baby: var(--color-babyblue, var(--babyblue));
    --status-color-baby-dim: var(--color-babyblue-soft, var(--babyblue-dim));
    --status-color-teal: var(--color-teal, var(--teal));
    --status-color-teal-dim: var(--color-teal-soft, var(--teal-dim));
    --status-color-orange: var(--color-orange, var(--orange));
    --status-color-orange-dim: var(--color-orange-soft, var(--orange-dim));
    --status-color-alert: #dc2626;
    --status-color-alert-dim: rgba(220,38,38,0.12);
    --status-color-materials: #8b5cf6;
    --status-color-materials-dim: rgba(139,92,246,0.12);
    --status-color-quality: #06b6d4;
    --status-color-quality-dim: rgba(6,182,212,0.12);
    --status-color-production: #2563eb;
    --status-color-production-dim: rgba(37,99,235,0.12);
    --status-color-safety: #dc2626;
    --status-color-safety-dim: rgba(220,38,38,0.12);
  }

  body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    background-image: var(--bg-svg-image, var(--theme-bg-pattern, none));
    background-size: var(--bg-svg-size, var(--theme-bg-pattern-size, auto));
    background-repeat: repeat;
    opacity: var(--theme-bg-pattern-opacity, 1);
  }

  header,
  .panel,
  .card,
  .modal,
  .kpi-card,
  .issue-card,
  .log-card,
  .settings-card,
  .game-card,
  .row-panel,
  .swipe-category-panel,
  .swipe-sub-panel {
    background: var(--theme-panel-bg) !important;
    backdrop-filter: var(--theme-panel-backdrop-filter) !important;
    -webkit-backdrop-filter: var(--theme-panel-backdrop-filter) !important;
    border-color: var(--theme-panel-border-color) !important;
    box-shadow: var(--theme-panel-shadow) !important;
  }

  .row-panel::after,
  .issue-card::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: inherit;
    background: var(--theme-card-overlay, none);
    mix-blend-mode: var(--theme-card-overlay-blend, normal);
    z-index: -1;
  }

  .scope-btn.active,
  .btn-primary,
  .theme-choice.active {
    box-shadow: var(--theme-active-shadow, none) !important;
  }

  .stat-pill,
  .game-pill,
  .row-tab {
    background: var(--theme-pill-bg) !important;
    border-color: var(--theme-pill-border-color) !important;
    color: var(--theme-pill-text-color, inherit) !important;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  body { background-color: var(--color-bg, var(--bg)); color: var(--color-text, var(--text)); font-family: 'Nunito', sans-serif; min-height: 100vh; position: relative; isolation: isolate; }
  body.role-alerts-open { overflow: hidden; overscroll-behavior: none; }
  body.press-wiki-open { overflow: hidden; overscroll-behavior: none; }
  body.messaging-open { overflow: hidden; overscroll-behavior: none; }
  body.appearance-open { overflow: hidden; overscroll-behavior: none; }

  /* LOGIN */
  #login-screen { display: none; position: fixed; inset: 0; background: var(--color-bg, var(--bg)); z-index: 500; align-items: center; justify-content: center; flex-direction: column; gap: 24px; }
  #login-screen.visible { display: flex; }
  .login-card { background: var(--color-surface, var(--bg2)); border: 1px solid var(--color-border, var(--border)); border-radius: 18px; padding: 48px 40px; text-align: center; width: 360px; max-width: 95vw; box-shadow: 0 24px 80px rgba(0,0,0,0.25); }
  .login-icon { font-size: 48px; margin-bottom: 16px; }
  .login-title { font-family: 'Rajdhani', sans-serif; font-size: 28px; font-weight: 700; letter-spacing: 1px; margin-bottom: 6px; }
  .login-title span { color: var(--color-accent, var(--accent)); }
  .login-sub { font-size: 13px; color: var(--color-text-muted, var(--text2)); margin-bottom: 32px; }
  .login-error { margin-top: 12px; color: var(--color-danger, var(--red)); font-size: 12px; line-height: 1.4; }
  .google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; background: white; color: #1f2937; border: 1px solid var(--color-border, var(--border)); border-radius: 8px; padding: 12px 24px; font-family: 'Nunito', sans-serif; font-size: 15px; font-weight: 700; cursor: pointer; width: 100%; transition: all 0.15s; }
  .google-btn:hover { background: #f3f4f6; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0,0,0,0.3); }
  .google-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
  .google-logo { width: 20px; height: 20px; }
  .demo-login-btn {
    margin-top: 10px;
    width: 100%;
    border: 1px solid var(--color-border, var(--border));
    background: var(--color-surface-raised, var(--bg3));
    color: var(--color-text, var(--text));
    border-radius: 8px;
    padding: 11px 24px;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.15s;
  }
  .demo-login-btn:hover { border-color: var(--color-accent, var(--accent)); color: var(--color-accent, var(--accent)); transform: translateY(-1px); }
  .demo-mode-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 8px;
    border: 1px solid rgba(74,222,128,0.45);
    border-radius: 999px;
    background: rgba(74,222,128,0.10);
    color: #4ade80;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    white-space: nowrap;
  }
  .migration-status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 8px;
    border: 1px solid rgba(56,189,248,0.34);
    border-radius: 999px;
    background: rgba(56,189,248,0.10);
    color: #7dd3fc;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    white-space: nowrap;
  }
  .migration-status-pill.ok {
    border-color: rgba(74,222,128,0.45);
    background: rgba(74,222,128,0.10);
    color: #4ade80;
  }
  .migration-status-pill.warn {
    border-color: rgba(251,191,36,0.45);
    background: rgba(251,191,36,0.10);
    color: #facc15;
  }
  .migration-status-pill.info {
    border-color: rgba(56,189,248,0.34);
    background: rgba(56,189,248,0.10);
    color: #7dd3fc;
  }
  .demo-guide {
    margin: 10px 16px 12px;
    border: 1px solid color-mix(in srgb, var(--color-accent, var(--accent)) 28%, var(--color-border, var(--border)));
    border-radius: 10px;
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 88%, var(--color-accent, var(--accent)) 5%);
    overflow: hidden;
    box-shadow: 0 14px 34px rgba(0,0,0,0.22);
  }
  .demo-guide-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .demo-guide-kicker {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-accent, var(--accent));
    margin-bottom: 2px;
  }
  .demo-guide-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--color-text, var(--text));
  }
  .demo-guide-actions {
    display: flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
  }
  .demo-guide-count {
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    color: var(--color-text-muted, var(--text2));
    padding: 4px 7px;
    border: 1px solid var(--color-border, var(--border));
    border-radius: 999px;
    background: var(--color-surface-raised, var(--bg3));
  }
  .demo-guide-nav {
    display: flex;
    align-items: center;
    gap: 2px;
    background: var(--color-surface-raised, var(--bg3));
    border: 1px solid var(--color-border, var(--border));
    border-radius: 999px;
    padding: 2px;
  }
  .demo-guide-nav-btn {
    background: transparent;
    border: none;
    color: var(--color-accent, var(--accent));
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    font-weight: bold;
    cursor: pointer;
    padding: 3px 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
  }
  .demo-guide-nav-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--color-text, var(--text));
  }
  .demo-guide-nav .demo-guide-count {
    border: none;
    background: transparent;
    padding: 0 6px;
  }
  .demo-guide-step {
    display: none !important;
  }
  .demo-guide-step.active {
    display: grid !important;
  }
  .demo-guide-progress-bar-wrap {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    position: relative;
    overflow: hidden;
  }
  .demo-guide-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--color-accent, var(--accent)), var(--color-success, var(--green)));
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .demo-guide.show-onboarding .demo-guide-step {
    display: none !important;
  }
  .demo-guide.show-onboarding .demo-guide-onboarding {
    display: flex !important;
  }
  .demo-guide.show-onboarding .demo-guide-nav {
    display: none !important;
  }
  .demo-guide-onboarding {
    display: none;
    flex-direction: column;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.035);
  }
  .demo-guide-onboarding-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 15px;
    font-weight: 700;
    color: var(--color-success, var(--green));
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .demo-guide-onboarding-desc {
    font-size: 12px;
    color: var(--color-text-muted, var(--text2));
    line-height: 1.4;
  }
  .demo-guide-onboarding-form {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-top: 4px;
  }
  .demo-guide-onboarding-form input[type="text"] {
    flex: 1;
    min-width: 180px;
    background: var(--color-surface, var(--bg2));
    border: 1px solid var(--color-border, var(--border));
    border-radius: 7px;
    color: var(--color-text, var(--text));
    padding: 6px 10px;
    font-size: 12px;
    font-family: 'Nunito', sans-serif;
    outline: none;
    transition: border-color 0.15s;
    height: 32px;
    box-sizing: border-box;
  }
  .demo-guide-onboarding-form input[type="text"]:focus {
    border-color: var(--color-accent, var(--accent));
  }
  .demo-guide-onboarding-form select {
    background: var(--color-surface, var(--bg2));
    border: 1px solid var(--color-border, var(--border));
    border-radius: 7px;
    color: var(--color-text, var(--text));
    padding: 0 10px;
    font-size: 12px;
    font-family: 'Nunito', sans-serif;
    outline: none;
    cursor: pointer;
    height: 32px;
    box-sizing: border-box;
  }
  .demo-guide-onboarding-btn {
    background: var(--color-accent, var(--accent));
    color: var(--color-bg, var(--bg));
    border: none;
    border-radius: 7px;
    padding: 0 16px;
    font-size: 12px;
    font-weight: bold;
    font-family: 'Nunito', sans-serif;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
  }
  .demo-guide-onboarding-btn:hover {
    opacity: 0.9;
  }
  .demo-guide-onboarding-btn:active {
    transform: scale(0.98);
  }
  .demo-guide-onboarding-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
  }
  @media (max-width: 700px) {
    .demo-guide-onboarding-form {
      flex-direction: column;
      align-items: stretch;
    }
    .demo-guide-onboarding-form input[type="text"],
    .demo-guide-onboarding-form select,
    .demo-guide-onboarding-btn {
      width: 100%;
    }
  }
  .demo-guide-tour-btn,
  .demo-guide-reset-btn,
  .demo-guide-collapse,
  .demo-guide-step-btn {
    border: 1px solid var(--color-border, var(--border));
    border-radius: 7px;
    background: var(--color-surface-raised, var(--bg3));
    color: var(--color-text-muted, var(--text2));
    font-family: 'Nunito', sans-serif;
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    white-space: nowrap;
  }
  .demo-guide-tour-btn,
  .demo-guide-reset-btn,
  .demo-guide-collapse { padding: 5px 9px; }
  .demo-guide-tour-btn,
  .demo-guide-reset-btn {
    color: var(--color-accent, var(--accent));
    border-color: color-mix(in srgb, var(--color-accent, var(--accent)) 55%, var(--color-border, var(--border)));
  }
  .demo-guide-step-btn { padding: 5px 8px; }
  .demo-guide-tour-btn:hover,
  .demo-guide-reset-btn:hover,
  .demo-guide-collapse:hover,
  .demo-guide-step-btn:hover {
    border-color: var(--color-accent, var(--accent));
    color: var(--color-text, var(--text));
  }
  .demo-guide-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0;
  }
  .demo-guide-step {
    min-width: 0;
    display: grid;
    grid-template-columns: 22px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid rgba(255,255,255,0.035);
  }
  .demo-guide-check {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1px solid var(--color-border, var(--border));
    color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 900;
    background: var(--color-surface-raised, var(--bg3));
  }
  .demo-guide-step.done .demo-guide-check {
    color: #fff;
    border-color: var(--color-success, var(--green));
    background: var(--color-success, var(--green));
  }
  .demo-guide-step-copy { min-width: 0; }
  .demo-guide-step-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--color-text, var(--text));
    line-height: 1.2;
  }
  .demo-guide-step-desc {
    font-size: 11px;
    color: var(--color-text-muted, var(--text2));
    line-height: 1.35;
    margin-top: 1px;
  }
  .demo-guide-route-flow {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
    margin-top: 5px;
    max-width: 100%;
  }
  .demo-route-chip {
    display: inline-flex;
    align-items: center;
    min-height: 18px;
    border: 1px solid color-mix(in srgb, var(--color-text-muted, var(--text2)) 34%, var(--color-border, var(--border)));
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 88%, var(--color-text-muted, var(--text2)) 5%);
    color: var(--color-text-muted, var(--text2));
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    line-height: 1;
    padding: 2px 6px;
    white-space: nowrap;
  }
  .demo-route-chip.accent {
    border-color: color-mix(in srgb, var(--color-accent, var(--accent)) 58%, var(--color-border, var(--border)));
    color: var(--color-accent, var(--accent));
    background: color-mix(in srgb, var(--color-accent, var(--accent)) 12%, var(--color-surface-raised, var(--bg3)));
  }
  .demo-route-or,
  .demo-route-arrow {
    color: var(--color-text-subtle, var(--text3));
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    line-height: 1;
  }
  .demo-guide.complete .demo-guide-count {
    color: var(--color-success, var(--green));
    border-color: color-mix(in srgb, var(--color-success, var(--green)) 45%, var(--color-border, var(--border)));
  }
  .demo-guide.collapsed .demo-guide-body { display: none; }
  .demo-guide-flash {
    animation: demoGuideFlash 1.4s ease;
  }
  @keyframes demoGuideFlash {
    0%,100% { box-shadow: none; }
    20%,70% { box-shadow: 0 0 0 2px var(--color-accent, var(--accent)), 0 0 24px var(--focus-ring, var(--accent-glow)); }
  }

  /* SYNC BANNER */
  #sync-banner { display: none; align-items: center; gap: 8px; background: var(--color-surface-raised, var(--bg3)); border-bottom: 1px solid var(--color-border, var(--border)); padding: 7px 28px; font-size: 12px; color: var(--color-text-muted, var(--text2)); font-family: 'Share Tech Mono', monospace; }
  #sync-banner.visible { display: flex; }
  #sync-banner[data-sync-status="live"] { border-bottom-color: color-mix(in srgb, var(--color-success, var(--green)) 42%, var(--color-border, var(--border))); }
  #sync-banner[data-sync-status="cached"] { border-bottom-color: color-mix(in srgb, var(--color-warning, var(--yellow)) 45%, var(--color-border, var(--border))); }
  #sync-banner[data-sync-status="syncing"] { border-bottom-color: color-mix(in srgb, var(--color-info, var(--blue)) 45%, var(--color-border, var(--border))); }
  #sync-banner[data-sync-status="offline"],
  #sync-banner[data-sync-status="error"] { border-bottom-color: color-mix(in srgb, var(--color-danger, var(--red)) 48%, var(--color-border, var(--border))); }
  .sync-dot { width: 7px; height: 7px; border-radius: 50%; background: #eab308; animation: pulse 1.2s infinite; flex-shrink: 0; }
  .sync-dot.ok { background: var(--color-success, var(--green)); animation: none; }
  .sync-dot.err { background: var(--color-danger, var(--red)); animation: none; }
  .sync-dot.cached { background: var(--color-warning, var(--yellow)); animation: none; }
  .sync-dot.syncing { background: var(--color-info, var(--blue)); animation: pulse 1.2s infinite; }
  .issue-card.local-pending {
    border-color: color-mix(in srgb, var(--color-info, var(--blue)) 48%, var(--color-border, var(--border)));
  }
  .issue-card.sync-failed {
    border-color: color-mix(in srgb, var(--color-danger, var(--red)) 62%, var(--color-border, var(--border)));
  }
  .local-sync-badge {
    display: inline-flex;
    align-items: center;
    border: 1px solid color-mix(in srgb, var(--color-info, var(--blue)) 45%, var(--color-border, var(--border)));
    color: var(--color-info, var(--blue));
    background: color-mix(in srgb, var(--color-info, var(--blue)) 12%, transparent);
    border-radius: 999px;
    padding: 1px 6px;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
  }
  .local-sync-badge.failed {
    border-color: color-mix(in srgb, var(--color-danger, var(--red)) 54%, var(--color-border, var(--border)));
    color: var(--color-danger, var(--red));
    background: color-mix(in srgb, var(--color-danger, var(--red)) 12%, transparent);
  }
  .firestore-io-indicator {
    margin-left: auto;
    font-size: 11px;
    letter-spacing: 0.02em;
    padding: 2px 6px;
    border: 1px solid var(--color-border, var(--border));
    border-radius: 999px;
    background: var(--color-surface, var(--bg2));
    color: var(--color-text-subtle, var(--text3));
    min-width: 82px;
    text-align: center;
  }
  .app-version-indicator {
    font-size: 11px;
    letter-spacing: 0.04em;
    padding: 2px 6px;
    border: 1px solid var(--color-border, var(--border));
    border-radius: 999px;
    background: var(--color-surface, var(--bg2));
    color: var(--color-text-muted, var(--text2));
    white-space: nowrap;
    text-align: center;
  }
  @keyframes pulse { 0%,100%{opacity:1}50%{opacity:0.3} }

  /* HEADER */
  header { background: var(--color-surface, var(--bg2)); border-bottom: 1px solid var(--color-border, var(--border)); padding: 10px 16px; display: flex; align-items: center; justify-content: flex-start; position: sticky; top: 0; z-index: 100; box-shadow: 0 4px 24px rgba(0,0,0,0.4); gap: 12px; }
  .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    cursor: pointer;
    text-align: left;
    appearance: none;
    -webkit-appearance: none;
  }
  .logo-icon { width: 32px; height: 32px; background: var(--color-accent, var(--accent)); border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: 16px; }
  .logo-text { font-family: 'Rajdhani', sans-serif; font-size: 19px; font-weight: 700; letter-spacing: 1px; }
  .logo-text span { color: var(--color-accent, var(--accent)); }
  .logo:focus-visible { outline: 2px solid var(--color-info, var(--blue)); outline-offset: 3px; border-radius: 10px; }
  .header-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
  }

  /* STAT PILLS */
  .stat-pill { background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 20px; padding: 3px 10px; font-size: 11px; font-family: 'Share Tech Mono', monospace; display: flex; align-items: center; gap: 5px; white-space: nowrap; cursor: pointer; transition: all 0.15s; user-select: none; }
  .stat-pill:hover { border-color: var(--color-text-muted, var(--text2)); }
  .stat-pill .dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
  .stat-pill.active-red    { border-color: var(--color-danger, var(--red));      background: var(--color-danger-soft, var(--red-dim));      color: var(--color-danger, var(--red)); }
  .stat-pill.active-green  { border-color: var(--color-success, var(--green));    background: var(--color-success-soft, var(--green-dim));    color: var(--color-success, var(--green)); }
  .stat-pill.active-yellow { border-color: var(--color-warning, var(--yellow));   background: var(--color-warning-soft, var(--yellow-dim));   color: var(--color-warning, var(--yellow)); }
  .stat-pill.active-purple { border-color: var(--color-purple, var(--purple));   background: var(--color-purple-soft, var(--purple-dim));   color: var(--color-purple, var(--purple)); }
  .stat-pill.active-baby   { border-color: var(--color-babyblue, var(--babyblue)); background: var(--color-babyblue-soft, var(--babyblue-dim)); color: var(--color-babyblue, var(--babyblue)); }
  .stat-pill.active-teal   { border-color: var(--color-teal, var(--teal));     background: var(--color-teal-soft, var(--teal-dim));     color: var(--color-teal, var(--teal)); }
  .stat-pill.active-orange { border-color: var(--color-orange, var(--orange));   background: var(--color-orange-soft, var(--orange-dim));   color: var(--color-orange, var(--orange)); }

  /* TOGGLES (shared style) */
  .scope-toggle { display: flex; background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 8px; overflow: hidden; flex-shrink: 0; }
  .scope-btn { font-family: 'Rajdhani', sans-serif; font-size: 12px; font-weight: 600; letter-spacing: 0.5px; line-height: 1; padding: 5px 12px; border: none; cursor: pointer; background: transparent; color: color-mix(in srgb, var(--color-text, var(--text)) 72%, var(--color-text-muted, var(--text2))); transition: all 0.15s; white-space: nowrap; border-right: 1px solid var(--color-border, var(--border)); }
  .scope-btn:last-child { border-right: none; }
  .scope-btn.active { background: var(--color-accent, var(--accent)); color: white; }
  .scope-btn.cal-btn { padding: 5px 10px; position: relative; display: flex; align-items: center; gap: 5px; min-width: 80px; }
  .scope-btn.cal-btn input[type=date] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
  .scope-btn.cal-btn.active { background: var(--color-accent, var(--accent)); color: white; }
  .scope-btn.cal-btn.has-schedule-data::after {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 999px;
    background: var(--color-success, var(--green));
    box-shadow: 0 0 0 3px var(--color-success-soft, var(--green-dim));
    flex: 0 0 auto;
  }
  .cal-date-lbl { transition: opacity 0.15s; font-family: inherit; font-size: inherit; font-weight: inherit; letter-spacing: inherit; line-height: 1; text-transform: none; }

  .schedule-calendar-popover {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 75;
    width: min(342px, calc(100vw - 32px));
    border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 70%, var(--color-success, var(--green)) 30%);
    border-radius: 10px;
    background: var(--color-surface, var(--bg2));
    box-shadow: 0 20px 58px rgba(0,0,0,0.58), 0 0 0 1px rgba(255,255,255,0.025);
    overflow: hidden;
  }
  .schedule-calendar-popover[hidden] { display: none; }
  .schedule-cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 11px; border-bottom: 1px solid var(--color-border, var(--border)); }
  .schedule-cal-title { display: grid; gap: 1px; font-family: 'Rajdhani', sans-serif; font-size: 18px; font-weight: 700; letter-spacing: 0.04em; color: var(--color-text, var(--text)); }
  .schedule-cal-title span { font-family: 'Share Tech Mono', monospace; font-size: 10px; font-weight: 400; letter-spacing: 0; color: var(--color-text-muted, var(--text2)); }
  .schedule-cal-nav { width: 30px; height: 30px; display: grid; place-items: center; border: 1px solid var(--color-border, var(--border)); border-radius: 7px; background: var(--color-surface-raised, var(--bg3)); color: color-mix(in srgb, var(--color-text, var(--text)) 76%, var(--color-text-muted, var(--text2))); cursor: pointer; font-family: 'Nunito', sans-serif; font-size: 23px; font-weight: 800; line-height: 0.8; padding: 0 0 2px; }
  .schedule-cal-nav:hover { border-color: var(--color-text-muted, var(--text2)); color: var(--color-text, var(--text)); }
  .schedule-cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; padding: 10px; }
  .schedule-cal-dow { height: 20px; display: grid; place-items: center; color: var(--color-text-subtle, var(--text3)); font-family: 'Share Tech Mono', monospace; font-size: 10px; text-transform: uppercase; }
  .schedule-cal-day {
    position: relative;
    min-height: 38px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: var(--color-text-muted, var(--text2));
    font-family: 'Share Tech Mono', monospace;
    font-size: 12px;
    cursor: pointer;
  }
  .schedule-cal-day:hover { border-color: var(--color-border, var(--border)); background: color-mix(in srgb, var(--color-text, var(--text)) 4%, transparent); color: var(--color-text, var(--text)); }
  .schedule-cal-day.other-month { opacity: 0.28; cursor: default; }
  .schedule-cal-day.today { border-color: color-mix(in srgb, var(--color-babyblue, var(--babyblue)) 58%, transparent); color: var(--color-babyblue, var(--babyblue)); }
  .schedule-cal-day.selected { border-color: var(--color-accent, var(--accent)); background: color-mix(in srgb, var(--color-accent, var(--accent)) 22%, var(--color-surface-raised, var(--bg3))); color: white; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-accent, var(--accent)) 64%, transparent), 0 0 0 2px color-mix(in srgb, var(--color-accent, var(--accent)) 18%, transparent); }
  .schedule-cal-day.has-schedule { border-color: color-mix(in srgb, var(--color-success, var(--green)) 28%, transparent); background: color-mix(in srgb, var(--color-success, var(--green)) 8%, transparent); color: color-mix(in srgb, var(--color-success, var(--green)) 42%, white); }
  .schedule-cal-day.has-schedule::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 5px;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    transform: translateX(-50%);
    background: var(--color-success, var(--green));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-success, var(--green)) 14%, transparent);
  }
  .schedule-cal-day.selected.has-schedule::after { background: var(--color-success, var(--green)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-success, var(--green)) 18%, transparent); }
  .schedule-cal-footer { display: grid; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 86%, white 4%); background: color-mix(in srgb, var(--color-bg, var(--bg)) 54%, var(--color-surface, var(--bg2))); }
  .schedule-cal-readout { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 30px; border: 1px solid var(--color-border, var(--border)); border-radius: 8px; padding: 7px 9px; background: var(--color-surface-raised, var(--bg3)); color: var(--color-text-muted, var(--text2)); font-size: 12px; }
  .schedule-cal-readout strong { color: white; font-weight: 900; }
  .schedule-cal-chip { border: 1px solid color-mix(in srgb, var(--color-success, var(--green)) 30%, transparent); border-radius: 999px; padding: 2px 7px; background: color-mix(in srgb, var(--color-success, var(--green)) 7%, transparent); color: color-mix(in srgb, var(--color-success, var(--green)) 50%, white); font-family: 'Share Tech Mono', monospace; font-size: 10px; white-space: nowrap; }
  .schedule-cal-chip.empty { border-color: var(--color-border, var(--border)); background: transparent; color: var(--color-text-subtle, var(--text3)); }
  .schedule-cal-legend { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--color-text-muted, var(--text2)); font-size: 11px; line-height: 1.35; }
  .schedule-cal-legend-item { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
  .schedule-cal-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--color-success, var(--green)); box-shadow: 0 0 0 3px var(--color-success-soft, var(--green-dim)); flex: 0 0 auto; }

  /* USER PILL */
  .user-pill-wrap { position: relative; flex-shrink: 0; }

  /* PLANT SWITCHER */
  .plant-switcher-wrap { position: relative; flex-shrink: 0; }
  .plant-switcher-btn { display: flex; align-items: center; gap: 6px; background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 8px; padding: 5px 10px; cursor: pointer; font-size: 12px; font-weight: 700; color: var(--color-text-muted, var(--text2)); font-family: 'Nunito', sans-serif; transition: border-color 0.15s; white-space: nowrap; user-select: none; }
  .plant-switcher-btn:hover { border-color: var(--color-text-muted, var(--text2)); color: var(--color-text, var(--text)); }
  .plant-switcher-btn.open { border-color: var(--color-accent, var(--accent)); color: var(--color-accent, var(--accent)); }
  .plant-switcher-btn.open .plant-chevron { transform: rotate(180deg); }
  .plant-chevron { transition: transform 0.2s; }
  .plant-dropdown { display: none; position: absolute; top: calc(100% + 6px); left: 0; background: var(--color-surface, var(--bg2)); border: 1px solid var(--color-border, var(--border)); border-radius: 10px; min-width: 200px; box-shadow: 0 8px 32px rgba(0,0,0,0.5); z-index: 300; overflow: hidden; animation: dropIn 0.15s ease; }
  .plant-dropdown.visible { display: block; }
  #user-dropdown .plant-switcher-wrap { width: 100%; padding: 4px; background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 72%, transparent); border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 72%, transparent); border-radius: 9px; box-sizing: border-box;}
  #user-dropdown .plant-switcher-btn { width: 100%; justify-content: space-between; border: none; background: transparent; padding: 8px 10px;}
  #user-dropdown .plant-switcher-btn:hover { background: rgba(255,255,255,0.05); transform: none; }
  #user-dropdown .plant-dropdown { left: 6px; right: 6px; min-width: 0; width: auto; z-index: 360; }
  .plant-opt { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 13px; color: var(--color-text-muted, var(--text2)); cursor: pointer; transition: background 0.1s; border: none; background: none; width: 100%; text-align: left; font-family: 'Nunito', sans-serif; font-weight: 600; }
  .plant-opt:hover { background: var(--color-surface-raised, var(--bg3)); color: var(--color-text, var(--text)); }
  .plant-opt.active { color: var(--color-accent, var(--accent)); }
  .plant-opt-check { width: 14px; font-size: 11px; flex-shrink: 0; text-align: center; }
  .plant-opt-name { flex: 1; }
  .plant-opt-loc { font-size: 10px; color: var(--color-text-subtle, var(--text3)); font-family: 'Share Tech Mono', monospace; }
  .plant-dropdown-divider { height: 1px; background: var(--color-border, var(--border)); }
  .plant-add-btn { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 12px; color: var(--color-accent, var(--accent)); cursor: pointer; transition: background 0.1s; border: none; background: none; width: 100%; text-align: left; font-family: 'Nunito', sans-serif; font-weight: 700; }
  .plant-add-btn:hover { background: var(--color-surface-raised, var(--bg3)); }
  .game-pill { display: flex; align-items: center; gap: 6px; background: linear-gradient(135deg, var(--color-surface-raised, var(--bg3)), rgba(168,85,247,0.13)); border: 1px solid rgba(168,85,247,0.25); border-radius: 999px; padding: 5px 10px; cursor: pointer; color: var(--color-text-muted, var(--text2)); font-size: 12px; font-weight: 700; font-family: 'Share Tech Mono', monospace; transition: all 0.15s; white-space: nowrap; box-shadow: 0 0 0 1px rgba(168,85,247,0.08); position: relative; }
  .game-pill:hover { border-color: var(--color-purple, var(--purple)); color: var(--color-text, var(--text)); box-shadow: 0 0 0 1px rgba(168,85,247,0.2); }
  .game-pill .game-pill-xp { color: var(--color-purple, var(--purple)); font-weight: 800; }
  .game-pill .game-pill-mission { color: var(--color-babyblue, var(--babyblue)); }
  .user-dropdown .game-pill { width: calc(100% - 20px); margin: 10px; justify-content: center; }
  .game-drawer { position: fixed; top: 0; right: 0; width: 380px; max-width: 96vw; height: 100vh; background: var(--color-surface, var(--bg2)); border-left: 1px solid var(--color-border, var(--border)); z-index: 450; box-shadow: -20px 0 60px rgba(0,0,0,0.5); transform: translateX(100%); transition: transform 0.26s cubic-bezier(0.4,0,0.2,1); display: flex; flex-direction: column; }
  .game-drawer.open { transform: translateX(0); }
  .game-drawer-header { padding: 16px 16px 12px; border-bottom: 1px solid var(--color-border, var(--border)); display: flex; justify-content: space-between; align-items: center; background: linear-gradient(135deg, rgba(168,85,247,0.1), rgba(56,189,248,0.06)); flex-shrink: 0; }
  .game-drawer-title { font-family: 'Rajdhani', sans-serif; font-size: 20px; letter-spacing: 0.8px; font-weight: 700; }
  .game-drawer-close { border: 1px solid var(--color-border, var(--border)); background: var(--color-surface-raised, var(--bg3)); color: var(--color-text-muted, var(--text2)); border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 13px; transition: border-color 0.15s, color 0.15s; }
  .game-drawer-close:hover { border-color: var(--color-text-muted, var(--text2)); color: var(--color-text, var(--text)); }
  .game-drawer-body { padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
  .game-card { background: linear-gradient(135deg, var(--color-surface-raised, var(--bg3)), rgba(168,85,247,0.03)); border: 1px solid var(--color-border, var(--border)); border-radius: 14px; padding: 14px; box-shadow: 0 2px 12px rgba(0,0,0,0.2); }
  .game-card-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-muted, var(--text2)); margin-bottom: 10px; font-weight: 800; border-left: 2px solid var(--color-purple, var(--purple)); padding-left: 7px; }
  .game-stats-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
  .game-stat-tile { background: var(--color-surface, var(--bg2)); border: 1px solid var(--color-border, var(--border)); border-radius: 10px; padding: 10px 8px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 3px; }
  .game-stat-tile .st-value { font-family: 'Rajdhani', sans-serif; font-size: 22px; font-weight: 700; color: var(--color-text, var(--text)); line-height: 1; }
  .game-stat-tile .st-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-text-subtle, var(--text3)); }
  .game-stat-tile.xp .st-value { color: var(--color-purple, var(--purple)); }
  .game-stat-tile.streak .st-value { color: var(--color-warning, var(--yellow)); }
  .game-level-badge { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(135deg, var(--color-purple, var(--purple)), var(--color-info, var(--blue))); display: flex; align-items: center; justify-content: center; font-family: 'Rajdhani', sans-serif; font-size: 18px; font-weight: 700; color: white; box-shadow: 0 0 14px rgba(168,85,247,0.45); margin-bottom: 2px; }
  .game-xp-bar-row { display: flex; justify-content: space-between; margin-top: 5px; font-size: 10px; color: var(--color-text-subtle, var(--text3)); }
  .game-progress { height: 8px; border-radius: 999px; background: rgba(255,255,255,0.08); overflow: hidden; margin-top: 4px; box-shadow: inset 0 1px 3px rgba(0,0,0,0.3); }
  .game-progress > span { display: block; height: 100%; background: linear-gradient(90deg, var(--color-purple, var(--purple)), var(--color-info, var(--blue))); transition: width 0.5s cubic-bezier(0.4,0,0.2,1); box-shadow: 0 0 8px rgba(168,85,247,0.4); }
  .game-mission-item { padding: 10px; border: 1px solid var(--color-border, var(--border)); border-radius: 10px; margin-bottom: 8px; background: rgba(255,255,255,0.01); transition: border-color 0.15s, background 0.15s; cursor: default; }
  .game-mission-item:hover { border-color: rgba(168,85,247,0.3); background: rgba(168,85,247,0.04); }
  .game-mission-complete { border-color: rgba(34,197,94,0.35) !important; background: rgba(34,197,94,0.04) !important; }
  .game-mission-head { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--color-text, var(--text)); margin-bottom: 6px; }
  .game-mission-meta { font-size: 10px; color: var(--color-text-subtle, var(--text3)); margin-top: 5px; }
  .game-leader-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--color-text-muted, var(--text2)); padding: 7px 4px; border-bottom: 1px dashed rgba(255,255,255,0.08); gap: 6px; }
  .game-leader-row:last-child { border-bottom: none; }
  .game-leader-left { display: flex; align-items: center; gap: 7px; min-width: 0; }
  .game-leader-medal { font-size: 15px; flex-shrink: 0; }
  .game-leader-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .game-leader-you { font-size: 10px; color: var(--color-purple, var(--purple)); flex-shrink: 0; }
  .game-toast { position: fixed; bottom: 16px; right: 16px; z-index: 470; background: var(--color-surface, var(--bg2)); border: 1px solid rgba(168,85,247,0.45); color: var(--color-text, var(--text)); border-radius: 12px; padding: 10px 14px; font-size: 12px; font-weight: 700; box-shadow: 0 10px 32px rgba(0,0,0,0.35); opacity: 0; transform: translateY(8px); pointer-events: none; transition: all 0.22s; display: flex; align-items: center; gap: 7px; }
  .game-toast.show { opacity: 1; transform: translateY(0); }
  .action-mini-celebration { position: fixed; left: 50%; top: 18%; z-index: 501; transform: translateX(-50%); pointer-events: none; display: flex; align-items: center; gap: 9px; padding: 10px 15px; border-radius: 999px; background: color-mix(in srgb, var(--color-surface, var(--bg2)) 90%, transparent); border: 1px solid color-mix(in srgb, var(--action-feedback-color, var(--color-success, var(--green))) 52%, transparent); color: var(--color-text, var(--text)); font-size: 13px; font-weight: 800; box-shadow: 0 18px 50px rgba(0,0,0,0.38), 0 0 26px color-mix(in srgb, var(--action-feedback-color, var(--color-success, var(--green))) 22%, transparent); animation: actionMiniCelebration 1s ease-out both; }
  .action-mini-celebration span { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: color-mix(in srgb, var(--action-feedback-color, var(--color-success, var(--green))) 18%, transparent); color: var(--action-feedback-color, var(--color-success, var(--green))); }
  @keyframes actionMiniCelebration {
    0% { opacity: 0; transform: translate(-50%, 12px) scale(0.96); }
    18% { opacity: 1; transform: translate(-50%, 0) scale(1.02); }
    76% { opacity: 1; transform: translate(-50%, 0) scale(1); }
    100% { opacity: 0; transform: translate(-50%, -10px) scale(0.98); }
  }
  @media (max-width: 640px) {
    .game-toast {
      left: 12px;
      right: 12px;
      bottom: calc(12px + env(safe-area-inset-bottom, 0px));
      justify-content: center;
      text-align: center;
    }
  }
  .game-levelup-overlay { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; pointer-events: none; }
  .game-levelup-card { background: var(--color-surface, var(--bg2)); border: 1px solid rgba(168,85,247,0.5); border-radius: 20px; padding: 32px 44px; text-align: center; box-shadow: 0 0 60px rgba(168,85,247,0.3), 0 24px 80px rgba(0,0,0,0.6); animation: levelUpPop 0.4s cubic-bezier(0.34,1.56,0.64,1) both; }
  .game-levelup-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.18em; color: var(--color-purple, var(--purple)); margin-bottom: 6px; }
  .game-levelup-num { font-family: 'Rajdhani', sans-serif; font-size: 80px; font-weight: 700; line-height: 1; background: linear-gradient(135deg, var(--color-purple, var(--purple)), var(--color-info, var(--blue))); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
  .game-levelup-title { font-family: 'Rajdhani', sans-serif; font-size: 22px; letter-spacing: 1px; margin-top: 4px; color: var(--color-text, var(--text)); }
  @keyframes levelUpPop { 0%{opacity:0;transform:scale(0.5) translateY(40px)} 70%{opacity:1;transform:scale(1.06) translateY(-4px)} 100%{opacity:1;transform:scale(1) translateY(0)} }
  @media (max-width: 700px) { .game-drawer { width: 100vw; max-width: 100vw; } }
  @media (max-width: 700px) {
    .demo-guide {
      margin: 8px 10px 10px;
      border-radius: 8px;
    }
    .demo-guide-head {
      align-items: flex-start;
      flex-direction: column;
      gap: 8px;
    }
    .demo-guide-title { font-size: 15px; }
    .demo-guide-actions {
      width: 100%;
      justify-content: space-between;
      flex-wrap: wrap;
    }
  }
  @media (max-width: 360px) {
    .demo-guide-step.active {
      grid-template-columns: 22px minmax(0, 1fr);
      align-items: start;
      padding: 10px 12px 11px;
    }
    .demo-guide-step-btn {
      grid-column: 2;
      justify-self: start;
      margin-top: 6px;
    }
  }
  /* Notification badge on game pill */
  .game-pill-badge { position: absolute; top: -3px; right: -3px; width: 11px; height: 11px; border-radius: 50%; background: var(--color-success, var(--green)); border: 2px solid var(--color-surface, var(--bg2)); animation: badgePulse 2s ease-in-out infinite; }
  @keyframes badgePulse { 0%,100%{box-shadow:0 0 0 0 rgba(34,197,94,0.5)} 50%{box-shadow:0 0 0 5px rgba(34,197,94,0)} }
  /* Confetti */
  .confetti-container { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
  .confetti-piece { position: absolute; top: -10px; border-radius: 2px; animation: confettiFall linear forwards; }
  @keyframes confettiFall { 0%{transform:translateY(0) rotate(0deg);opacity:1} 100%{transform:translateY(110vh) rotate(720deg);opacity:0} }
  /* Mission complete overlay */
  .game-mission-complete-overlay { position: fixed; inset: 0; z-index: 502; display: flex; align-items: center; justify-content: center; pointer-events: none; }
  .game-mission-complete-card { background: var(--color-surface, var(--bg2)); border: 1px solid rgba(34,197,94,0.5); border-radius: 20px; padding: 28px 40px; text-align: center; box-shadow: 0 0 60px rgba(34,197,94,0.25), 0 24px 80px rgba(0,0,0,0.6); animation: levelUpPop 0.4s cubic-bezier(0.34,1.56,0.64,1) both; position: relative; z-index: 1; max-width: 320px; width: 90vw; }
  .game-mission-complete-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.18em; color: var(--color-success, var(--green)); margin-bottom: 6px; }
  .game-mission-complete-name { font-family: 'Rajdhani', sans-serif; font-size: 20px; font-weight: 700; color: var(--color-text, var(--text)); margin: 8px 0 4px; }
  .game-mission-complete-xp { font-family: 'Rajdhani', sans-serif; font-size: 28px; font-weight: 700; color: var(--color-warning, var(--yellow)); }
  /* Badge earned overlay (reuses mission-complete styles) */
  .game-badge-complete-card { background: var(--color-surface, var(--bg2)); border: 1px solid rgba(168,85,247,0.5); border-radius: 20px; padding: 28px 40px; text-align: center; box-shadow: 0 0 60px rgba(168,85,247,0.25), 0 24px 80px rgba(0,0,0,0.6); animation: levelUpPop 0.4s cubic-bezier(0.34,1.56,0.64,1) both; position: relative; z-index: 1; max-width: 320px; width: 90vw; }
  .game-badge-icon { font-size: 48px; line-height: 1; display: block; margin-bottom: 8px; }
  /* Badge grid in drawer */
  .game-badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 8px; }
  .game-badge-tile { background: var(--color-surface, var(--bg2)); border: 1px solid var(--color-border, var(--border)); border-radius: 10px; padding: 10px 6px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
  .game-badge-tile.earned { border-color: rgba(168,85,247,0.4); background: rgba(168,85,247,0.06); }
  .game-badge-tile .badge-icon { font-size: 22px; line-height: 1; }
  .game-badge-tile .badge-name { font-size: 9px; color: var(--color-text-muted, var(--text2)); font-weight: 700; text-align: center; line-height: 1.3; }
  .game-badge-tile.locked { opacity: 0.4; filter: grayscale(1); }
  /* Store card */
  .store-item-row { display: flex; justify-content: space-between; align-items: center; padding: 8px 2px; border-bottom: 1px dashed rgba(255,255,255,0.06); gap: 8px; }
  .store-item-row:last-child { border-bottom: none; }
  .store-item-row.owned { opacity: 0.55; }
  .store-item-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
  .store-item-name { font-size: 12px; font-weight: 700; color: var(--color-text, var(--text)); }
  .store-item-swatches { display: flex; gap: 3px; }
  .store-item-swatch { width: 16px; height: 9px; border-radius: 3px; border: 1px solid rgba(255,255,255,0.12); }
  .store-item-owned { font-size: 10px; color: var(--color-success, var(--green)); font-weight: 700; white-space: nowrap; }
  .store-item-action { flex-shrink: 0; }
  .store-buy-btn { background: linear-gradient(135deg,rgba(168,85,247,0.2),rgba(168,85,247,0.08)); border: 1px solid rgba(168,85,247,0.45); color: var(--purple,#a855f7); border-radius: 6px; padding: 4px 9px; font-size: 10px; font-weight: 800; cursor: pointer; font-family: inherit; white-space: nowrap; transition: background 0.15s, border-color 0.15s; }
  .store-buy-btn:hover:not(.cant-afford) { background: rgba(168,85,247,0.3); border-color: rgba(168,85,247,0.7); }
  .store-buy-btn.cant-afford { opacity: 0.35; cursor: not-allowed; }
  /* Locked theme indicator in theme picker */
  .theme-choice.theme-locked { opacity: 0.6; }
  .theme-lock-badge { display: block; font-size: 9px; color: var(--yellow,#eab308); font-weight: 700; margin-top: 3px; letter-spacing: 0.02em; }
  /* ── USER PILL ── */
  .user-pill { display: flex; align-items: center; gap: 7px; background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 20px; padding: 3px 9px 3px 3px; cursor: pointer; transition: border-color 0.15s; user-select: none; }
  .user-pill:hover { border-color: var(--color-text-muted, var(--text2)); }
  .user-pill.open { border-color: var(--color-accent, var(--accent)); }
  .user-avatar-fallback { width: 22px; height: 22px; border-radius: 50%; background: var(--color-accent, var(--accent)); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; color: white; flex-shrink: 0; background-size: cover; background-position: center; }
  .user-name { font-size: 11px; color: var(--color-text-muted, var(--text2)); max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .user-chevron { font-size: 8px; color: var(--color-text-subtle, var(--text3)); transition: transform 0.2s; }
  .user-pill.open .user-chevron { transform: rotate(180deg); }
  /* ── USER DROPDOWN (redesigned) ── */
  .user-dropdown { display: none; position: absolute; top: calc(100% + 12px); right: 0; background: color-mix(in srgb, var(--color-surface, var(--bg2)) 72%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border: 1px solid rgba(255, 255, 255, 0.08); border-radius: 14px; width: 340px; max-width: calc(100vw - 20px); max-height: min(82vh, 660px); box-shadow: 0 24px 60px rgba(0,0,0,0.8), 0 4px 12px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.05), 0 0 24px var(--focus-ring, var(--accent-glow)); z-index: 300; overflow-y: auto; overflow-x: visible; animation: dropIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards; transform-origin: top right; }
  .user-dropdown.visible { display: block; }
  @keyframes dropIn { from{opacity:0;transform:scale(0.95) translateY(-10px)}to{opacity:1;transform:scale(1) translateY(0)} }
  .ud-profile-card { display: flex; align-items: center; gap: 11px; margin: 8px 8px 5px; padding: 11px; border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 68%, transparent); border-radius: 12px; background: linear-gradient(135deg, color-mix(in srgb, var(--color-accent, var(--accent)) 13%, transparent), color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 72%, transparent)); }
  .ud-avatar { width: 38px; height: 38px; font-size: 13px; box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-accent, var(--accent)) 24%, transparent); }
  .ud-profile-copy { min-width: 0; flex: 1; display: grid; gap: 2px; }
  .ud-profile-name { color: var(--color-text, var(--text)); font-weight: 800; font-size: 14px; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ud-profile-email { color: var(--color-text-subtle, var(--text3)); font-size: 11px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .ud-profile-meta { display: flex; align-items: center; gap: 6px; color: var(--color-accent, var(--accent)); font-family: 'Share Tech Mono', monospace; font-size: 10px; font-weight: 800; line-height: 1.2; text-transform: uppercase; }
  /* Sections */
  .user-dropdown-section { padding: 7px 8px 5px; border-top: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 58%, transparent); }
  .user-dropdown-section:last-of-type { padding-bottom: 8px; }
  .user-dropdown-section-label { font-size: 9px; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; color: var(--color-text-subtle, var(--text3)); padding: 0 8px 6px; font-family: 'Share Tech Mono', monospace; display: flex; align-items: center; gap: 8px; }
  .user-dropdown-section-label::after { content: ""; flex: 1; height: 1px; background: color-mix(in srgb, var(--color-border, var(--border)) 48%, transparent); }
  .ud-plant-section { border-top: none; padding-top: 4px; }
  .ud-appearance-section { background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 26%, transparent); }
  .ud-session-section { background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 38%, transparent); padding-top: 8px; }
  /* Menu items */
  .user-dropdown-item { display: flex; align-items: center; gap: 12px; padding: 9px 11px; font-size: 13.5px; color: var(--color-text-muted, var(--text2)); cursor: pointer; transition: background 0.16s, color 0.16s, transform 0.16s; border: none; background: transparent; width: 100%; text-align: left; font-family: 'Nunito', sans-serif; font-weight: 650; border-radius: 8px; letter-spacing: 0; position: relative; }
  .user-dropdown-item:hover { background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 78%, transparent); color: var(--color-text, var(--text)); transform: translateX(2px); }
  .user-dropdown-item::before { content: ""; position: absolute; left: 0; top: 20%; bottom: 20%; width: 3px; background: var(--color-accent, var(--accent)); border-radius: 4px; opacity: 0; transition: opacity 0.2s, top 0.2s, bottom 0.2s; }
  .user-dropdown-item:hover::before { opacity: 1; top: 10%; bottom: 10%; }
  .user-dropdown-item:hover .ud-item-icon { color: var(--color-accent, var(--accent)); opacity: 1; text-shadow: 0 0 8px var(--focus-ring, var(--accent-glow)); }
  .user-dropdown-item.danger { color: var(--color-text-muted, var(--text2)); }
  .user-dropdown-item.danger:hover { background: var(--color-danger-soft, var(--red-dim)); color: var(--color-danger, var(--red)); }
  .user-dropdown-item.danger:hover::before { background: var(--color-danger, var(--red)); }
  .user-dropdown-item.danger .ud-item-icon { color: var(--color-text-subtle, var(--text3)); }
  .user-dropdown-item.danger:hover .ud-item-icon { color: var(--color-danger, var(--red)); text-shadow: 0 0 8px rgba(239,68,68,0.3); }
  /* Icon container */
  .ud-item-icon { display: flex; align-items: center; justify-content: center; width: 18px; flex-shrink: 0; color: var(--color-text-subtle, var(--text3)); transition: 0.2s; font-size: 16px; text-align: center; opacity: 0.72; }
  /* Divider */
  .ud-divider { height: 1px; background: var(--color-border, var(--border)); margin: 4px 0; }
  /* Dark/Light toggle row */
  .ud-toggle-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 8px; }
  .ud-toggle-label { flex: 1; font-size: 13.5px; color: var(--color-text-muted, var(--text2)); font-weight: 500; letter-spacing: -0.01em; }
  .ud-toggle-switch { width: 40px; height: 22px; border-radius: 11px; border: none; cursor: pointer; background: var(--color-border, var(--border)); position: relative; transition: background 0.2s; flex-shrink: 0; padding: 0; }
  .ud-toggle-switch.on { background: var(--color-accent, var(--accent)); }
  .ud-toggle-knob { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: white; transition: left 0.2s; box-shadow: 0 1px 3px rgba(0,0,0,0.4); display: block; }
  .ud-toggle-switch.on .ud-toggle-knob { left: 21px; }
  /* Theme select (inline row) */
  .theme-select-row { padding: 2px 0; }
  .theme-select-header { display: flex; align-items: stretch; gap: 6px; padding: 0; }
  .theme-select-toggle { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px; background: transparent; border: none; border-radius: 8px; cursor: pointer; color: var(--color-text-muted, var(--text2)); font-size: 13.5px; font-family: 'Nunito', sans-serif; font-weight: 500; text-align: left; transition: background 0.12s; letter-spacing: -0.01em; flex: 1; min-width: 0; }
  .theme-select-toggle:hover, .theme-select-toggle.open { background: var(--color-surface-raised, var(--bg3)); }
  .theme-select-toggle:hover .ud-item-icon, .theme-select-toggle.open .ud-item-icon { color: var(--color-accent, var(--accent)); }
  .theme-select-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
  .theme-select-label { font-size: 13px; color: var(--color-text-muted, var(--text2)); font-weight: 600; line-height: 1.15; }
  .theme-select-current { font-size: 12px; color: var(--color-text-subtle, var(--text3)); font-family: 'Share Tech Mono', monospace; }
  .theme-select-chevron { display: flex; align-items: center; color: var(--color-text-subtle, var(--text3)); transition: transform 0.15s; }
  .theme-select-toggle.open .theme-select-chevron { transform: rotate(180deg); }
  .theme-store-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 10px; border: 1px solid var(--color-border, var(--border)); border-radius: 8px; background: var(--color-surface-raised, var(--bg3)); color: var(--color-text-muted, var(--text2)); font-family: 'Nunito', sans-serif; font-size: 12px; font-weight: 700; cursor: pointer; flex-shrink: 0; transition: border-color 0.12s, color 0.12s, background 0.12s; }
  .theme-store-btn:hover { border-color: var(--color-text-muted, var(--text2)); color: var(--color-text, var(--text)); }
  .theme-store-btn:hover .ud-item-icon { color: var(--color-accent, var(--accent)); }
  .theme-select-grid { display: none; grid-template-columns: 1fr 1fr; gap: 6px; margin: 6px 0 2px; max-height: 230px; overflow-y: auto; padding-right: 2px; }
  .theme-select-grid.open { display: grid; }
  .theme-select-store { display: none; padding: 4px 0 0; }
  .theme-select-grid.open + .theme-select-store { display: block; }
  .theme-select-store .user-dropdown-item { background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); }
  .theme-select-store .user-dropdown-item:hover { border-color: var(--color-text-muted, var(--text2)); }
  .theme-choice { border: 1px solid var(--color-border, var(--border)); background: var(--color-surface-raised, var(--bg3)); border-radius: 8px; padding: 6px; cursor: pointer; text-align: left; transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s; }
  .theme-choice:hover { border-color: var(--color-text-muted, var(--text2)); transform: translateY(-1px); }
  .theme-choice.active { border-color: var(--color-accent, var(--accent)); box-shadow: 0 0 0 1px var(--color-accent, var(--accent)); }
  .theme-choice-name { display: block; font-size: 10px; font-weight: 700; color: var(--color-text, var(--text)); line-height: 1.2; margin-bottom: 4px; }
  .theme-choice-sub { display: block; font-size: 9px; color: var(--color-text-subtle, var(--text3)); font-family: 'Share Tech Mono', monospace; line-height: 1.2; margin-bottom: 4px; }
  .theme-choice-swatches { display: flex; gap: 4px; }
  .theme-swatch { flex: 1; height: 12px; border-radius: 4px; border: 1px solid rgba(255,255,255,0.15); }
  /* XP badge */
  .ud-xp-section { padding: 7px 8px; border-top: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 58%, transparent); }
  .ud-xp-badge { display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--color-accent, var(--accent)) 9%, transparent); border: 1px solid color-mix(in srgb, var(--color-accent, var(--accent)) 20%, transparent); cursor: pointer; position: relative; overflow: hidden; transition: background 0.15s; }
  .ud-xp-badge:hover { background: color-mix(in srgb, var(--color-accent, var(--accent)) 16%, transparent); }
  .ud-xp-icon { color: var(--color-accent, var(--accent)); display: flex; flex-shrink: 0; }
  .ud-xp-info { flex: 1; min-width: 0; }
  .ud-xp-amount { font-size: 12px; font-weight: 800; color: var(--color-accent, var(--accent)); font-family: 'Share Tech Mono', monospace; letter-spacing: 0.02em; }
  .ud-xp-missions { font-size: 10px; color: var(--color-text-subtle, var(--text3)); margin-top: 1px; }
  .ud-xp-level { font-size: 11px; color: var(--color-text-subtle, var(--text3)); background: var(--color-surface-raised, var(--bg3)); padding: 2px 7px; border-radius: 4px; font-family: 'Share Tech Mono', monospace; flex-shrink: 0; }
  .user-dropdown-bottom { border-top: 1px solid var(--color-border, var(--border)); background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 45%, transparent); padding: 6px 0; }

  /* CONTROLS */
  .controls { padding: 10px 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; background: var(--color-surface, var(--bg2)); border-bottom: 1px solid var(--color-border, var(--border)); }
  .mobile-period-menu { position: relative; }
  .mobile-period-trigger { display: none; }
  .period-toggle-group { display: flex; overflow: visible; position: relative; }
  .controls > .scope-toggle {
    margin-left: auto;
    margin-right: auto;
  }
  .controls > .filter-toggle-btn {
    margin-left: auto;
  }
  .filter-toggle-btn { display: flex; align-items: center; gap: 6px; background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 20px; padding: 4px 12px; cursor: pointer; font-size: 11px; color: var(--color-text-muted, var(--text2)); font-family: 'Nunito', sans-serif; font-weight: 600; transition: border-color 0.15s, color 0.15s; user-select: none; }
  .filter-toggle-btn:hover { border-color: var(--color-text-muted, var(--text2)); color: var(--color-text, var(--text)); }
  .filter-toggle-btn.active { border-color: var(--color-accent, var(--accent)); color: var(--color-accent, var(--accent)); }
  .filter-arrow svg { transition: transform 0.3s cubic-bezier(0.4,0,0.2,1); }
  .filter-toggle-btn.active .filter-arrow svg { transform: rotate(180deg); }
  .filter-active-badge { background: var(--color-accent, var(--accent)); color: white; font-size: 9px; width: 15px; height: 15px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-family: 'Nunito', sans-serif; }
  .filter-drawer { overflow: hidden; max-height: 0; opacity: 0; transition: max-height 0.32s cubic-bezier(0.4,0,0.2,1), opacity 0.22s ease; background: var(--color-surface, var(--bg2)); border-bottom: 1px solid var(--color-border, var(--border)); }
  .filter-drawer.open { max-height: 400px; opacity: 1; }
  .filter-inner { padding: 10px 16px 14px; display: flex; flex-direction: column; gap: 9px; }
  .filter-section-divider { height: 1px; background: var(--color-border, var(--border)); }
  .search-wrap { position: relative; flex: 1; min-width: 160px; }
  .search-box { width: 100%; background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 8px; padding: 7px 12px 7px 34px; color: var(--color-text, var(--text)); font-family: 'Nunito', sans-serif; font-size: 13px; outline: none; transition: border-color 0.2s; }
  .search-box:focus { border-color: var(--color-accent, var(--accent)); }
  .search-icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--color-text-muted, var(--text2)); font-size: 13px; pointer-events: none; }
  select { background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 8px; padding: 7px 10px; color: var(--color-text, var(--text)); font-family: 'Nunito', sans-serif; font-size: 12px; outline: none; cursor: pointer; }
  select:focus { border-color: var(--color-accent, var(--accent)); }
  .date-wrap { display: flex; align-items: center; gap: 6px; }
  .date-label { font-size: 11px; color: var(--color-text-subtle, var(--text3)); font-family: 'Share Tech Mono', monospace; white-space: nowrap; }
  .date-input { background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 8px; padding: 7px 10px; color: var(--color-text, var(--text)); font-family: 'Nunito', sans-serif; font-size: 12px; outline: none; cursor: pointer; }
  .date-input:focus { border-color: var(--color-accent, var(--accent)); }
  .date-input::-webkit-calendar-picker-indicator, input[type=date]::-webkit-calendar-picker-indicator, input[type=time]::-webkit-calendar-picker-indicator { filter: invert(0.6); cursor: pointer; }
  body[data-theme-mode="light"] .date-input::-webkit-calendar-picker-indicator, body[data-theme-mode="light"] input[type=date]::-webkit-calendar-picker-indicator, body[data-theme-mode="light"] input[type=time]::-webkit-calendar-picker-indicator { filter: none; }
  .date-clear { font-size: 11px; color: var(--color-accent, var(--accent)); background: none; border: none; cursor: pointer; font-family: 'Nunito', sans-serif; white-space: nowrap; padding: 0; }
  .date-clear:hover { text-decoration: underline; }
  .press-wiki-picker-wrap { position: relative; }
  .press-wiki-picker-btn {
    width: 100%;
    min-height: 62px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap: 12px;
    padding: 12px 14px 12px 14px;
    border-radius: 18px;
    border: 1px solid color-mix(in srgb, var(--color-accent, var(--accent)) 30%, var(--color-border, var(--border)));
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--color-surface, var(--bg2)) 70%, white 4%), color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 92%, transparent)),
      radial-gradient(circle at 18px 50%, rgba(255,255,255,0.05), transparent 34%);
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.05),
      0 12px 26px rgba(0,0,0,0.26),
      0 0 0 1px rgba(255,255,255,0.03);
    color: var(--color-text, var(--text));
    cursor: pointer;
    transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s, background 0.16s;
    text-align: left;
  }
  .press-wiki-picker-btn:hover,
  .press-wiki-picker-wrap.open .press-wiki-picker-btn {
    border-color: color-mix(in srgb, var(--color-accent-strong, var(--accent2)) 68%, var(--color-border, var(--border)));
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.08),
      0 16px 32px rgba(0,0,0,0.30),
    0 0 0 1px color-mix(in srgb, var(--color-accent, var(--accent)) 22%, transparent);
    transform: translateY(-1px);
  }
  .press-wiki-picker-btn:disabled {
    cursor: not-allowed;
    opacity: 0.72;
    transform: none;
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.04),
      0 10px 22px rgba(0,0,0,0.22),
      0 0 0 1px rgba(255,255,255,0.02);
  }
  .press-wiki-picker-copy { display:flex; flex-direction:column; gap:3px; min-width:0; flex:1; }
  .press-wiki-picker-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: 0.5px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .press-wiki-picker-path {
    font-size: 11px;
    color: var(--color-text-muted, var(--text2));
    font-family: 'Share Tech Mono', monospace;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .press-wiki-picker-meta { display:flex; align-items:center; gap:8px; flex-shrink:0; color: var(--color-text-subtle, var(--text3)); }
  .press-wiki-picker-count {
    font-size: 10px;
    font-family: 'Share Tech Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-subtle, var(--text3));
    padding: 3px 7px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.07);
    background: rgba(255,255,255,0.03);
  }
  .press-wiki-picker-caret { transition: transform 0.18s; }
  .press-wiki-picker-wrap.open .press-wiki-picker-caret { transform: rotate(180deg); }
  .press-wiki-picker-panel {
    display:none;
    position: absolute;
    z-index: 40;
    top: calc(100% + 8px);
    left: 0;
    right: 0;
    border-radius: 18px;
    border: 1px solid rgba(255,255,255,0.08);
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--color-surface, var(--bg2)) 74%, white 3%), color-mix(in srgb, var(--color-surface, var(--bg2)) 92%, transparent)),
      radial-gradient(circle at top left, rgba(255,255,255,0.04), transparent 40%);
    box-shadow: 0 26px 60px rgba(0,0,0,0.42), 0 0 0 1px rgba(255,255,255,0.03);
    padding: 12px;
    max-height: min(54vh, 430px);
    overflow: hidden;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .press-wiki-picker-panel.visible { display:block; }
  .press-wiki-picker-panel.empty { padding-bottom: 14px; }
  .press-wiki-picker-panel-head {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
    padding: 2px 4px 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
  }
  .press-wiki-picker-panel-kicker {
    font-family:'Share Tech Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--color-accent, var(--accent));
  }
  .press-wiki-picker-panel-copy {
    font-size: 12px;
    color: var(--color-text-muted, var(--text2));
    text-align: right;
    line-height: 1.35;
    max-width: 54%;
  }
  .press-wiki-picker-tree {
    display:flex;
    flex-direction:column;
    gap: 4px;
    overflow:auto;
    max-height: calc(min(54vh, 430px) - 54px);
    padding-right: 2px;
  }
  .press-wiki-picker-empty {
    color: var(--color-text-muted, var(--text2));
    font-size: 12px;
    font-style: italic;
    padding: 12px 4px 2px;
  }
  .press-wiki-picker-node {
    display:flex;
    flex-direction:column;
    gap: 4px;
  }
  .press-wiki-picker-row {
    display:grid;
    grid-template-columns: 26px minmax(0, 1fr);
    align-items:stretch;
    gap: 8px;
    padding-left: calc(2px + var(--press-wiki-depth, 0) * 10px);
    border-radius: 14px;
    transition: background 0.14s, transform 0.14s, box-shadow 0.14s;
  }
  .press-wiki-picker-row:hover {
    background: rgba(255,255,255,0.03);
  }
  .press-wiki-picker-row.active {
    background: color-mix(in srgb, var(--color-accent, var(--accent)) 12%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--color-accent, var(--accent)) 18%, transparent);
  }
  .press-wiki-picker-toggle {
    width: 26px;
    min-width: 26px;
    height: 26px;
    align-self:center;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.03);
    color: var(--color-text-muted, var(--text2));
    font-size: 12px;
    line-height: 1;
    cursor: pointer;
    display:grid;
    place-items:center;
    padding: 0;
    transition: border-color 0.14s, color 0.14s, background 0.14s;
  }
  .press-wiki-picker-toggle:hover:not(:disabled) {
    border-color: color-mix(in srgb, var(--color-accent, var(--accent)) 34%, var(--color-border, var(--border)));
    color: var(--color-text, var(--text));
    background: color-mix(in srgb, var(--color-accent, var(--accent)) 10%, transparent);
  }
  .press-wiki-picker-toggle.leaf {
    color: color-mix(in srgb, var(--color-text-muted, var(--text2)) 80%, transparent);
  }
  .press-wiki-picker-toggle:disabled {
    cursor: default;
    opacity: 0.8;
  }
  .press-wiki-picker-main {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap: 10px;
    width: 100%;
    min-width: 0;
    border: 1px solid transparent;
    border-radius: 14px;
    background: transparent;
    color: var(--color-text, var(--text));
    cursor: pointer;
    padding: 10px 10px 10px 0;
    text-align:left;
    transition: background 0.14s, border-color 0.14s;
  }
  .press-wiki-picker-row:hover .press-wiki-picker-main,
  .press-wiki-picker-row.active .press-wiki-picker-main {
    background: transparent;
  }
  .press-wiki-picker-main-copy {
    display:flex;
    flex-direction:column;
    gap: 3px;
    min-width: 0;
    flex: 1;
  }
  .press-wiki-picker-row-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .press-wiki-picker-row-meta {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    color: var(--color-text-subtle, var(--text3));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .press-wiki-picker-row-badges {
    display:flex;
    gap: 6px;
    align-items:center;
    justify-content:flex-end;
    flex-shrink:0;
  }
  .press-wiki-picker-scope,
  .press-wiki-picker-current {
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    border-radius: 999px;
    padding: 3px 7px;
    border: 1px solid rgba(255,255,255,0.08);
    white-space: nowrap;
  }
  .press-wiki-picker-scope.press {
    color: var(--color-text-muted, var(--text2));
    background: rgba(255,255,255,0.03);
  }
  .press-wiki-picker-scope.shared {
    color: var(--color-babyblue, var(--babyblue));
    border-color: rgba(56,189,248,0.25);
    background: rgba(56,189,248,0.08);
  }
  .press-wiki-picker-current {
    color: white;
    border-color: color-mix(in srgb, var(--color-accent, var(--accent)) 38%, transparent);
    background: color-mix(in srgb, var(--color-accent, var(--accent)) 22%, transparent);
  }
  .press-wiki-picker-children {
    display:none;
    gap: 4px;
    margin-left: 14px;
    padding-left: 6px;
    border-left: 1px solid rgba(255,255,255,0.05);
  }
  .press-wiki-picker-node .press-wiki-picker-children {
    margin-top: 2px;
  }
  .press-wiki-press-picker-wrap {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, #f97316 28%, var(--color-border, var(--border)));
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--color-surface, var(--bg2)) 72%, white 3%), color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 94%, transparent)),
      radial-gradient(circle at 18px 50%, rgba(255,255,255,0.05), transparent 34%);
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.05),
      0 12px 26px rgba(0,0,0,0.24),
      0 0 0 1px rgba(255,255,255,0.03);
    max-height: min(40vh, 360px);
    overflow: hidden;
  }
  .press-wiki-press-picker-panel-head {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:10px;
  }
  .press-wiki-press-picker-panel-kicker {
    font-family:'Share Tech Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #f97316;
  }
  .press-wiki-press-picker-panel-copy {
    font-size: 12px;
    color: var(--color-text-muted, var(--text2));
    line-height: 1.35;
  }
  .press-wiki-press-picker-tree {
    display:flex;
    flex-direction:column;
    gap: 8px;
    overflow:auto;
    min-height: 0;
    padding-right: 2px;
  }
  .press-wiki-press-picker-row {
    display:flex;
    flex-direction:column;
    gap: 5px;
  }
  .press-wiki-press-picker-row-label {
    font-family:'Share Tech Mono', monospace;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: #f97316;
  }
  .press-wiki-press-picker-grid {
    display:grid;
    grid-template-columns: repeat(auto-fit, minmax(54px, 1fr));
    gap: 5px;
  }
  .press-wiki-press-picker-item {
    min-height: 34px;
    display:flex;
    align-items:center;
    justify-content:center;
    padding: 6px 8px;
    border-radius: 10px;
    border: 1px solid color-mix(in srgb, #f97316 24%, var(--color-border, var(--border)));
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--color-surface, var(--bg2)) 64%, white 2%), color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 94%, transparent));
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.05),
      0 8px 18px rgba(0,0,0,0.16);
    color: var(--color-text, var(--text));
    cursor: pointer;
    text-align: center;
    font-family: 'Rajdhani', sans-serif;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.2px;
    line-height: 1;
    transition: transform 0.16s, border-color 0.16s, box-shadow 0.16s, background 0.16s;
  }
  .press-wiki-press-picker-item:hover {
    border-color: color-mix(in srgb, #f97316 60%, var(--color-border, var(--border)));
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.08),
      0 14px 26px rgba(0,0,0,0.24),
      0 0 0 1px color-mix(in srgb, #f97316 20%, transparent);
    transform: translateY(-1px);
  }
  .press-wiki-press-picker-item.active {
    border-color: color-mix(in srgb, #f97316 72%, var(--color-border, var(--border)));
    box-shadow:
      inset 0 1px 0 rgba(255,255,255,0.08),
      0 0 0 1px color-mix(in srgb, #f97316 34%, transparent),
      0 16px 26px rgba(0,0,0,0.26);
    background:
      linear-gradient(180deg, color-mix(in srgb, #f97316 18%, var(--color-surface, var(--bg2))), color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 92%, transparent));
  }
  .press-wiki-press-picker-empty {
    color: var(--color-text-muted, var(--text2));
    font-size: 12px;
    font-style: italic;
    padding: 4px 2px 2px;
  }
  body.theme-starship .press-wiki-picker-panel,
  body.theme-ocean .press-wiki-picker-panel,
  body.theme-starforge .press-wiki-picker-panel {
    box-shadow: 0 26px 60px rgba(0,0,0,0.44), 0 0 0 1px rgba(255,255,255,0.04);
  }
  body.theme-starship .press-wiki-picker-btn,
  body.theme-ocean .press-wiki-picker-btn {
    border-color: rgba(118,236,255,0.22);
  }
  body.theme-starforge .press-wiki-picker-btn {
    border-color: rgba(255,159,28,0.26);
  }
  body.theme-starship .press-wiki-press-picker-wrap,
  body.theme-ocean .press-wiki-press-picker-wrap {
    border-color: rgba(249,115,22,0.28);
  }
  body.theme-starforge .press-wiki-press-picker-wrap {
    border-color: rgba(249,115,22,0.28);
  }

  /* FLOOR MAP */
  .section-header { padding: 14px 16px 8px; font-family: 'Rajdhani', sans-serif; font-size: 12px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: var(--color-text-muted, var(--text2)); display: flex; align-items: center; justify-content: space-between; }
  .toggle-all-btn { font-family: 'Share Tech Mono', monospace; font-size: 10px; color: var(--color-text-subtle, var(--text3)); background: none; border: none; cursor: pointer; padding: 0; letter-spacing: 0.5px; transition: color 0.15s; }
  .toggle-all-btn:hover { color: var(--color-text-muted, var(--text2)); }
  .map-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
  .map-mode-toggle {
    display: inline-flex;
    align-items: stretch;
    background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 90%, transparent);
    border: 1px solid var(--color-border, var(--border));
    border-radius: 999px;
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
  }
  .map-mode-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 78px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    padding: 5px 12px;
    border: none;
    cursor: pointer;
    background: transparent;
    color: var(--color-text-subtle, var(--text3));
    transition: background 0.15s, color 0.15s, transform 0.15s;
    border-right: 1px solid var(--color-border, var(--border));
    letter-spacing: 0.04em;
    white-space: nowrap;
  }
  .map-mode-btn:last-child { border-right: none; }
  .map-mode-btn:hover { background: color-mix(in srgb, var(--color-surface, var(--bg2)) 72%, transparent); color: var(--color-text, var(--text)); }
  .map-mode-btn.active-log { background: var(--color-accent, var(--accent)); color: white; }
  .map-mode-btn.active-hist { background: var(--color-info, var(--blue)); color: white; }
  .press-btn.hist-mode:hover { border-color: var(--color-info, var(--blue)); color: var(--color-info, var(--blue)); box-shadow: 0 3px 10px rgba(59,130,246,0.25); transform: translateY(-1px); }
  .hist-panel { background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 8px; margin: 0 16px 12px; padding: 12px 14px; animation: slideIn 0.2s ease; }
  .hist-panel-machine { font-family: 'Rajdhani', sans-serif; font-size: 16px; font-weight: 700; letter-spacing: 1px; color: var(--color-accent, var(--accent)); margin-bottom: 10px; }
  .hist-entry { border-left: 2px solid var(--color-border, var(--border)); padding: 5px 10px; margin-bottom: 6px; cursor: default; }
  .hist-entry:last-child { margin-bottom: 0; }
  .hist-entry.hist-open { border-color: var(--color-danger, var(--red)); }
  .hist-entry.hist-resolved { border-color: var(--color-success, var(--green)); opacity: 0.7; }
  .hist-entry-note { font-size: 12px; color: var(--color-text, var(--text)); }
  .hist-entry-meta { font-size: 10px; color: var(--color-text-subtle, var(--text3)); font-family: 'Share Tech Mono', monospace; margin-top: 2px; }
  .hist-badge { display: inline-block; font-size: 9px; padding: 1px 6px; border-radius: 8px; margin-left: 6px; vertical-align: middle; }
  .hist-badge.open { background: var(--color-danger-soft, var(--red-dim)); color: var(--color-danger, var(--red)); border: 1px solid rgba(239,68,68,0.3); }
  .hist-badge.resolved { background: var(--color-success-soft, var(--green-dim)); color: var(--color-success, var(--green)); border: 1px solid rgba(34,197,94,0.3); }
  .hist-empty { font-size: 12px; color: var(--color-text-subtle, var(--text3)); text-align: center; padding: 14px 0; }
  .hist-close { font-size: 10px; color: var(--color-text-subtle, var(--text3)); background: none; border: none; cursor: pointer; font-family: 'Share Tech Mono', monospace; padding: 0; margin-top: 10px; display: block; transition: color 0.15s; }
  .hist-close:hover { color: var(--color-text-muted, var(--text2)); }
  /* FLOOR MAP — TAB STRIP */
  .floor-map { padding: 0 16px 8px; }
  .row-tabs { display: flex; gap: 5px; padding: 0 0 8px; overflow-x: auto; scrollbar-width: none; flex-wrap: wrap; }
  .row-tabs::-webkit-scrollbar { display: none; }
  .row-tab { flex-shrink: 0; font-family: 'Share Tech Mono', monospace; font-size: 11px; font-weight: 700; padding: 5px 11px; border-radius: 6px; border: 1px solid var(--color-border, var(--border)); background: var(--color-surface, var(--bg2)); color: var(--color-text-subtle, var(--text3)); cursor: pointer; transition: all 0.15s; user-select: none; display: flex; align-items: center; gap: 5px; }
  .row-tab:hover { border-color: var(--color-accent, var(--accent)); color: var(--color-accent, var(--accent)); }
  .row-tab.active { border-color: var(--color-accent, var(--accent)) !important; color: white !important; background: var(--color-accent, var(--accent)) !important; box-shadow: var(--theme-active-shadow, none) !important; }
  .row-tab.has-issues { border-color: rgba(249,115,22,0.6); color: var(--color-accent, var(--accent)); }
  .row-tab.has-issues.active { background: var(--color-accent, var(--accent)) !important; border-color: var(--color-accent, var(--accent)) !important; color: white !important; box-shadow: var(--theme-active-shadow, none) !important; }
  .row-tab.collapse-all-tab { color: var(--color-text-subtle, var(--text3)); border-color: var(--color-border, var(--border)); font-size: 10px; padding: 5px 9px; }
  .row-tab.collapse-all-tab:hover { color: var(--color-text-muted, var(--text2)); border-color: var(--color-text-muted, var(--text2)); background: transparent; }
  .tab-dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
  .tab-pulse { width: 6px; height: 6px; border-radius: 50%; background: var(--color-accent, var(--accent)); flex-shrink: 0; animation: tabPulse 1.5s ease-in-out infinite; }
  @keyframes tabPulse { 0%,100%{opacity:1} 50%{opacity:0.3} }
  @keyframes statPillPulse { 0%,100%{opacity:1} 50%{opacity:0.55} }
  .row-panel { background: var(--color-surface, var(--bg2)); border: 1px solid var(--color-border, var(--border)); border-radius: 8px; overflow: hidden; margin-bottom: 10px; animation: slideIn 0.18s ease; }
  .row-panel-header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid var(--color-border, var(--border));
    background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 86%, var(--color-accent, var(--accent)) 14%);
    box-shadow: inset 0 -1px 0 color-mix(in srgb, var(--color-accent, var(--accent)) 22%, transparent);
  }
  .row-header-actions { display: flex; gap: 4px; flex-shrink: 0; justify-self: end; align-items: center; }
  .row-resolved-toggle { font-size: 11px; font-weight: 700; font-family: 'Share Tech Mono', monospace; padding: 3px 9px; border-radius: 10px; border: 1px solid var(--color-border, var(--border)); background: transparent; color: var(--color-text-subtle, var(--text3)); cursor: pointer; white-space: nowrap; transition: all 0.15s; }
  .row-resolved-toggle.active { border-color: rgba(34,197,94,0.5); color: var(--color-success, var(--green)); background: var(--color-success-soft, var(--green-dim)); }
  .row-sched-toggle { margin-left: 4px; }
  .row-sched-toggle.active { border-color: rgba(253,230,138,0.45); color: rgba(212,160,6,1.0); background: rgba(253,243,176,0.08); }
  .row-panel-name {
    font-family: 'Rajdhani', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--color-text-muted, var(--text2));
    text-transform: uppercase;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .row-status-pills {
    display: flex;
    gap: 4px;
    align-items: center;
    flex-wrap: nowrap;
    min-width: 0;
    overflow: hidden;
  }
  .row-spill { font-size: 9px; font-family: 'Share Tech Mono', monospace; font-weight: 700; padding: 2px 7px; border-radius: 10px; border: 1px solid; white-space: nowrap; cursor: pointer; transition: all 0.15s; user-select: none; }
  .row-spill:hover { filter: brightness(1.2); }
  .row-spill.active { box-shadow: 0 0 0 1px currentColor; filter: brightness(1.3); animation: statPillPulse 1.5s ease-in-out infinite; }
  .row-spill-more {
    color: var(--color-text-muted, var(--text2));
    border-style: dashed;
    background: var(--color-surface-raised, var(--bg3));
    border-color: var(--color-border, var(--border));
  }
  .row-spill-more:hover { border-color: var(--color-text-muted, var(--text2)); color: var(--color-text, var(--text)); }
  .row-status-overflow-popover {
    position: fixed;
    z-index: 450;
    min-width: 190px;
    max-width: min(320px, calc(100vw - 16px));
    max-height: min(320px, calc(100vh - 16px));
    overflow: auto;
    padding: 10px;
    border-radius: 14px;
    border: 1px solid var(--color-border, var(--border));
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 94%, black 6%);
    box-shadow: 0 16px 42px rgba(0,0,0,0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  .row-status-overflow-header {
    font-size: 10px;
    font-family: 'Share Tech Mono', monospace;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-subtle, var(--text3));
    margin-bottom: 8px;
  }
  .row-status-overflow-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    text-align: left;
    margin-bottom: 6px;
    border-radius: 10px;
    padding: 6px 8px;
    font-size: 10px;
  }
  .row-status-overflow-item:last-child { margin-bottom: 0; }
  .row-status-overflow-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .row-status-overflow-count {
    flex-shrink: 0;
    color: currentColor;
    opacity: 0.78;
    font-size: 8px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
  }
  .row-pill-expand { overflow: hidden; max-height: 0; transition: max-height 0.3s cubic-bezier(0.4,0,0.2,1); }
  .row-pill-expand.visible { max-height: 2000px; }
  .row-pill-expand-inner { padding: 0 10px 8px; display: flex; flex-direction: column; gap: 4px; }
  .row-pill-expand-hdr { display: flex; align-items: center; justify-content: space-between; padding: 6px 0 4px; }
  .row-pill-expand-title { font-size: 11px; font-weight: 700; letter-spacing: 0.5px; text-transform: uppercase; }
  .row-pill-expand-close { font-size: 10px; color: var(--color-text-subtle, var(--text3)); background: none; border: none; cursor: pointer; font-family: 'Share Tech Mono', monospace; padding: 0; }
  .row-pill-expand-close:hover { color: var(--color-text-muted, var(--text2)); }
  .mini-issue { display: flex; align-items: center; gap: 8px; background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 8px; padding: 7px 10px; cursor: pointer; transition: border-color 0.15s; }
  .mini-issue:hover { border-color: var(--color-text-subtle, var(--text3)); }
  .mini-issue-bar { width: 3px; border-radius: 2px; align-self: stretch; flex-shrink: 0; }
  .mini-issue-machine { font-family: 'Rajdhani', sans-serif; font-size: 13px; font-weight: 700; color: var(--color-accent, var(--accent)); white-space: nowrap; flex-shrink: 0; }
  .mini-issue-note { font-size: 12px; color: var(--color-text, var(--text)); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
  .mini-issue-sub { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 8px; border: 1px solid; white-space: nowrap; flex-shrink: 0; }
  .mini-issue-time { font-size: 10px; color: var(--color-text-subtle, var(--text3)); white-space: nowrap; flex-shrink: 0; font-family: 'Share Tech Mono', monospace; }
  .row-spill.open        { color: var(--status-color-red);      border-color: rgba(239,68,68,0.5);  background: var(--status-color-red-dim); }
  .row-spill.alert       { color: var(--status-color-alert);    border-color: rgba(220,38,38,0.5);  background: var(--status-color-alert-dim); }
  .row-spill.maintenance { color: var(--status-color-yellow);   border-color: rgba(234,179,8,0.5);  background: var(--status-color-yellow-dim); }
  .row-spill.materials   { color: var(--status-color-materials); border-color: rgba(139,92,246,0.5); background: var(--status-color-materials-dim); }
  .row-spill.processengineer { color: var(--status-color-purple); border-color: rgba(167,139,250,0.5); background: var(--status-color-purple-dim); }
  .row-spill.quality     { color: var(--status-color-quality);   border-color: rgba(6,182,212,0.5);  background: var(--status-color-quality-dim); }
  .row-spill.tooldie     { color: var(--status-color-orange);   border-color: rgba(249,115,22,0.5); background: var(--status-color-orange-dim); }
  .row-spill.controlman  { color: var(--status-color-baby);     border-color: rgba(56,189,248,0.5); background: var(--status-color-baby-dim); }
  .row-spill.startup     { color: var(--status-color-teal);     border-color: rgba(20,184,166,0.5); background: var(--status-color-teal-dim); }
  .row-spill.production  { color: var(--status-color-production); border-color: rgba(37,99,235,0.5); background: var(--status-color-production-dim); }
  .row-spill.safety      { color: var(--status-color-safety);    border-color: rgba(220,38,38,0.5); background: var(--status-color-safety-dim); }
  .row-spill.resolved    { color: var(--status-color-green);    border-color: rgba(34,197,94,0.5);  background: var(--status-color-green-dim); }
  .row-presses { display: grid; grid-template-columns: repeat(auto-fill, minmax(49px, 1fr)); gap: 4px; padding: 8px 10px; }
  .press-btn {
    --press-state-color: var(--color-border, var(--border));
    --press-state-bg: rgba(255,255,255,0.025);
    appearance: none;
    min-width: 0;
    min-height: 34px;
    padding: 3px 4px 2px;
    border: 1px solid var(--press-state-color);
    border-radius: 8px;
    background:
      linear-gradient(180deg, rgba(255,255,255,0.055), rgba(255,255,255,0)),
      var(--press-state-bg),
      var(--color-surface-raised, var(--bg3));
    color: var(--color-text, var(--text));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 1px 2px rgba(0,0,0,0.18);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 600;
    line-height: 1;
    position: relative;
    text-align: center;
    transition: border-color 0.15s, box-shadow 0.15s, color 0.15s, transform 0.15s, background-color 0.15s;
  }
  .press-btn:hover,
  .press-btn:focus-visible {
    border-color: var(--press-state-color);
    color: var(--color-text, var(--text));
    outline: none;
    transform: translateY(-1px);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 5px 14px rgba(0,0,0,0.26), 0 0 0 1px var(--press-state-color);
  }
  .press-btn-num { color: inherit; font-family: 'Rajdhani', sans-serif; font-size: 13px; font-weight: 600; letter-spacing: 0; line-height: 0.9; }
  .press-btn-bars { display: flex; gap: 2px; width: min(31px, 80%); justify-content: center; min-height: 3px; }
  .press-btn-bar { height: 3px; border-radius: 999px; flex: 1; min-width: 3px; background: var(--color-border, var(--border)); box-shadow: 0 0 0 1px rgba(0,0,0,0.08); }
  /* Neutral, low-contrast idle state: vivid colors are reserved for active categories. */
  .press-btn.is-idle {
    --press-state-color: color-mix(in srgb, var(--color-border, var(--border)) 52%, var(--color-text-subtle, var(--text3)) 48%);
    --press-state-bg: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 82%, transparent);
    color: var(--color-text-muted, var(--text2));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.035), 0 1px 2px rgba(0,0,0,0.14);
  }
  .press-btn.is-idle .press-btn-bar {
    background: color-mix(in srgb, var(--color-text-subtle, var(--text3)) 62%, transparent) !important;
    box-shadow: none;
  }
  .press-btn.is-idle .press-btn-bars { display: none; }
  .press-btn.has-open        { --press-state-color: var(--color-danger, var(--red));      --press-state-bg: var(--color-danger-soft, var(--red-dim)); }
  .press-btn.has-maintenance { --press-state-color: var(--color-warning, var(--yellow));   --press-state-bg: var(--color-warning-soft, var(--yellow-dim)); }
  .press-btn.has-tooldie     { --press-state-color: var(--color-orange, var(--orange));   --press-state-bg: var(--color-orange-soft, var(--orange-dim)); }
  .press-btn.has-moldchange  { --press-state-color: var(--color-babyblue, var(--babyblue)); --press-state-bg: var(--color-babyblue-soft, var(--babyblue-dim)); }
  .press-btn.has-startup          { --press-state-color: var(--color-teal, var(--teal));     --press-state-bg: var(--color-teal-soft, var(--teal-dim)); }
  .press-btn.has-processengineer { --press-state-color: var(--color-purple, var(--purple));   --press-state-bg: var(--color-purple-soft, var(--purple-dim)); }
  .press-btn.has-controlman      { --press-state-color: var(--color-babyblue, var(--babyblue)); --press-state-bg: var(--color-babyblue-soft, var(--babyblue-dim)); }
  .press-btn.has-production { --press-state-color: var(--status-color-production); --press-state-bg: var(--status-color-production-dim); }
  .press-btn.has-safety     { --press-state-color: var(--status-color-safety);     --press-state-bg: var(--status-color-safety-dim); }
  .press-btn.all-resolved    { --press-state-color: var(--color-success, var(--green));    --press-state-bg: var(--color-success-soft, var(--green-dim)); }
  .press-btn.has-multi       { --press-state-color: var(--color-accent, var(--accent));   --press-state-bg: var(--focus-ring, var(--accent-glow)); }
  .press-btn.not-scheduled   { --press-state-color: rgba(253,230,138,0.42); --press-state-bg: rgba(253,243,176,0.08); color: var(--color-warning, var(--yellow)); }
  .press-btn.not-scheduled .press-btn-num { color: inherit; }
  .press-btn.notes-signal,
  .press-btn.wiki-signal,
  .press-btn.notes-wiki-signal {
    box-shadow: inset 0 -2px 0 0 var(--press-signal-color), 0 0 0 1px var(--press-state-color), 0 0 0 2px var(--press-state-bg);
  }
  .press-btn.notes-signal { --press-signal-color: #fbbf24; }
  .press-btn.wiki-signal { --press-signal-color: #60a5fa; }
  .press-btn.notes-wiki-signal {
    --press-signal-color: #34d399;
    background-image: linear-gradient(135deg, rgba(52,211,153,0.12) 0%, rgba(96,165,250,0.12) 100%);
  }
  .press-btn.action-pulse {
    animation: actionPressPulse 0.9s ease-out both;
    border-color: var(--action-feedback-color, var(--press-state-color));
  }
  @keyframes actionPressPulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 color-mix(in srgb, var(--action-feedback-color, var(--press-state-color)) 48%, transparent); }
    35% { transform: scale(1.08); box-shadow: 0 0 0 5px color-mix(in srgb, var(--action-feedback-color, var(--press-state-color)) 26%, transparent); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 transparent; }
  }
  .press-btn[data-note-signal]::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: var(--press-signal-color);
    box-shadow: 0 0 0 1px rgba(8,10,14,0.6), 0 0 8px color-mix(in srgb, var(--press-signal-color) 65%, transparent);
  }
  .press-btn .badge { position: absolute; top: -5px; right: -5px; background: var(--color-danger, var(--red)); color: white; font-size: 9px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; display: flex; align-items: center; justify-content: center; font-family: 'Nunito', sans-serif; font-weight: 800; line-height: 1; border: 2px solid var(--color-surface, var(--bg2)); box-shadow: 0 2px 6px rgba(0,0,0,0.25); }
  .press-btn.selected {
    border-color: var(--press-state-color, var(--color-accent, var(--accent)));
    background: color-mix(in srgb, var(--press-state-bg, var(--focus-ring, var(--accent-glow))) 76%, var(--color-surface, var(--bg2)) 24%);
    box-shadow:
      0 0 0 2px var(--color-surface, var(--bg2)),
      0 0 0 4px color-mix(in srgb, var(--press-state-color, var(--color-accent, var(--accent))) 84%, transparent),
      0 0 18px color-mix(in srgb, var(--press-state-color, var(--color-accent, var(--accent))) 30%, transparent);
    transform: translateY(-2px);
  }
  @media (max-width: 640px) {
    .row-presses { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 3px; padding: 7px 8px; }
    .press-btn { min-height: 31px; padding: 3px 4px 2px; gap: 2px; border-radius: 7px; }
    .press-btn-num { font-size: 13px; font-family: 'Rajdhani', sans-serif; font-weight: 600; }
    .press-btn-bars { width: min(28px, 78%); min-height: 3px; }
    .press-btn-bar { height: 3px; min-width: 3px; }
    .press-wiki-press-picker-wrap { max-height: min(34vh, 300px); }
    .press-wiki-press-picker-grid { grid-template-columns: repeat(auto-fit, minmax(48px, 1fr)); }
    .press-wiki-press-picker-item { min-height: 30px; font-size: 12px; padding: 5px 6px; }
  }

  /* PRESS MINI-CARD */
  .press-minicard-area { overflow: hidden; max-height: 0; transition: max-height 0.25s cubic-bezier(0.4,0,0.2,1); }
  .press-minicard-area.visible { max-height: 500px; }
  .press-minicard { background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 10px; margin: 0 10px 8px; overflow: hidden; animation: slideIn 0.2s ease; position: relative; }
  .mc-close { position: absolute; top: 6px; right: 8px; background: none; border: none; color: var(--color-text-subtle, var(--text3)); font-size: 14px; cursor: pointer; padding: 0; line-height: 1; z-index: 1; }
  .mc-close:hover { color: var(--color-text-muted, var(--text2)); }
  .mc-top { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
  .mc-id { font-family: 'Rajdhani', sans-serif; font-size: 16px; font-weight: 700; color: var(--color-accent, var(--accent)); }
  .mc-status-pill { font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 12px; border: 1px solid; }
  .mc-issues-list { padding: 0 10px 6px; display: flex; flex-direction: column; gap: 4px; }
  .mc-issue-item { display: flex; align-items: center; gap: 7px; background: var(--color-surface, var(--bg2)); border: 1px solid var(--color-border, var(--border)); border-radius: 7px; padding: 6px 8px; cursor: pointer; transition: border-color 0.15s; }
  .mc-issue-item:hover { border-color: var(--color-text-subtle, var(--text3)); }
  .mc-issue-bar { width: 3px; border-radius: 2px; align-self: stretch; flex-shrink: 0; }
  .mc-issue-note { font-size: 12px; color: var(--color-text, var(--text)); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
  .mc-issue-sub { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 8px; border: 1px solid; white-space: nowrap; flex-shrink: 0; }
  .mc-issue-time { font-size: 10px; color: var(--color-text-subtle, var(--text3)); white-space: nowrap; flex-shrink: 0; font-family: 'Share Tech Mono', monospace; }
  .mc-schedule { margin: 0 10px 8px; padding: 8px; border: 1px solid var(--color-border, var(--border)); border-radius: 8px; background: var(--color-surface, var(--bg2)); }
  .mc-schedule-title { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--color-text-subtle, var(--text3)); margin-bottom: 5px; font-weight: 700; }
  .mc-schedule-main { font-size: 12px; color: var(--color-text, var(--text)); line-height: 1.35; }
  .mc-schedule-meta { margin-top: 5px; display:flex; flex-wrap:wrap; gap:6px; }
  .mc-schedule-pill { font-size: 10px; border:1px solid var(--color-border, var(--border)); border-radius: 999px; padding: 1px 7px; color: var(--color-text-muted, var(--text2)); }
  .mc-schedule-change { margin-top: 6px; font-size: 11px; color: var(--color-text-muted, var(--text2)); border-top:1px dashed var(--color-border, var(--border)); padding-top: 6px; }
  .mc-schedule-empty { font-size: 11px; color: var(--color-text-subtle, var(--text3)); }
  .mc-schedule-notes { margin-top: 5px; font-size: 11px; color: var(--color-accent, var(--accent)); font-style: italic; padding: 4px 8px; background: rgba(255,255,255,0.03); border-radius: 6px; }
  .mc-toolbar { display: flex; border-top: 1px solid var(--color-border, var(--border)); }
  .mc-toolbar-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 5px; padding: 8px; cursor: pointer; font-size: 12px; font-weight: 700; font-family: 'Nunito', sans-serif; transition: background 0.12s; background: none; border: none; }
  .mc-toolbar-btn:not(:last-child) { border-right: 1px solid var(--color-border, var(--border)); }
  .mc-toolbar-btn:hover { background: var(--color-surface, var(--bg2)); }
  .mc-toolbar-btn:active { transform: scale(0.97); }
  .mc-toolbar-btn svg { width: 14px; height: 14px; flex-shrink: 0; }
  .mc-notes-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--color-teal, var(--teal)); flex-shrink: 0; }

  /* NOTES MODAL — VARIANT A: LOGBOOK */
  .notes-modal-a-wrap { display: flex; flex-direction: column; min-height: 0; }
  .notes-modal-a-header { display: flex; align-items: stretch; justify-content: space-between; padding-bottom: 18px; border-bottom: 1px solid var(--color-border, var(--border)); margin-bottom: 0; }
  .notes-modal-a-id-plate { display: flex; align-items: stretch; }
  .notes-modal-a-plate-bar { width: 3px; border-radius: 2px; background: var(--color-teal, var(--teal)); margin-right: 14px; flex-shrink: 0; }
  .notes-modal-a-plate-text { display: flex; flex-direction: column; justify-content: center; gap: 3px; }
  .notes-modal-a-subtitle { font-family: 'Share Tech Mono', monospace; font-size: 9px; letter-spacing: 2.5px; text-transform: uppercase; color: var(--color-teal, var(--teal)); opacity: 0.85; }
  .notes-modal-a-machine { font-family: 'Rajdhani', sans-serif; font-size: 30px; font-weight: 700; color: var(--color-text, var(--text)); letter-spacing: 1px; line-height: 1; }
  .notes-modal-a-context,
  .notes-modal-b-context { font-family: 'Nunito', sans-serif; font-size: 11px; color: var(--color-text-muted, var(--text2)); line-height: 1.35; letter-spacing: 0.1px; margin-top: 2px; }
  .notes-modal-a-meta,
  .notes-modal-b-meta { font-family: 'Share Tech Mono', monospace; font-size: 9px; color: var(--color-text-subtle, var(--text3)); line-height: 1.3; letter-spacing: 0.7px; text-transform: uppercase; margin-top: 2px; }
  .notes-modal-a-close { background: none; border: none; color: var(--color-text-subtle, var(--text3)); font-size: 16px; cursor: pointer; padding: 4px 6px; line-height: 1; align-self: flex-start; transition: color 0.15s; }
  .notes-modal-a-close:hover { color: var(--color-text, var(--text)); }
  .log-timeline { flex: 1; overflow-y: auto; max-height: 40vh; padding: 16px 0 8px; display: flex; flex-direction: column; }
  .log-timeline:empty::after { content: '— No entries in this log —'; display: block; text-align: center; color: var(--color-text-subtle, var(--text3)); font-family: 'Share Tech Mono', monospace; font-size: 11px; padding: 32px 0 16px; letter-spacing: 1px; }
  .log-entry { display: flex; gap: 0; position: relative; padding-bottom: 18px; }
  .log-entry:last-child { padding-bottom: 2px; }
  .log-entry-left { display: flex; flex-direction: column; align-items: center; width: 28px; flex-shrink: 0; }
  .log-entry-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--color-teal, var(--teal)); border: 2px solid var(--color-surface, var(--bg2)); flex-shrink: 0; margin-top: 3px; z-index: 1; }
  .log-entry-line { flex: 1; width: 2px; background: var(--color-border, var(--border)); margin-top: 5px; }
  .log-entry:last-child .log-entry-line { display: none; }
  .log-entry-body { flex: 1; min-width: 0; }
  .log-entry-header { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
  .log-entry-author { font-family: 'Rajdhani', sans-serif; font-size: 14px; font-weight: 700; color: var(--color-text, var(--text)); }
  .log-entry-time { font-family: 'Share Tech Mono', monospace; font-size: 10px; color: var(--color-text-subtle, var(--text3)); }
  .log-entry-del { background: none; border: none; color: var(--color-text-subtle, var(--text3)); font-size: 10px; font-family: 'Share Tech Mono', monospace; cursor: pointer; padding: 0 2px; opacity: 0; transition: opacity 0.15s, color 0.15s; flex-shrink: 0; margin-left: auto; }
  .log-entry:hover .log-entry-del { opacity: 1; }
  .log-entry-del:hover { color: var(--color-danger, var(--red)); }
  .log-entry-text { font-family: 'Nunito', sans-serif; font-size: 13px; color: var(--color-text-muted, var(--text2)); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
  .notes-attach { margin-top: 10px; }
  .notes-attach-label { font-family: 'Share Tech Mono', monospace; font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--color-text-subtle, var(--text3)); margin-bottom: 8px; }
  .notes-photo-btn-row { margin-bottom: 8px; }
  .notes-photo-previews { margin-bottom: 0; }
  .notes-photo-strip {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 8px;
  }
  .notes-photo-thumb-btn {
    padding: 0;
    border: none;
    background: none;
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
  }
  .notes-photo-thumb {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--color-border, var(--border));
    display: block;
    transition: transform 0.15s, border-color 0.15s;
  }
  .notes-photo-thumb-btn:hover .notes-photo-thumb { transform: scale(1.04); border-color: var(--color-teal, var(--teal)); }
  .log-compose { border-top: 1px solid var(--color-border, var(--border)); padding-top: 14px; margin-top: 10px; position: sticky; bottom: 0; background: linear-gradient(to bottom, rgba(0,0,0,0), var(--color-surface, var(--bg2)) 18px); padding-bottom: 2px; }
  .log-compose-label { font-family: 'Share Tech Mono', monospace; font-size: 9px; letter-spacing: 2px; text-transform: uppercase; color: var(--color-text-subtle, var(--text3)); margin-bottom: 8px; }
  .log-compose-row { display: flex; gap: 10px; align-items: flex-end; }
  .log-compose-textarea { flex: 1; background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 12px; padding: 10px 12px; color: var(--color-text, var(--text)); font-family: 'Nunito', sans-serif; font-size: 14px; resize: none; outline: none; min-height: 46px; max-height: 120px; overflow-y: auto; line-height: 1.45; }
  .log-compose-textarea:focus { border-color: var(--color-teal, var(--teal)); }
  .log-compose-btn { background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-teal, var(--teal)); border-radius: 10px; color: var(--color-teal, var(--teal)); height: 42px; padding: 0 15px; font-family: 'Share Tech Mono', monospace; font-size: 11px; letter-spacing: 1px; cursor: pointer; flex-shrink: 0; transition: background 0.15s, color 0.15s, transform 0.1s; white-space: nowrap; }
  .log-compose-btn:hover { background: var(--color-teal, var(--teal)); color: #fff; }
  .log-compose-btn:active { transform: scale(0.97); }
  .log-compose-btn:disabled { opacity: 0.4; cursor: not-allowed; }

  /* NOTES MODAL — VARIANT B: TEAM CHANNEL */
  .notes-modal-b-header { display: flex; align-items: flex-start; justify-content: space-between; padding-bottom: 14px; border-bottom: 1px solid var(--color-border, var(--border)); }
  .notes-modal-b-channel { display: flex; flex-direction: column; gap: 2px; }
  .notes-modal-b-channel-name { display: flex; align-items: baseline; gap: 1px; }
  .notes-modal-b-hash { font-family: 'Share Tech Mono', monospace; font-size: 22px; color: var(--color-teal, var(--teal)); line-height: 1; }
  .notes-modal-b-machine { font-family: 'Share Tech Mono', monospace; font-size: 22px; font-weight: 700; color: var(--color-text, var(--text)); line-height: 1; }
  .notes-modal-b-label { font-family: 'Nunito', sans-serif; font-size: 11px; color: var(--color-text-subtle, var(--text3)); }
  .notes-modal-b-close { background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 20px; color: var(--color-text-muted, var(--text2)); font-size: 12px; font-family: 'Share Tech Mono', monospace; cursor: pointer; padding: 4px 12px; line-height: 1; transition: border-color 0.15s, color 0.15s; }
  .notes-modal-b-close:hover { border-color: var(--color-text-muted, var(--text2)); color: var(--color-text, var(--text)); }
  .chat-list { flex: 1; overflow-y: auto; max-height: 40vh; padding: 12px 0 8px; display: flex; flex-direction: column; gap: 10px; }
  .chat-empty { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 32px 0 16px; color: var(--color-text-subtle, var(--text3)); }
  .chat-empty-icon { opacity: 0.35; }
  .chat-empty-text { font-family: 'Nunito', sans-serif; font-size: 13px; }
  .chat-msg { display: flex; gap: 8px; align-items: flex-end; }
  .chat-msg.mine { flex-direction: row-reverse; }
  .chat-avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); display: flex; align-items: center; justify-content: center; font-family: 'Rajdhani', sans-serif; font-size: 13px; font-weight: 700; color: var(--color-teal, var(--teal)); flex-shrink: 0; }
  .chat-msg.mine .chat-avatar { display: none; }
  .chat-bubble-wrap { display: flex; flex-direction: column; gap: 4px; max-width: 78%; }
  .chat-msg.mine .chat-bubble-wrap { align-items: flex-end; }
  .chat-bubble { display: flex; align-items: flex-start; gap: 6px; }
  .chat-bubble-text { font-family: 'Nunito', sans-serif; font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; padding: 9px 13px; border-radius: 16px; }
  .chat-msg.mine .chat-bubble-text { background: var(--color-teal-soft, var(--teal-dim)); color: var(--color-text, var(--text)); border-bottom-right-radius: 4px; border: 1px solid rgba(20,184,166,0.25); }
  .chat-msg:not(.mine) .chat-bubble-text { background: var(--color-surface-raised, var(--bg3)); color: var(--color-text, var(--text)); border-bottom-left-radius: 4px; border: 1px solid var(--color-border, var(--border)); }
  .chat-del-btn { background: none; border: none; color: var(--color-text-subtle, var(--text3)); cursor: pointer; padding: 4px; opacity: 0; transition: opacity 0.15s, color 0.15s; flex-shrink: 0; align-self: center; }
  .chat-msg:hover .chat-del-btn { opacity: 1; }
  .chat-del-btn:hover { color: var(--color-danger, var(--red)); }
  .chat-del-btn svg { display: block; }
  .chat-meta { font-family: 'Share Tech Mono', monospace; font-size: 10px; color: var(--color-text-subtle, var(--text3)); padding: 0 4px; }
  .chat-msg.mine .chat-meta { text-align: right; }
  .chat-compose { border-top: 1px solid var(--color-border, var(--border)); padding-top: 12px; margin-top: 8px; position: sticky; bottom: 0; background: linear-gradient(to bottom, rgba(0,0,0,0), var(--color-surface, var(--bg2)) 18px); padding-bottom: 2px; }
  .chat-compose-row { display: flex; gap: 10px; align-items: flex-end; }
  .chat-compose-textarea { flex: 1; background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 20px; padding: 10px 16px; color: var(--color-text, var(--text)); font-family: 'Nunito', sans-serif; font-size: 14px; resize: none; outline: none; min-height: 46px; max-height: 120px; overflow-y: auto; line-height: 1.45; }
  .chat-compose-textarea:focus { border-color: var(--color-teal, var(--teal)); }
  .chat-send-btn { background: var(--color-teal, var(--teal)); border: none; border-radius: 50%; color: white; width: 42px; height: 42px; display: flex; align-items: center; justify-content: center; cursor: pointer; flex-shrink: 0; transition: opacity 0.15s, transform 0.1s; }
  .chat-send-btn:hover { opacity: 0.85; }
  .chat-send-btn:active { transform: scale(0.93); }
  .chat-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
  .chat-compose-hint { text-align: right; font-family: 'Share Tech Mono', monospace; font-size: 9px; color: var(--color-text-subtle, var(--text3)); margin-top: 5px; letter-spacing: 0.5px; }

  /* RIGHT-SWIPE QUICK-ACTION TEASER */
  .swipe-notes-teaser { position: absolute; left: -4px; top: 50%; transform: translateY(-50%); width: 4px; height: 50px; border-radius: 4px 0 0 4px; background: var(--color-teal, var(--teal)); opacity: 0; transition: opacity 0.15s, width 0.15s, left 0.15s; pointer-events: none; }
  .issue-card.peeking-right .swipe-notes-teaser { opacity: 1; width: 6px; left: -6px; }

  .section-divider { height: 1px; background: linear-gradient(to right, transparent, var(--color-border, var(--border)), transparent); margin: 4px 16px 12px; }

  /* ISSUES */
  .issues-section { padding: 0 16px 40px; }
  .issues-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; gap: 10px; flex-wrap: wrap; }
  .issues-header-controls { display: flex; align-items: center; gap: 8px; flex-wrap: nowrap; }
  .issues-title-wrap { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .issues-title { font-family: 'Rajdhani', sans-serif; font-size: 18px; font-weight: 700; letter-spacing: 1px; flex-shrink: 0; }
  .issue-count { font-family: 'Share Tech Mono', monospace; font-size: 11px; color: var(--color-text-muted, var(--text2)); background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 20px; padding: 3px 10px; white-space: nowrap; }

  /* MACHINE BREADCRUMB */
  .machine-breadcrumb { display: none; align-items: center; gap: 8px; background: var(--focus-ring, var(--accent-glow)); border: 1px solid rgba(249,115,22,0.3); border-radius: 8px; padding: 6px 12px; margin-bottom: 10px; }
  .machine-breadcrumb.visible { display: flex; }
  .breadcrumb-label { font-size: 12px; color: var(--color-text-muted, var(--text2)); font-family: 'Nunito', sans-serif; }
  .breadcrumb-machine { font-size: 13px; font-weight: 700; color: var(--color-accent, var(--accent)); font-family: 'Rajdhani', sans-serif; letter-spacing: 0.5px; }
  .breadcrumb-clear { background: none; border: none; color: var(--color-text-subtle, var(--text3)); font-size: 14px; cursor: pointer; padding: 0 2px; margin-left: auto; line-height: 1; transition: color 0.15s; }
  .breadcrumb-clear:hover { color: var(--color-text, var(--text)); }

  /* SORT DROPDOWN */
  .sort-dropdown-wrap { position: relative; }
  .sort-dropdown-btn { display: flex; align-items: center; gap: 5px; background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 8px; padding: 4px 10px; cursor: pointer; font-size: 11px; color: var(--color-text-muted, var(--text2)); font-family: 'Share Tech Mono', monospace; font-weight: 700; transition: border-color 0.15s; white-space: nowrap; user-select: none; }
  .sort-dropdown-btn:hover { border-color: var(--color-text-muted, var(--text2)); color: var(--color-text, var(--text)); }
  .sort-dropdown-btn.open { border-color: var(--color-accent, var(--accent)); color: var(--color-accent, var(--accent)); }
  .sort-dropdown-btn.open .sort-chevron { transform: rotate(180deg); }
  .header-quick-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
  }
  .header-quick-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-width: 0;
    flex-wrap: nowrap;
  }
  .header-quick-menu-btn,
  .header-quick-menu {
    display: none;
  }
  .header-quick-menu-btn {
    align-items: center;
    gap: 5px;
    padding-inline: 10px;
  }
  .header-quick-menu-icon {
    flex-shrink: 0;
    color: var(--color-text-muted, var(--text2));
    opacity: 0.92;
    transition: color 0.15s ease, opacity 0.15s ease, transform 0.15s ease;
  }
  .header-quick-menu-label {
    font-family: 'Nunito', sans-serif;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: -0.01em;
  }
  .header-quick-menu-btn:hover .header-quick-menu-icon,
  .header-quick-menu-btn.open .header-quick-menu-icon {
    color: var(--color-accent, var(--accent));
    opacity: 1;
    transform: translateY(-0.5px);
  }
  .header-quick-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: min(320px, calc(100vw - 24px));
    min-width: 0;
    padding: 8px;
    border-radius: 16px;
    border-color: color-mix(in srgb, var(--color-accent, var(--accent)) 24%, var(--color-border, var(--border)));
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--color-surface, var(--bg2)) 78%, white 2%), color-mix(in srgb, var(--color-surface, var(--bg2)) 92%, transparent)),
      radial-gradient(circle at top, rgba(255,255,255,0.06), transparent 42%);
    box-shadow: 0 20px 42px rgba(0,0,0,0.52), 0 0 0 1px rgba(255,255,255,0.03);
    z-index: 210;
  }
  .header-quick-menu.visible { display: block; }
  .header-quick-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 11px 12px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--color-text-muted, var(--text2));
    cursor: pointer;
    text-align: left;
    font-family: 'Nunito', sans-serif;
    transition: background 0.15s, transform 0.15s, color 0.15s;
  }
  .header-quick-item:hover {
    background: rgba(255,255,255,0.04);
    color: var(--color-text, var(--text));
    transform: translateY(-1px);
  }
  .header-quick-item + .header-quick-item {
    margin-top: 4px;
  }
  .header-quick-item-icon {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #fff;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
  }
  .header-quick-item-icon-wiki { background: linear-gradient(135deg, #3b82f6, #2563eb); }
  .header-quick-item-icon-notes { background: linear-gradient(135deg, #8b5cf6, #6d28d9); }
  .header-quick-item-icon-todos { background: linear-gradient(135deg, #22c55e, #15803d); }
  .header-quick-item-icon-messages {
    background: linear-gradient(135deg, #f43f5e, #be123c);
    font-size: 19px;
    letter-spacing: 0;
  }
  .header-quick-item-icon-alerts { background: linear-gradient(135deg, #f59e0b, #ea580c); }
  .header-quick-item-copy {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
  }
  .header-quick-item-title {
    font-size: 13.5px;
    font-weight: 800;
    color: var(--color-text, var(--text));
    line-height: 1.1;
  }
  .header-quick-item-title-row {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  .header-quick-item-sub {
    font-size: 11px;
    color: var(--color-text-subtle, var(--text3));
    line-height: 1.2;
  }
  .header-quick-item-badge {
    margin-left: auto;
    flex-shrink: 0;
    position: static;
    top: auto;
    right: auto;
  }
  .notes-list-header {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
  }
  .role-alert-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 12px;
    color: inherit;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    transform-origin: center;
  }
  #alerts-btn-header {
    background: var(--color-orange, var(--orange));
    border-color: var(--color-orange, var(--orange));
    color: #fff;
    margin-left: 0;
  }
  #alerts-btn-header:hover {
    background: color-mix(in srgb, var(--color-orange, var(--orange)) 88%, #000 12%);
    border-color: color-mix(in srgb, var(--color-orange, var(--orange)) 88%, #000 12%);
    color: #fff;
  }
  #alerts-btn-header.alerts-has-active {
    animation: roleAlertPulse 2.2s ease-in-out infinite;
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-orange, var(--orange)) 28%, transparent), 0 0 12px color-mix(in srgb, var(--color-orange, var(--orange)) 16%, transparent);
  }
  @keyframes roleAlertPulse {
    0%, 100% {
      background: var(--color-orange, var(--orange));
      border-color: var(--color-orange, var(--orange));
      color: #fff;
      transform: scale(1);
      box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-orange, var(--orange)) 22%, transparent), 0 0 10px color-mix(in srgb, var(--color-orange, var(--orange)) 10%, transparent);
    }
    50% {
      background: #fff;
      border-color: #fff;
      color: var(--color-orange, var(--orange));
      transform: scale(1.08);
      box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-orange, var(--orange)) 44%, transparent), 0 0 22px color-mix(in srgb, var(--color-orange, var(--orange)) 28%, transparent);
    }
  }
  #messages-btn-header {
    background: #f43f5e;
    border-color: #f43f5e;
    color: #fff;
  }
  .messages-btn-icon {
    width: 18px;
    height: 18px;
    display: block;
    flex-shrink: 0;
    opacity: 0.88;
  }
  #messages-btn-header:hover {
    background: #be123c;
    border-color: #be123c;
    color: #fff;
  }
  #messages-btn-header.messages-has-unread {
    background: #f43f5e;
    border-color: #f43f5e;
    color: #fff;
    box-shadow: 0 0 0 2px rgba(244,63,94,0.22);
  }
  #messages-btn-header.messages-has-unread:hover {
    background: #be123c;
    border-color: #be123c;
    color: #fff;
  }
  #wiki-btn-header {
    background: var(--color-info, var(--blue));
    border-color: var(--color-info, var(--blue));
    color: #fff;
    min-width: 34px;
    justify-content: center;
    padding: 4px 0;
    font-family: 'Rajdhani', sans-serif;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.04em;
  }
  #wiki-btn-header:hover {
    background: color-mix(in srgb, var(--color-info, var(--blue)) 88%, #000 12%);
    border-color: color-mix(in srgb, var(--color-info, var(--blue)) 88%, #000 12%);
    color: #fff;
  }
  #notes-btn-header {
    background: #8b5cf6;
    border-color: #8b5cf6;
    color: #fff;
    min-width: 34px;
    justify-content: center;
    padding: 4px 0;
    font-family: 'Rajdhani', sans-serif;
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0.04em;
  }
  #notes-btn-header:hover {
    background: #6d28d9;
    border-color: #6d28d9;
    color: #fff;
  }
  #todos-btn-header {
    background: var(--color-success, var(--green));
    border-color: var(--color-success, var(--green));
    color: #fff;
    min-width: 34px;
    justify-content: center;
    padding: 4px 0;
  }
  #todos-btn-header:hover {
    background: color-mix(in srgb, var(--color-success, var(--green)) 88%, #000 12%);
    border-color: color-mix(in srgb, var(--color-success, var(--green)) 88%, #000 12%);
    color: #fff;
  }
  .wiki-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1em;
    line-height: 1;
    transform: translateY(-0.5px);
  }
  .todo-btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
  }
  .todo-btn-icon svg,
  .header-quick-item-icon-todos svg,
  .header-quick-item-icon-messages svg {
    display: block;
    flex-shrink: 0;
  }
  .todo-search-wrap {
    position: relative;
  }
  .todo-search-wrap .search-box {
    padding-left: 40px;
  }
  .todo-search-wrap .todo-search-icon {
    left: 14px;
    z-index: 1;
    color: var(--color-text-muted, var(--text2));
  }
  .sort-chevron { transition: transform 0.2s; }
  .sort-dropdown { display: none; position: absolute; top: calc(100% + 5px); right: 0; background: var(--color-surface, var(--bg2)); border: 1px solid var(--color-border, var(--border)); border-radius: 10px; min-width: 180px; box-shadow: 0 8px 32px rgba(0,0,0,0.5); z-index: 200; overflow: hidden; animation: dropIn 0.15s ease; }
  /* Keep the Tools quick menu centered; the generic dropdown rule above anchors other menus right. */
  .sort-dropdown.header-quick-menu {
    right: auto;
    transform-origin: top center;
    animation: headerQuickMenuIn 0.15s ease;
  }
  @keyframes headerQuickMenuIn {
    from { opacity: 0; transform: translateX(-50%) scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: translateX(-50%) scale(1) translateY(0); }
  }
  .sort-dropdown.visible { display: block; }
  .export-dropdown { min-width: 120px; }
  .press-wiki-actions-wrap { position: relative; }
  .press-wiki-actions-btn {
    min-width: 40px;
    padding: 0 14px;
    font-size: 18px;
    line-height: 1;
    font-family: 'Rajdhani', sans-serif;
    font-weight: 800;
  }
  .press-wiki-actions-menu {
    min-width: 172px;
    left: auto;
    right: 0;
    top: calc(100% + 4px);
    transform-origin: top right;
  }
  .press-wiki-actions-menu .press-wiki-action-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    font-size: 12px;
    color: var(--color-text-muted, var(--text2));
    cursor: pointer;
    transition: background 0.1s;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    white-space: nowrap;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
  }
  .press-wiki-actions-menu .press-wiki-action-item:hover { background: var(--color-surface-raised, var(--bg3)); color: var(--color-text, var(--text)); }
  .press-wiki-actions-menu .press-wiki-action-item + .press-wiki-action-item {
    border-top: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 60%, transparent);
  }
  .sort-opt { display: flex; align-items: center; gap: 8px; padding: 9px 14px; font-size: 12px; color: var(--color-text-muted, var(--text2)); cursor: pointer; transition: background 0.1s; font-family: 'Nunito', sans-serif; font-weight: 600; white-space: nowrap; border: none; background: none; width: 100%; text-align: left; }
  .sort-opt:hover { background: var(--color-surface-raised, var(--bg3)); color: var(--color-text, var(--text)); }
  .sort-opt.active { color: var(--color-accent, var(--accent)); }
  .sort-opt-check { width: 14px; font-size: 11px; flex-shrink: 0; text-align: center; }
  
  /* Grid fallback (top-aligned cards) */
  .issues-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 8px;
    align-items: start;
  }
  .issues-list.masonic-enabled {
    display: block;
    position: relative;
  }

  .issue-view-toggle { display:inline-flex; align-items:center; padding:2px; gap:2px; border:1px solid var(--color-border, var(--border)); border-radius:9px; background:var(--color-surface-raised, var(--bg3)); }
  .issue-view-btn { border:0; border-radius:7px; padding:5px 9px; background:transparent; color:var(--color-text-muted, var(--text2)); font:700 11px/1 'Nunito',sans-serif; cursor:pointer; }
  .issue-view-btn.active { color:var(--color-text, var(--text)); background:var(--color-surface, var(--bg2)); box-shadow:0 1px 5px rgba(0,0,0,.25); }
  .scope-label-phone, .issue-mobile-menu-wrap { display:none; }
  .issue-mobile-menu-heading { padding:7px 12px 5px; color:var(--color-text-subtle, var(--text3)); font:800 9px/1 'Share Tech Mono',monospace; text-transform:uppercase; letter-spacing:.1em; border-top:1px solid var(--color-border, var(--border)); }
  .issue-mobile-menu-heading:first-child { border-top:0; }

  .issues-list.ledger-view { display:flex; flex-direction:column; gap:5px; }
  .ledger-month-heading { position:sticky; top:0; z-index:3; display:flex; justify-content:space-between; align-items:center; width:100%; min-width:0; box-sizing:border-box; gap:16px; margin-top:8px; padding:7px 10px; border-bottom:1px solid var(--color-border, var(--border)); background:color-mix(in srgb, var(--color-surface, var(--bg2)) 94%, transparent); color:var(--color-text, var(--text)); font:700 12px/1.2 'Nunito',sans-serif; }
  .ledger-month-heading span:first-child { min-width:0; white-space:nowrap; }
  .ledger-month-heading span:last-child { flex:0 0 auto; margin-left:auto; color:var(--color-text-subtle, var(--text3)); font-size:10px; text-transform:uppercase; letter-spacing:.06em; white-space:nowrap; }
  .ledger-row { border:1px solid var(--color-border, var(--border)); border-radius:10px; overflow:hidden; background:color-mix(in srgb, var(--color-surface, var(--bg2)) 82%, transparent); }
  .ledger-row:has(.issue-card.high-priority), .ledger-row:has(.issue-card.timer-overdue) { border-color:rgba(239,68,68,.65); box-shadow:inset 3px 0 0 #ef4444; }
  .ledger-summary { width:100%; display:grid; grid-template-columns:72px 112px minmax(115px,.85fr) minmax(220px,2.4fr) 90px 105px minmax(90px,.8fr) 86px 18px; gap:10px; align-items:center; padding:9px 11px; border:0; background:transparent; color:var(--color-text, var(--text)); text-align:left; cursor:pointer; font-family:'Nunito',sans-serif; }
  .ledger-summary:hover { background:color-mix(in srgb, var(--color-accent, var(--accent)) 7%, transparent); }
  .ledger-date, .ledger-route { display:flex; flex-direction:column; min-width:0; }
  .ledger-press { color:var(--color-accent, var(--accent)); font:800 15px/1 'Share Tech Mono',monospace; white-space:nowrap; }
  .ledger-date strong { font-size:11px; white-space:nowrap; }
  .ledger-date small, .ledger-route small { color:var(--color-text-subtle, var(--text3)); font-size:10px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .ledger-chip { width:max-content; max-width:100%; padding:2px 6px; border:1px solid; border-radius:999px; font-size:10px; font-weight:800; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .ledger-description { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:12px; font-weight:650; }
  .ledger-row.ledger-expanded .ledger-description { display:none; }
  .ledger-state { font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.04em; }
  .ledger-state.open { color:var(--color-warning, #f59e0b); }
  .ledger-state.resolved { color:var(--color-success, var(--green)); }
  .ledger-duration, .ledger-person, .ledger-counts { color:var(--color-text-muted, var(--text2)); font-size:10px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
  .ledger-counts { display:flex; gap:7px; }
  .ledger-chevron { transition:transform .2s ease; color:var(--color-text-subtle, var(--text3)); }
  .ledger-expanded .ledger-chevron { transform:rotate(180deg); }
  .ledger-row > .issue-card { display:none; margin:0 8px 8px; width:calc(100% - 16px); box-shadow:none; }
  .ledger-row.ledger-expanded > .issue-card { display:block; }
  .ledger-row > .issue-card > .issue-card-header { display:none; }
  .ledger-row > .issue-card > .issue-body { border-top:0; }
  .ledger-history-end { padding:12px; color:var(--color-text-subtle, var(--text3)); font-size:11px; text-align:center; }

  @media (max-width: 760px) {
    .issues-header { align-items:flex-start; }
    .issues-header-controls { flex-wrap:wrap; justify-content:flex-end; }
    .ledger-summary { grid-template-columns:64px minmax(95px,1fr) minmax(76px,.75fr) 64px; grid-template-areas:"press route date duration" "description description description chevron"; gap:5px 8px; padding:9px; }
    .ledger-press { grid-area:press; }
    .ledger-date { grid-area:date; }
    .ledger-route { grid-area:route; }
    .ledger-description { grid-area:description; }
    .ledger-duration { grid-area:duration; justify-self:end; align-self:center; overflow:visible; }
    .ledger-chevron { grid-area:chevron; justify-self:end; }
    .ledger-state, .ledger-person, .ledger-counts { display:none; }
    .ledger-row > .issue-card { margin:0 4px 5px; width:calc(100% - 8px); }
  }

  @media (max-width: 430px) {
    .issues-section { padding-inline:12px; }
    .issues-header { position:relative; display:block; margin-bottom:12px; }
    .issues-title-wrap { min-height:30px; padding-right:92px; }
    .issues-title { font-size:17px; }
    .issue-count { padding:3px 8px; }
    .issues-header-controls { display:grid; grid-template-columns:minmax(0,.85fr) minmax(0,1.15fr); gap:8px; width:100%; margin-top:8px; }
    .issue-view-toggle, #issue-scope-toggle { width:100%; box-sizing:border-box; }
    .issue-view-btn, #issue-scope-toggle .scope-btn { flex:1 1 0; min-width:0; padding:7px 6px; }
    .scope-label-wide { display:none; }
    .scope-label-phone { display:inline; }
    #export-dropdown-wrap { display:none; }
    #sort-dropdown-wrap { display:block; position:absolute; top:0; right:46px; }
    #sort-dropdown-wrap .sort-dropdown-btn { align-items:center; justify-content:center; width:38px; height:28px; padding:0; border-radius:9px; }
    #sort-dropdown-wrap .sort-dropdown-btn #sort-label,
    #sort-dropdown-wrap .sort-dropdown-btn .sort-chevron { display:none; }
    #sort-dropdown-wrap .sort-dropdown-btn svg:first-child { width:15px; height:15px; opacity:1 !important; }
    .issue-mobile-menu-wrap { display:block; position:absolute; top:0; right:0; }
    .issue-mobile-menu-btn { display:flex; align-items:center; justify-content:center; width:38px; height:28px; padding:0 0 5px; border:1px solid var(--color-border, var(--border)); border-radius:9px; background:var(--color-surface-raised, var(--bg3)); color:var(--color-text-muted, var(--text2)); font:800 16px/1 'Nunito',sans-serif; letter-spacing:1px; cursor:pointer; }
    .issue-mobile-menu-btn.open { border-color:var(--color-accent, var(--accent)); color:var(--color-accent, var(--accent)); }
    .issue-mobile-menu { right:0; top:calc(100% + 6px); width:min(230px, calc(100vw - 24px)); max-height:min(520px, calc(100vh - 150px)); overflow-y:auto; }
  }
  
  @media (max-width: 480px) {
    .issues-list {
      grid-template-columns: 1fr;
    }
  }

  @media (max-width: 700px) {
    header {
      flex-wrap: nowrap;
      justify-content: flex-start;
      gap: 8px;
      overflow: visible;
    }
    .logo-text { font-size: 16px; }
    .logo { gap: 8px; }
    .header-center { gap: 6px; justify-content: center; }
    .plant-switcher-btn { padding: 5px 8px; font-size: 11px; }
    #messages-btn-header { padding: 5px 8px; min-width: 34px; justify-content: center; }
    #wiki-btn-header { width: 34px; min-width: 34px; padding: 5px 0; }
    .user-pill { padding: 4px 8px; }
    .user-name { max-width: 72px; }
    .header-quick-inline { display: none; }
    .header-quick-menu-btn { display: inline-flex; }
    .header-quick-menu-icon { width: 14px; height: 14px; }
    .header-quick-menu-btn.open { border-color: var(--color-accent, var(--accent)); color: var(--color-accent, var(--accent)); }
    .header-quick-menu-btn.open .sort-chevron { transform: rotate(180deg); }
    .header-quick-menu { width: min(320px, calc(100vw - 16px)); }
    .game-pill {
      order: 0;
      flex: 0 0 auto;
      justify-content: flex-start;
    }
  }

  @media (max-width: 560px) {
    .controls {
      display: grid;
      grid-template-columns: max-content minmax(0, 1fr) max-content;
      column-gap: 8px;
      row-gap: 8px;
      overflow: visible;
      align-items: center;
    }
    .controls > .scope-toggle {
      margin: 0;
      justify-self: center;
      min-width: 0;
    }
    .controls > .filter-toggle-btn {
      margin-left: 0;
      justify-self: end;
    }
    .mobile-period-trigger {
      display: flex;
      align-items: center;
      gap: 6px;
      list-style: none;
      background: var(--color-surface-raised, var(--bg3));
      border: 1px solid var(--color-border, var(--border));
      border-radius: 20px;
      padding: 4px 11px;
      cursor: pointer;
      font-size: 11px;
      color: var(--color-text-muted, var(--text2));
      font-family: 'Nunito', sans-serif;
      font-weight: 600;
      user-select: none;
      white-space: nowrap;
    }
    .mobile-period-menu {
      position: relative;
      justify-self: start;
      min-width: 0;
    }
    .mobile-period-menu.open {
      min-width: 0;
    }
    .mobile-period-trigger::-webkit-details-marker { display: none; }
    .period-toggle-group {
      display: none;
      position: absolute;
      top: calc(100% + 6px);
      left: 0;
      z-index: 20;
      background: var(--color-surface, var(--bg2));
      border: 1px solid var(--color-border, var(--border));
      border-radius: 10px;
      box-shadow: 0 8px 22px rgba(0,0,0,0.35);
      overflow: visible;
      margin-top: 0;
      width: max-content;
      min-width: 100%;
      max-width: calc(100vw - 32px);
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 1px;
    }
    .mobile-period-menu.open .period-toggle-group { display: grid; }
    .period-toggle-group .scope-btn {
      width: 100%;
    }
    .schedule-calendar-popover {
      left: 0;
      right: auto;
      width: min(342px, calc(100vw - 32px));
      max-width: calc(100vw - 32px);
    }
    .logo {
      gap: 6px;
      min-width: 0;
    }
    .logo-icon {
      width: 28px;
      height: 28px;
      border-radius: 7px;
      font-size: 14px;
    }
    .logo-text {
      display: block;
      font-size: 14px;
      letter-spacing: 0.5px;
      white-space: nowrap;
    }
  }

  @media (min-width: 561px) {
    .mobile-period-menu { display: contents; }
    .period-toggle-group { position: relative; display: flex !important; box-shadow: none; border: none; border-radius: 0; background: transparent; overflow: visible; }
  }

  .issue-row { display: flex; flex-direction: column; min-width: 0; width: 100%; margin: 0; perspective: 1100px; }
  .issue-card { display: block; width: 100%; background: color-mix(in srgb, var(--color-surface, var(--bg2)) 82%, transparent); border: 1px solid var(--color-border, var(--border)); border-radius: 18px; overflow: visible; animation: slideIn 0.25s ease; user-select: none; position: relative; z-index: 1; touch-action: pan-y; transform-style: preserve-3d; transition: transform 0.46s cubic-bezier(.2,.78,.22,1), box-shadow .25s ease; box-shadow: 0 4px 24px rgba(0,0,0,0.3); }
  /* A subdued lower edge keeps stacked compact cards from reading as horizontal rules. */
  .issue-card:not(.high-priority):not(.timer-overdue):not(.sync-failed):not(.local-pending) {
    border-bottom-color: color-mix(in srgb, var(--theme-panel-border-color, var(--color-border, var(--border))) 36%, transparent) !important;
  }
  .issue-card input, .issue-card select, .issue-card textarea { user-select: text !important; touch-action: auto !important; -webkit-user-select: text !important; }
  .issue-card.dragging { transition: none; }
  .issue-card.swiped { border-radius: 18px 18px 0 0; border-bottom-color: transparent; }
  .issue-card-front { min-height: 100%; transform: rotateY(0deg) translateZ(1px); backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform 0.28s cubic-bezier(.2,.78,.22,1); }
  .issue-card.quick-actions-open { min-height: 258px; box-shadow: 0 12px 34px rgba(0,0,0,.42), 0 0 0 2px color-mix(in srgb, var(--color-teal, var(--teal)) 38%, transparent); }
  .issue-card.quick-actions-open .issue-card-front { transform: rotateY(180deg) translateZ(1px); }
  .issue-card.action-confirmed {
    animation: actionCardConfirm 0.85s ease-out both;
    border-color: color-mix(in srgb, var(--action-feedback-color, var(--color-accent, var(--accent))) 60%, var(--color-border, var(--border)));
  }
  .issue-card.resolved-pop {
    animation: actionResolvePop 1s ease-out both;
    border-color: color-mix(in srgb, var(--action-feedback-color, var(--color-success, var(--green))) 70%, var(--color-border, var(--border)));
  }
  .issue-card.resolved-pop::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 2;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(100deg, transparent 0%, color-mix(in srgb, var(--action-feedback-color, var(--color-success, var(--green))) 22%, transparent) 44%, transparent 70%);
    animation: actionResolveSweep 0.85s ease-out both;
  }
  .issue-card.evidence-added {
    animation: actionEvidenceGlow 0.85s ease-out both;
    border-color: color-mix(in srgb, var(--color-teal, var(--teal)) 60%, var(--color-border, var(--border)));
  }
  @keyframes actionCardConfirm {
    0% { box-shadow: 0 4px 24px rgba(0,0,0,0.3), 0 0 0 0 color-mix(in srgb, var(--action-feedback-color, var(--color-accent, var(--accent))) 35%, transparent); }
    42% { transform: translateY(-1px); box-shadow: 0 8px 28px rgba(0,0,0,0.32), 0 0 0 3px color-mix(in srgb, var(--action-feedback-color, var(--color-accent, var(--accent))) 24%, transparent); }
    100% { box-shadow: 0 4px 24px rgba(0,0,0,0.3), 0 0 0 0 transparent; }
  }
  @keyframes actionResolvePop {
    0% { transform: scale(1); box-shadow: 0 4px 24px rgba(0,0,0,0.3); }
    36% { transform: scale(1.012); box-shadow: 0 12px 34px rgba(0,0,0,0.38), 0 0 0 4px color-mix(in srgb, var(--action-feedback-color, var(--color-success, var(--green))) 22%, transparent); }
    100% { transform: scale(1); box-shadow: 0 4px 24px rgba(0,0,0,0.3); }
  }
  @keyframes actionResolveSweep {
    0% { opacity: 0; transform: translateX(-42%); }
    25% { opacity: 1; }
    100% { opacity: 0; transform: translateX(42%); }
  }
  @keyframes actionEvidenceGlow {
    0% { box-shadow: 0 4px 24px rgba(0,0,0,0.3), 0 0 0 0 rgba(20,184,166,0); }
    45% { box-shadow: 0 8px 30px rgba(0,0,0,0.34), 0 0 0 3px color-mix(in srgb, var(--color-teal, var(--teal)) 24%, transparent); }
    100% { box-shadow: 0 4px 24px rgba(0,0,0,0.3), 0 0 0 0 rgba(20,184,166,0); }
  }

  /* Teaser strip - peeks out when dragging */
  .swipe-teaser { position: absolute; right: -4px; top: 50%; transform: translateY(-50%); width: 4px; height: 50px; border-radius: 0 4px 4px 0; opacity: 0; transition: opacity 0.15s, width 0.15s, right 0.15s; pointer-events: none; }
  .issue-card.peeking .swipe-teaser { opacity: 1; width: 6px; right: -6px; }

  /* Swipe category panel animations */
  @keyframes swipeTileIn {
    from { opacity: 0; transform: translateX(16px) scale(0.95); }
    to { opacity: 1; transform: translateX(0) scale(1); }
  }
  @keyframes swipeSubIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
  }

  /* Category panel underneath card - React design */
  .swipe-category-panel { overflow: hidden; max-height: 0; background: var(--color-surface, var(--bg2)); border: 1px solid var(--color-border, var(--border)); border-top: none; border-radius: 0 0 18px 18px; transition: max-height 0.25s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
  .swipe-category-panel.visible { max-height: 400px; }
  .swipe-category-panel.has-subs { border-radius: 0; }

  /* Right-swipe action tray — the physical reverse side of the issue card. */
  .swipe-quick-actions-panel { position: absolute; inset: 0; display: none; overflow: hidden; transform: rotateY(180deg) translateZ(1px); backface-visibility: hidden; -webkit-backface-visibility: hidden; transition: transform 0.28s cubic-bezier(.2,.78,.22,1); background: radial-gradient(circle at 16% 0%, color-mix(in srgb, var(--color-teal, var(--teal)) 24%, transparent), transparent 38%), linear-gradient(145deg, color-mix(in srgb, var(--color-surface, var(--bg2)) 95%, #0d9488 5%), var(--color-surface, var(--bg2))); border-radius: 17px; }
  .swipe-quick-actions-panel.visible { display: block; }
  .issue-card.quick-actions-open .swipe-quick-actions-panel { transform: rotateY(0deg) translateZ(1px); }
  .swipe-quick-actions-heading { display: flex; align-items: baseline; justify-content: space-between; padding: 13px 15px 6px; color: var(--color-text, var(--text)); font-family: 'Rajdhani', sans-serif; font-size: 19px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
  .swipe-quick-actions-heading small { color: var(--color-text-subtle, var(--text3)); font-family: 'Share Tech Mono', monospace; font-size: 10px; font-weight: 400; letter-spacing: .03em; text-transform: none; }
  .swipe-quick-actions-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; padding: 5px 12px 10px; }
  .swipe-quick-action { min-height: 86px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 4px; text-align: center; border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 88%, transparent); border-radius: 17px; padding: 7px 5px; color: var(--color-text, var(--text)); background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 91%, transparent); box-shadow: inset 0 1px 0 rgba(255,255,255,.05), 0 6px 16px rgba(0,0,0,.12); cursor: pointer; font-family: 'Nunito', sans-serif; font-size: 12px; font-weight: 800; line-height: 1.1; transition: transform .14s ease, border-color .14s ease, background .14s ease, box-shadow .14s ease; }
  .swipe-quick-action:hover { transform: translateY(-1px); border-color: color-mix(in srgb, var(--color-teal, var(--teal)) 58%, var(--color-border, var(--border))); }
  .swipe-quick-action:active { transform: scale(.97); }
  .swipe-quick-action-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 15px; background: rgba(255,255,255,.09); font-size: 28px; line-height: 1; box-shadow: inset 0 1px 0 rgba(255,255,255,.12); }
  .swipe-quick-action small { display: none; }
  .swipe-quick-action.photo { border-color: color-mix(in srgb, var(--color-teal, var(--teal)) 42%, var(--color-border, var(--border))); }
  .swipe-quick-action.assign.active { border-color: var(--color-blue, var(--blue)); background: color-mix(in srgb, var(--color-blue, var(--blue)) 14%, var(--color-surface-raised, var(--bg3))); }
  .swipe-quick-action.watch.active { border-color: var(--color-warning, var(--yellow)); background: color-mix(in srgb, var(--color-warning, var(--yellow)) 14%, var(--color-surface-raised, var(--bg3))); }
  .swipe-quick-action.more { border-style: dashed; }
  @media (max-width: 390px) { .swipe-quick-actions-grid { gap: 7px; padding-inline: 10px; } .swipe-quick-action { min-height: 86px; padding: 7px 3px; font-size: 11px; } .swipe-quick-action-icon { width: 44px; height: 44px; font-size: 25px; } }
  .swipe-category-inner { padding: 16px; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }

  /* Status tiles - React design */
  .swipe-status-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px 4px; height: 72px; border-radius: 12px; border: 1px solid transparent; cursor: pointer; transition: all 0.2s; background: var(--color-surface-raised, var(--bg3)); opacity: 0; min-width: 0; overflow: hidden; }
  .swipe-category-panel.visible .swipe-status-tile { animation: swipeTileIn 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards; }
  .swipe-category-panel.visible .swipe-status-tile:nth-child(1) { animation-delay: 0.01s; }
  .swipe-category-panel.visible .swipe-status-tile:nth-child(2) { animation-delay: 0.03s; }
  .swipe-category-panel.visible .swipe-status-tile:nth-child(3) { animation-delay: 0.05s; }
  .swipe-category-panel.visible .swipe-status-tile:nth-child(4) { animation-delay: 0.07s; }
  .swipe-category-panel.visible .swipe-status-tile:nth-child(5) { animation-delay: 0.09s; }
  .swipe-category-panel.visible .swipe-status-tile:nth-child(6) { animation-delay: 0.11s; }
  .swipe-category-panel.visible .swipe-status-tile:nth-child(7) { animation-delay: 0.13s; }
  .swipe-category-panel.visible .swipe-status-tile:nth-child(8) { animation-delay: 0.15s; }
  .swipe-category-panel.visible .swipe-status-tile:nth-child(9) { animation-delay: 0.17s; }
  .swipe-category-panel.visible .swipe-status-tile:nth-child(10) { animation-delay: 0.19s; }
  .swipe-category-panel.visible .swipe-status-tile:nth-child(11) { animation-delay: 0.21s; }
  .swipe-status-tile:hover { background: var(--color-bg, var(--bg)); }
  .swipe-status-tile:active { transform: scale(0.96); }
  .swipe-status-tile.current { background: color-mix(in srgb, currentColor 18%, var(--color-surface-raised, var(--bg3))); border-color: currentColor; box-shadow: 0 0 10px currentColor; }
  .swipe-status-tile.selected { opacity: 1; background: color-mix(in srgb, currentColor 18%, var(--color-surface-raised, var(--bg3))); border-color: currentColor; box-shadow: 0 0 10px currentColor; animation: swipeTileSelectedPulse 1.4s ease-in-out infinite; }
  .swipe-status-tile.confirmed {
    opacity: 1 !important;
    border-color: currentColor;
    animation: swipeTileConfirmed 0.55s ease-out both !important;
  }
  /* Higher specificity to override the nth-child stagger rules when a tile is selected */
  .swipe-category-panel.visible .swipe-status-tile.selected { opacity: 1; animation: swipeTileSelectedPulse 1.4s ease-in-out infinite; }
  .swipe-category-panel.visible .swipe-status-tile.confirmed { opacity: 1; animation: swipeTileConfirmed 0.55s ease-out both !important; }
  .swipe-category-panel.visible.search-mode .swipe-status-tile {
    opacity: 0.5 !important;
    animation: none !important;
    pointer-events: none;
    filter: saturate(0.7) brightness(0.8);
  }
  .swipe-category-panel.visible.search-mode .swipe-search-tile {
    opacity: 1 !important;
    pointer-events: auto;
    filter: none;
  }
  .swipe-category-panel.visible.search-mode .swipe-status-tile.search-match {
    opacity: 1 !important;
    animation: searchCatPulse 1.4s ease-in-out infinite !important;
    pointer-events: auto;
    filter: none;
  }
  @keyframes swipeTileSelectedPulse {
    0%, 100% { box-shadow: 0 0 8px currentColor; }
    50%       { box-shadow: 0 0 18px currentColor, 0 0 32px color-mix(in srgb, currentColor 40%, transparent); }
  }
  @keyframes swipeTileConfirmed {
    0% { transform: scale(1); box-shadow: 0 0 8px currentColor; }
    42% { transform: scale(1.04); box-shadow: 0 0 18px currentColor, 0 0 0 4px color-mix(in srgb, currentColor 18%, transparent); }
    100% { transform: scale(1); box-shadow: 0 0 8px currentColor; }
  }
  @keyframes searchCatPulse {
    0%, 100% { box-shadow: 0 0 6px currentColor; }
    50%       { box-shadow: 0 0 16px currentColor, 0 0 28px color-mix(in srgb, currentColor 35%, transparent); }
  }
  .swipe-category-inner.has-selection .swipe-status-tile.current:not(.selected) {
    background: var(--color-surface-raised, var(--bg3));
    border-color: transparent;
    box-shadow: none;
  }
  .swipe-tile-icon { font-size: 24px; line-height: 1; display: flex; align-items: center; justify-content: center; height: 32px; width: 32px; }
  .swipe-tile-label { font-size: 10px; font-weight: 500; text-align: center; font-family: 'Nunito', sans-serif; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 100%; }

  /* Sub-status panel underneath categories - React design */
  .swipe-sub-panel { overflow: hidden; max-height: 0; background: var(--color-bg, var(--bg)); border: 1px solid var(--color-border, var(--border)); border-top: none; border-radius: 0 0 18px 18px; transition: max-height 0.2s cubic-bezier(0.25, 0.46, 0.45, 0.94); }
  .swipe-sub-panel.visible { max-height: 500px; overflow-y: auto; }
  .swipe-sub-inner { padding: 12px 16px; display: block; }
  .swipe-sub-inner::after { content: ''; display: table; clear: both; }
  .swipe-sub-cancel { display:inline-flex; align-items:center; justify-content:center; width:30px; height:30px; margin:0 8px 8px 0; vertical-align:top; border-radius:9px; border:1px solid color-mix(in srgb, var(--color-border, var(--border)) 72%, #fff 28%); background:linear-gradient(180deg, color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 82%, #fff 18%) 0%, var(--color-surface-raised, var(--bg3)) 100%); box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), 0 2px 5px rgba(0,0,0,0.24); color:var(--color-text-muted, var(--text2)); cursor:pointer; transition:transform 0.12s, box-shadow 0.12s, color 0.12s, border-color 0.12s; opacity:0; animation:swipeSubIn 0.25s ease forwards; }
  .swipe-sub-cancel:hover { color:var(--color-text, var(--text)); border-color:color-mix(in srgb, var(--color-border, var(--border)) 45%, #fff 55%); box-shadow: inset 0 1px 0 rgba(255,255,255,0.24), 0 3px 8px rgba(0,0,0,0.3); }
  .swipe-sub-cancel:active { transform: translateY(1px) scale(0.96); box-shadow: inset 0 1px 0 rgba(255,255,255,0.18), 0 1px 2px rgba(0,0,0,0.3); }
  .swipe-sub-cancel span { font-size:14px; font-weight:800; line-height:1; }
  .swipe-sub-inner .subcategory-item { opacity: 0; animation: swipeSubIn 0.25s ease forwards; }
  .swipe-sub-inner .subcategory-item:nth-child(1) { animation-delay: 0.02s; }
  .swipe-sub-inner .subcategory-item:nth-child(2) { animation-delay: 0.06s; }
  .swipe-sub-inner .subcategory-item:nth-child(3) { animation-delay: 0.10s; }
  .swipe-sub-inner .subcategory-item:nth-child(4) { animation-delay: 0.14s; }
  .swipe-sub-inner .subcategory-item:nth-child(5) { animation-delay: 0.18s; }
  .swipe-sub-inner .subcategory-item:nth-child(6) { animation-delay: 0.22s; }
  .swipe-sub-inner .subcategory-item:nth-child(7) { animation-delay: 0.26s; }
  .swipe-sub-inner .subcategory-item:nth-child(8) { animation-delay: 0.30s; }
  .swipe-sub-inner .subcategory-item.skip { border-style: dashed; opacity: 0.8; }
  .swipe-sub-inner .subcategory-item.confirmed {
    opacity: 1;
    animation: subcategoryConfirmed 0.52s ease-out both !important;
  }
  @keyframes subcategoryConfirmed {
    0% { transform: scale(1); box-shadow: none; }
    45% { transform: scale(1.02); box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 18%, transparent); }
    100% { transform: scale(1); box-shadow: none; }
  }

  @keyframes slideIn { from{opacity:0;transform:translateY(-6px)}to{opacity:1;transform:translateY(0)} }
  .issue-card:hover { border-color: var(--color-text-subtle, var(--text3)); }
  .issue-card.resolved { opacity: 0.65; border-color: rgba(34,197,94,0.3); }
  .issue-card.high-priority { border-color: rgba(239,68,68,0.5); box-shadow: 0 4px 24px rgba(0,0,0,0.3), inset 3px 0 0 #ef4444; }
  .issue-card.timer-overdue { border-color: rgba(248,113,113,0.9); animation: timerHotPulse 1.1s ease-in-out infinite; }
  @keyframes timerHotPulse {
    0%, 100% {
      border-color: rgba(248,113,113,0.55);
      box-shadow: 0 4px 24px rgba(0,0,0,0.3), inset 3px 0 0 #ef4444, 0 0 0 rgba(239,68,68,0);
    }
    50% {
      border-color: rgba(248,113,113,1);
      box-shadow: 0 4px 24px rgba(0,0,0,0.3), inset 3px 0 0 #ef4444, 0 0 18px rgba(239,68,68,0.45);
    }
  }
  .priority-btn { width: 28px; height: 28px; border-radius: 50%; border: 1px solid rgba(107,114,128,0.4); background: transparent; color: #6b7280; font-size: 13px; font-weight: 900; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.15s; line-height: 1; margin-top: 4px; font-family: 'Rajdhani', sans-serif; }
  .priority-btn:hover { border-color: #ef4444; color: #ef4444; background: rgba(239,68,68,0.08); }
  .priority-btn.active { border-color: #ef4444; color: #ef4444; background: rgba(239,68,68,0.15); box-shadow: 0 0 8px rgba(239,68,68,0.3); }


  /* Issue Card Header - React design */
  .issue-card-header { padding: 16px 16px 0; cursor: pointer; user-select: none; }
  .issue-card-top { display: flex; align-items: flex-start; gap: 12px; }
  .issue-card-bottom { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0 12px; }
  .issue-card-footer { display:flex; justify-content:flex-start; padding: 8px 16px 12px; }
  .solution-card-block { margin: 12px 16px 0; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--color-success, var(--green)) 38%, var(--color-border, var(--border))); border-radius: 10px; background: color-mix(in srgb, var(--color-success, var(--green)) 7%, var(--color-surface-raised, var(--bg3))); }
  .solution-card-head { display:flex; align-items:center; gap:7px; color:var(--color-success, var(--green)); font-size:11px; font-weight:800; text-transform:uppercase; letter-spacing:.06em; }
  .solution-card-meta { margin-left:auto; color:var(--color-text-subtle, var(--text3)); font-size:10px; font-weight:600; text-transform:none; letter-spacing:0; }
  .solution-card-text { margin-top:6px; color:var(--color-text, var(--text)); font-size:13px; line-height:1.42; white-space:pre-wrap; }
  .solution-photo-strip { display:flex; gap:6px; margin-top:9px; overflow-x:auto; }
  .solution-photo-thumb { width:54px; height:54px; object-fit:cover; border:1px solid var(--color-border, var(--border)); border-radius:7px; cursor:pointer; }
  .tl-solution-icon { display:inline-flex; align-items:center; justify-content:center; width:22px; height:22px; margin-left:4px; border:1px solid color-mix(in srgb, var(--color-success, var(--green)) 48%, var(--color-border, var(--border))); border-radius:999px; background:color-mix(in srgb, var(--color-success, var(--green)) 10%, transparent); color:var(--color-success, var(--green)); cursor:pointer; font-size:12px; line-height:1; vertical-align:middle; }
  .tl-solution-icon:hover { background:color-mix(in srgb, var(--color-success, var(--green)) 20%, transparent); border-color:var(--color-success, var(--green)); }
  .solution-in-resolved { margin:10px 0 2px; }
  .solution-modal textarea { min-height:112px; }
  .form-optional { color:var(--color-text-subtle, var(--text3)); font-size:10px; font-weight:600; text-transform:none; }
  .issue-footer-actions-left { display:flex; align-items:center; gap:10px; }
  .priority-btn-inline { margin-top: 0; width: 42px; height: 42px; font-size: 16px; }
  .issue-reminder-btn { border:1px solid rgba(96,165,250,0.42); border-radius:8px; background:linear-gradient(180deg, rgba(59,130,246,0.14), rgba(14,165,233,0.08)); color:#dbeafe; padding:8px 11px; cursor:pointer; display:inline-flex; align-items:center; gap:9px; min-height:42px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.06); }
  .issue-reminder-btn:hover { border-color: rgba(125,211,252,0.75); background:linear-gradient(180deg, rgba(59,130,246,0.2), rgba(14,165,233,0.12)); }
  .issue-reminder-btn.overdue { border-color: rgba(248,113,113,0.62); color:#fee2e2; background:linear-gradient(180deg, rgba(239,68,68,0.18), rgba(251,113,133,0.1)); }
  .issue-reminder-btn.paused { border-color: rgba(251,191,36,0.48); color:#fdecc8; background:linear-gradient(180deg, rgba(245,158,11,0.15), rgba(120,53,15,0.1)); }
  .issue-reminder-btn.inactive { border-color: var(--color-border, var(--border)); background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.04)); color: var(--color-text-muted, var(--text2)); }
  .issue-reminder-btn.inactive:hover { border-color: var(--color-text-subtle, var(--text3)); background: rgba(255,255,255,0.08); }
  .issue-reminder-icon { width:26px; height:26px; border-radius:50%; display:inline-flex; align-items:center; justify-content:center; background:rgba(255,255,255,0.08); flex:0 0 auto; }
  .issue-reminder-copy { display:flex; flex-direction:column; align-items:flex-start; line-height:1.05; min-width:0; }
  .issue-reminder-label { font-size:10px; font-weight:800; letter-spacing:.08em; text-transform:uppercase; font-family:'Nunito',sans-serif; color:var(--color-text-muted, var(--text2)); }
  .issue-reminder-time { font-family:'Share Tech Mono', monospace; font-size:16px; font-weight:800; color:inherit; }
  .timer-mini-badge { display:inline-flex; align-items:center; gap:5px; padding:2px 7px; border-radius:999px; border:1px solid rgba(96,165,250,0.38); background:rgba(59,130,246,0.1); color:#bfdbfe; font-family:'Share Tech Mono', monospace; font-size:11px; font-weight:800; line-height:1.4; }
  .timer-mini-badge.overdue { border-color:rgba(248,113,113,0.55); background:rgba(239,68,68,0.12); color:#fecaca; }
  .timer-mini-badge.paused { border-color:rgba(251,191,36,0.48); background:rgba(245,158,11,0.12); color:#fde68a; }
  .timer-mini-dot { width:6px; height:6px; border-radius:50%; background:#38bdf8; box-shadow:0 0 8px rgba(56,189,248,0.65); }
  .timer-mini-badge.overdue .timer-mini-dot { background:#f87171; box-shadow:0 0 8px rgba(248,113,113,0.72); }
  .timer-mini-badge.paused .timer-mini-dot { background:#fbbf24; box-shadow:0 0 8px rgba(251,191,36,0.65); }
  .issue-status-wrap { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; flex: 1; min-width: 0; }
  
  /* Compact workflow step buttons (card header) */
  .wf-status-header { display: flex; align-items: center; gap: 8px; width: 100%; }
  .wf-steps { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
  .wf-steps.has-escalation { gap: 5px; }
  .wf-step-btn { display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 80%, transparent); background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 76%, transparent); color: var(--color-text-muted, var(--text2)); cursor: pointer; transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.15s, opacity 0.15s, box-shadow 0.15s; user-select: none; font-size: 13px; padding: 0; box-shadow: none; }
  .wf-escalate-btn { position: relative; display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex: 0 0 26px; border-radius: 6px; border: 1px solid color-mix(in srgb, var(--escalate-color, var(--color-accent, var(--accent))) 52%, transparent); background: color-mix(in srgb, var(--escalate-color, var(--color-accent, var(--accent))) 13%, transparent); color: var(--escalate-color, var(--color-accent, var(--accent))); cursor: pointer; font-size: 13px; font-weight: 900; line-height: 1; padding: 0; transition: transform 0.15s, background 0.15s, box-shadow 0.15s; }
  .wf-escalate-btn:hover { transform: translateY(-1px); background: color-mix(in srgb, var(--escalate-color, var(--color-accent, var(--accent))) 20%, transparent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--escalate-color, var(--color-accent, var(--accent))) 12%, transparent); }
  .wf-escalate-btn:active { transform: translateY(0) scale(0.96); }
  .wf-escalate-count {
    position: absolute;
    top: -6px;
    right: -6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 14px;
    height: 14px;
    border: 1px solid color-mix(in srgb, var(--escalate-color, var(--color-accent, var(--accent))) 64%, #fff 12%);
    border-radius: 999px;
    background: var(--color-surface, var(--bg2));
    color: var(--escalate-color, var(--color-accent, var(--accent)));
    font-family: 'Share Tech Mono', monospace;
    font-size: 8px;
    font-weight: 900;
    line-height: 1;
    padding: 0 3px;
    box-shadow: 0 0 8px color-mix(in srgb, var(--escalate-color, var(--color-accent, var(--accent))) 24%, transparent);
  }
  .wf-step-btn:hover { background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 88%, #fff 12%); border-color: color-mix(in srgb, var(--color-text-subtle, var(--text3)) 68%, transparent); color: var(--color-text, var(--text)); transform: translateY(-1px); }
  .wf-step-btn.wf-step-confirmed { animation: workflowStepConfirmed 0.62s ease-out both; }
  .wf-step-btn.pending { opacity: 0.28; background: transparent; border-color: color-mix(in srgb, var(--color-border, var(--border)) 48%, transparent); }
  .wf-step-btn.completed { opacity: 0.56; background: rgba(34,197,94,0.06); border-color: rgba(34,197,94,0.2); color: rgba(134,239,172,0.7); }
  .wf-step-btn.active { opacity: 1; color: #fff; box-shadow: 0 0 0 2px rgba(255,255,255,0.04), 0 0 10px rgba(0,0,0,0.28); animation: none; }
  .wf-step-btn.active.called { background: rgba(234,179,8,0.18); border-color: #eab308; box-shadow: 0 0 0 2px rgba(234,179,8,0.14); }
  .wf-step-btn.active.accepted { background: rgba(34,197,94,0.18); border-color: #22c55e; box-shadow: 0 0 0 2px rgba(34,197,94,0.14); }
  .wf-step-btn.active.in-progress { background: rgba(59,130,246,0.18); border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59,130,246,0.14); }
  .wf-step-btn.active.finished { background: rgba(168,85,247,0.18); border-color: #a855f7; box-shadow: 0 0 0 2px rgba(168,85,247,0.14); }
  @keyframes workflowStepConfirmed {
    0% { transform: scale(1); }
    40% { transform: scale(1.16); box-shadow: 0 0 0 4px color-mix(in srgb, currentColor 20%, transparent); }
    100% { transform: scale(1); }
  }
  @keyframes wfPulseCalled {
    0%, 100% { box-shadow: 0 0 6px rgba(234,179,8,0.45); border-color: #eab308; }
    50%       { box-shadow: 0 0 16px rgba(234,179,8,0.85), 0 0 28px rgba(234,179,8,0.35); border-color: #fde047; }
  }
  @keyframes wfPulseAccepted {
    0%, 100% { box-shadow: 0 0 6px rgba(34,197,94,0.45); border-color: #22c55e; }
    50%       { box-shadow: 0 0 16px rgba(34,197,94,0.85), 0 0 28px rgba(34,197,94,0.35); border-color: #4ade80; }
  }
  @keyframes wfPulseInProgress {
    0%, 100% { box-shadow: 0 0 6px rgba(59,130,246,0.45); border-color: #3b82f6; }
    50%       { box-shadow: 0 0 16px rgba(59,130,246,0.85), 0 0 28px rgba(59,130,246,0.35); border-color: #60a5fa; }
  }
  @keyframes wfPulseFinished {
    0%, 100% { box-shadow: 0 0 6px rgba(168,85,247,0.45); border-color: #a855f7; }
    50%       { box-shadow: 0 0 16px rgba(168,85,247,0.85), 0 0 28px rgba(168,85,247,0.35); border-color: #c084fc; }
  }
  .issue-machine-tag { font-family: 'Rajdhani', sans-serif; font-size: 17px; font-weight: 700; letter-spacing: 1px; background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 8px; padding: 6px 10px; color: var(--color-accent, var(--accent)); white-space: nowrap; flex-shrink: 0; line-height: 1; margin-top: 4px; }
  .issue-serial-tag { font-family: 'Share Tech Mono', monospace; font-size: 11px; font-weight: 700; color: var(--color-text-muted, var(--text2)); background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 60%, transparent); border: 1px dashed var(--color-border, var(--border)); border-radius: 6px; padding: 4px 6px; display: inline-flex; align-items: center; gap: 4px; line-height: 1; white-space: nowrap; user-select: all; letter-spacing: 0.05em; margin-bottom: 2px; }
  .issue-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; }
  .issue-route-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
  .issue-route {
    min-width: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    margin-bottom: 6px;
  }
  .issue-route-category-line {
    min-width: 0;
    display: inline-flex;
    align-items: center;
    max-width: 100%;
  }
  .issue-route-category {
    min-width: 0;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid transparent;
    line-height: 1.2;
  }
  .issue-route-caret { display: none; }
  .issue-route-subcategory {
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 10px;
    font-weight: 600;
    background: var(--color-surface-raised, var(--bg3));
    border: 1px solid var(--color-border, var(--border));
    color: var(--color-text-muted, var(--text2));
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: none;
    line-height: 1.2;
  }
  .issue-note-preview { display:block; width:100%; font-size: 16.5px; color: var(--color-text, var(--text)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; letter-spacing: 0; margin-top: 8px; line-height: 1.25; }
  .issue-time { font-family: 'Nunito', sans-serif; font-size: 12.5px; font-weight: 500; color: var(--color-text-subtle, var(--text3)); margin-top: 4px; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; line-height: 1.4; }
  .issue-alert-focus-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--color-accent, var(--accent)) 34%, transparent);
    background: color-mix(in srgb, var(--color-accent, var(--accent)) 14%, rgba(255,255,255,0.04));
    color: var(--color-accent, var(--accent));
    font-size: 10px;
    font-family: 'Share Tech Mono', monospace;
    text-transform: uppercase;
    letter-spacing: 0.08em;
  }
  .issue-submitter { color: var(--color-text-muted, var(--text2)); }
  .issue-created-at { color: var(--color-text-muted, var(--text2)); font-family: 'Share Tech Mono', monospace; }
  .issue-status { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; font-size: 11px; font-weight: 700; padding: 4px 9px; border-radius: 9999px; flex: 0 1 auto; width: fit-content; min-width: 104px; max-width: 100%; overflow: hidden; text-transform: uppercase; letter-spacing: 0.04em; }
  .issue-status-main { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; max-width: 100%; min-width: 0; }
  .issue-status-sub { display: block; max-width: 100%; font-size: 11.5px; font-weight: 600; opacity: 0.9; text-transform: none; letter-spacing: 0.02em; white-space: normal; overflow-wrap: anywhere; word-break: break-word; line-height: 1.35; margin-left: 12px; }
  /* ── SECONDARY STATUS DOTS (card header) ── */
  .secondary-status-dots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
  .secondary-dot { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 9999px; border: 1px solid; text-transform: uppercase; letter-spacing: 0.04em; }
  /* ── ALSO WAITING ON (card body) ── */
  .also-needs-section { padding: 10px 0 6px; }
  .also-needs-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--color-text-subtle, var(--text3)); margin-bottom: 7px; }
  .also-needs-chips { display: flex; flex-wrap: wrap; gap: 6px; }
  .also-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 5px 12px; border-radius: 9999px; border: 1px solid; cursor: pointer; transition: all 0.15s; user-select: none; }
  .also-chip.inactive { opacity: 0.35; }
  .also-chip.inactive:hover { opacity: 0.65; }
  .also-chip.active { box-shadow: 0 0 8px color-mix(in srgb, currentColor 50%, transparent); }
  .also-chip.active::after { content: ' ✓'; font-size: 9px; opacity: 0.8; }
  .issue-sub-label { font-size: 11px; color: var(--color-text-subtle, var(--text3)); font-family: 'Share Tech Mono', monospace; white-space: nowrap; margin-left: 4px; }
  .status-open       { background: rgba(239,68,68,0.1);  color: #f87171; border: 1px solid rgba(239,68,68,0.3); }
  .status-resolved   { background: rgba(34,197,94,0.1);  color: #4ade80; border: 1px solid rgba(34,197,94,0.3); }
  .status-alert      { background: #2a2416; color: #eab308; border: 1px solid #40351e; }
  .status-maintenance{ background: #211a12; color: #d89f53; border: 1px solid #a87532; }
  .status-tooldie    { background: rgba(232,122,62,0.1); color: #fb923c; border: 1px solid rgba(232,122,62,0.3); }
  .status-moldchange { background: rgba(96,165,250,0.1); color: #60a5fa; border: 1px solid rgba(96,165,250,0.3); }
  .status-startup    { background: rgba(52,211,153,0.1); color: #34d399; border: 1px solid rgba(52,211,153,0.3); }
  .status-processengineer { background: rgba(34,211,238,0.1); color: #22d3ee; border: 1px solid rgba(34,211,238,0.3); }
  .status-controlman { background: rgba(96,165,250,0.1); color: #60a5fa; border: 1px solid rgba(96,165,250,0.3); }
  .status-quality    { background: rgba(251,113,133,0.1); color: #fb7185; border: 1px solid rgba(251,113,133,0.3); }
  .status-materials  { background: rgba(156,163,175,0.1); color: #9ca3af; border: 1px solid rgba(156,163,175,0.3); }
  .status-production { background: rgba(37,99,235,0.1); color: #60a5fa; border: 1px solid rgba(37,99,235,0.3); }
  .status-safety     { background: rgba(220,38,38,0.1); color: #f87171; border: 1px solid rgba(220,38,38,0.3); }
  .issue-expand-icon { color: var(--color-text-subtle, var(--text3)); font-size: 12px; transition: transform 0.2s, color 0.2s; flex-shrink: 0; margin-left: auto; padding-top: 4px; }
  .issue-expand-icon:hover { color: var(--color-text, var(--text)); }
  .issue-expand-icon.open { transform: rotate(180deg); }
  .issue-row.alert-focus-issue { z-index: 3; }
  .issue-row.alert-focus-issue .issue-card {
    border-color: color-mix(in srgb, var(--color-accent, var(--accent)) 55%, var(--color-border, var(--border)));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-accent, var(--accent)) 22%, transparent), 0 12px 34px rgba(0,0,0,0.34);
  }

  .issue-body { display: none; padding: 12px 16px 16px; border-top: 1px solid var(--color-border, var(--border)); }
  .issue-body.visible { display: block; }
  .issue-body input, .issue-body select, .issue-body textarea, .issue-body button { pointer-events: auto !important; user-select: auto !important; }
  
  /* Force all form elements to be interactive */
  input, select, textarea {
    pointer-events: auto !important;
    user-select: text !important;
    -webkit-user-select: text !important;
    touch-action: auto !important;
  }
  
  input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--color-accent, var(--accent)) !important;
  }
  
  /* Header workflow wrap — small buttons + state label below */
  .wf-steps-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex-shrink: 0; min-width: 126px; }
  .wf-steps-row { display: flex; align-items: center; gap: 5px; }
  .wf-state-label,
  .wf-state-meta,
  .wf-state-actor { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; }
  .wf-state-age { font-family: 'Share Tech Mono', monospace; font-size: 10px; font-weight: 700; line-height: 1.05; margin-top: -1px; }
  .wf-state-meta,
  .wf-state-actor {
    opacity: 0.9;
    margin-top: -1px;
    line-height: 1.05;
  }
  .wf-state-label.called      { color: #eab308; animation: none; }
  .wf-state-label.accepted    { color: #22c55e; animation: none; }
  .wf-state-label.in-progress { color: #3b82f6; animation: none; }
  .wf-state-label.finished    { color: #a855f7; animation: none; }
  .wf-state-meta.called,
  .wf-state-actor.called      { color: #eab308; animation: none; }
  .wf-state-age.called        { color: #eab308; }
  .wf-state-meta.accepted,
  .wf-state-actor.accepted    { color: #22c55e; animation: none; }
  .wf-state-age.accepted      { color: #22c55e; }
  .wf-state-meta.in-progress,
  .wf-state-actor.in-progress { color: #3b82f6; animation: none; }
  .wf-state-age.in-progress   { color: #3b82f6; }
  .wf-state-meta.finished,
  .wf-state-actor.finished    { color: #a855f7; animation: none; }
  .wf-state-age.finished      { color: #a855f7; }
  @keyframes wfLabelPulseCalled     { 0%,100% { opacity: 0.6; text-shadow: none; } 50% { opacity: 1; text-shadow: 0 0 8px rgba(234,179,8,0.9), 0 0 16px rgba(234,179,8,0.5); } }
  @keyframes wfLabelPulseAccepted   { 0%,100% { opacity: 0.6; text-shadow: none; } 50% { opacity: 1; text-shadow: 0 0 8px rgba(34,197,94,0.9),  0 0 16px rgba(34,197,94,0.5);  } }
  @keyframes wfLabelPulseInProgress { 0%,100% { opacity: 0.6; text-shadow: none; } 50% { opacity: 1; text-shadow: 0 0 8px rgba(59,130,246,0.9), 0 0 16px rgba(59,130,246,0.5); } }
  @keyframes wfLabelPulseFinished   { 0%,100% { opacity: 0.6; text-shadow: none; } 50% { opacity: 1; text-shadow: 0 0 8px rgba(168,85,247,0.9), 0 0 16px rgba(168,85,247,0.5); } }
  /* Pulsing prompt arrow shown before first workflow action */
  .wf-prompt-arrow { width: 0; height: 0; border-top: 6px solid transparent; border-bottom: 6px solid transparent; border-left: 10px solid #22c55e; flex-shrink: 0; margin-left: -6px; margin-right: 2px; animation: wfArrowPulse 1.05s ease-in-out infinite; pointer-events: none; }
  .wf-prompt-arrow.wf-arrow-dismissed { animation: wfArrowDismiss 0.35s ease-out forwards; }
  @keyframes wfArrowPulse {
    0%, 100% { transform: translateX(0) scale(1);     opacity: 1;   }
    45%       { transform: translateX(5px) scale(1.2); opacity: 0.45; }
    65%       { transform: translateX(3px) scale(1.1); opacity: 0.75; }
  }
  @keyframes wfArrowDismiss {
    to { opacity: 0; transform: translateX(14px) scale(0.2); width: 0; margin: 0; padding: 0; overflow: hidden; }
  }

  /* Per-status workflow rows (always-visible, inside card header) */
  .wf-status-rows { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; padding: 8px 0 0; border-top: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 58%, transparent); }
  .wf-status-row { position: relative; display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 8px 10px; padding: 8px 8px 8px 10px; border-bottom: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 30%, transparent); border-radius: 8px; background: transparent; cursor: pointer; }
  .wf-status-row {
    box-shadow: inset 0 0 0 color-mix(in srgb, currentColor 0%, transparent);
    transition: background 0.15s, box-shadow 0.15s;
  }
  .wf-status-row::before {
    content: '';
    position: absolute;
    left: 4px;
    top: 50%;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: color-mix(in srgb, currentColor 72%, transparent);
    opacity: 0;
    transform: translateY(-50%);
    transition: opacity 0.15s;
  }
  .wf-status-row:hover,
  .wf-status-row.open { box-shadow: inset 2px 0 0 color-mix(in srgb, currentColor 72%, transparent); }
  .wf-status-row:hover::before,
  .wf-status-row.open::before { opacity: 1; }
  .wf-status-row:hover,
  .wf-status-row.open { background: color-mix(in srgb, currentColor 7%, transparent); }
  .wf-status-row:last-child { border-bottom: none; }
  .wf-status-row-info { flex: 1 1 96px; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; }
  .wf-status-row > .wf-steps-wrap { margin-left: auto; }
  .wf-status-row-info .issue-status-sub { margin-left: 2px; color: var(--color-text-subtle, var(--text3)) !important; }
  .wf-status-dropdown { display: none; width: 100%; flex: 0 0 100%; padding: 2px 0 0 0; cursor: default; }
  .wf-status-row.open .wf-status-dropdown { display: block; }
  .wf-status-dropdown-panel { display: grid; gap: 8px; padding: 0 0 2px; }
  .wf-dropdown-section { display: grid; gap: 6px; }
  .wf-dropdown-label { color: var(--color-text-subtle, var(--text3)); font-size: 9px; font-weight: 800; letter-spacing: 0.08em; line-height: 1; text-transform: uppercase; }
  .wf-dropdown-empty { color: var(--color-text-subtle, var(--text3)); font-size: 11px; font-weight: 650; padding: 6px 8px; border: 1px dashed color-mix(in srgb, var(--color-border, var(--border)) 75%, transparent); border-radius: 7px; background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 42%, transparent); }
  .wf-tool-row { display: flex; align-items: center; justify-content: space-between; gap: 9px; width: 100%; margin-top: 3px; padding: 7px 8px; border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 42%, transparent); border-radius: 15px; background: linear-gradient(180deg, color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 76%, transparent), color-mix(in srgb, var(--color-surface, var(--bg2)) 58%, transparent)); box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 12px 28px rgba(0,0,0,0.18); backdrop-filter: blur(12px) saturate(1.15); -webkit-backdrop-filter: blur(12px) saturate(1.15); }
  .wf-tool-group { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; min-width: 0; }
  .wf-tool-group.status-tools { padding-right: 9px; border-right: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 48%, transparent); }
  .wf-tool-group.route-tools { margin-left: auto; padding-left: 2px; justify-content: flex-end; }
  .wf-tool-group.delete-tools { margin-left: 0; padding-left: 9px; border-left: 1px solid color-mix(in srgb, var(--color-danger, var(--red)) 34%, transparent); justify-content: flex-end; }
  .wf-tool-group.status-tools + .wf-tool-group.delete-tools { margin-left: auto; }
  .wf-tool-btn { position: relative; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: 1px solid color-mix(in srgb, var(--route-color, currentColor) 30%, rgba(255,255,255,0.2)); border-radius: 12px; background: radial-gradient(circle at 50% 15%, rgba(255,255,255,0.28), transparent 38%), linear-gradient(180deg, color-mix(in srgb, var(--route-color, currentColor) 17%, var(--color-surface-raised, var(--bg3))), color-mix(in srgb, var(--route-color, currentColor) 7%, var(--color-surface, var(--bg2)))); color: var(--route-color, currentColor); cursor: pointer; box-shadow: inset 0 1px 0 rgba(255,255,255,0.2), inset 0 -10px 18px rgba(0,0,0,0.08), 0 7px 14px rgba(0,0,0,0.2); padding: 0; transition: background 0.15s, border-color 0.15s, box-shadow 0.15s, transform 0.15s; }
  .wf-tool-btn::after { content: ''; position: absolute; left: 50%; bottom: 4px; width: 14px; height: 2px; border-radius: 999px; background: color-mix(in srgb, currentColor 42%, transparent); opacity: 0.55; transform: translateX(-50%); }
  .wf-tool-btn:hover { border-color: color-mix(in srgb, var(--route-color, currentColor) 62%, rgba(255,255,255,0.28)); background: radial-gradient(circle at 50% 12%, rgba(255,255,255,0.36), transparent 40%), linear-gradient(180deg, color-mix(in srgb, var(--route-color, currentColor) 24%, var(--color-surface-raised, var(--bg3))), color-mix(in srgb, var(--route-color, currentColor) 11%, var(--color-surface, var(--bg2)))); box-shadow: inset 0 1px 0 rgba(255,255,255,0.24), inset 0 -10px 18px rgba(0,0,0,0.08), 0 0 0 2px color-mix(in srgb, var(--route-color, currentColor) 13%, transparent), 0 12px 22px rgba(0,0,0,0.25); transform: translateY(-4px) scale(1.08); }
  .wf-tool-group.status-tools .wf-tool-btn { border-color: color-mix(in srgb, currentColor 58%, rgba(255,255,255,0.26)); background: transparent; color: color-mix(in srgb, currentColor 82%, var(--color-text, var(--text))); box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04), 0 6px 14px rgba(0,0,0,0.16); }
  .wf-tool-group.status-tools .wf-tool-btn::after { background: currentColor; opacity: 0.28; }
  .wf-tool-group.status-tools .wf-tool-btn:hover { border-color: color-mix(in srgb, currentColor 88%, rgba(255,255,255,0.38)); background: transparent; color: var(--color-text, var(--text)); box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 18%, transparent), 0 0 0 2px color-mix(in srgb, currentColor 16%, transparent), 0 12px 22px rgba(0,0,0,0.24); }
  .wf-tool-btn:active { transform: translateY(-1px) scale(0.98); }
  .wf-tool-btn.translate { border-style: dashed; }
  .wf-tool-btn.delete-btn { --route-color: var(--color-danger, var(--red)); }
  .wf-tool-btn.confirm-delete { width: auto; min-width: 58px; height: 34px; padding: 0 9px; border-radius: 11px; border-color: var(--color-danger, var(--red)); color: var(--color-danger, var(--red)); background: radial-gradient(circle at 50% 15%, rgba(255,255,255,0.25), transparent 38%), linear-gradient(180deg, color-mix(in srgb, var(--color-danger, var(--red)) 18%, var(--color-surface-raised, var(--bg3))), color-mix(in srgb, var(--color-danger, var(--red)) 8%, var(--color-surface, var(--bg2)))); transform: none; }
  .wf-tool-btn.confirm-delete::after { display: none; }
  .wf-tool-btn.confirm-delete:hover { transform: none; }
  .wf-tool-btn.confirm-delete:active { transform: scale(0.98); }
  .wf-tool-btn.confirm-delete .wf-tool-icon { font-size: 10px; font-weight: bold; line-height: 1; filter: none; }
  .wf-tool-icon { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 950; line-height: 1; filter: drop-shadow(0 1px 0 rgba(255,255,255,0.12)) drop-shadow(0 2px 3px rgba(0,0,0,0.28)); }
  .wf-tool-badge { position: absolute; right: -5px; top: -6px; min-width: 15px; height: 15px; padding: 0 4px; border: 1px solid color-mix(in srgb, var(--route-color, currentColor) 58%, var(--color-surface, var(--bg2))); border-radius: 999px; background: var(--color-surface, var(--bg2)); color: var(--route-color, currentColor); font-family: 'Share Tech Mono', monospace; font-size: 9px; font-weight: 900; line-height: 14px; text-align: center; box-shadow: 0 2px 8px rgba(0,0,0,0.22); }
  @media (max-width: 420px) {
    .issue-card-header { padding: 14px 14px 0; }
    .issue-card-top { gap: 9px; }
    .issue-machine-tag { font-size: 16px; padding: 6px 9px; }
    .issue-note-preview { font-size: 16px; margin-top: 7px; }
    .wf-status-row { gap: 8px; }
    .wf-steps-wrap { min-width: 0; }
    .wf-step-btn { width: 29px; height: 29px; }
    .wf-status-dropdown { padding-left: 0; }
    .wf-tool-row { gap: 7px; padding: 7px; }
    .wf-tool-group { gap: 7px; }
    .wf-tool-group.status-tools { padding-right: 7px; }
    .wf-tool-group.delete-tools { padding-left: 7px; }
    .wf-tool-btn { width: 35px; height: 35px; border-radius: 11px; }
    .wf-tool-icon { font-size: 16px; }
  }
  @media (max-width: 360px) {
    .wf-status-row {
      flex-wrap: wrap;
    }
    .wf-steps-wrap {
      width: 100%;
      min-width: 0;
      align-items: flex-end;
    }
  }
  .tl-entry.finished-checkered {
    position: relative;
    opacity: 1;
    border-color: rgba(34,197,94,.24);
    border-left-color: rgba(34,197,94,.75) !important;
    background: linear-gradient(90deg, rgba(34,197,94,.10), color-mix(in srgb, var(--color-surface, var(--bg2)) 92%, rgba(34,197,94,.08))) !important;
    box-shadow: inset 0 0 0 1px rgba(34,197,94,.08);
  }
  .tl-entry.finished-checkered::before {
    content: "Done";
    position: absolute;
    top: 9px;
    right: 10px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(34,197,94,.92);
    border: 1px solid rgba(34,197,94,.24);
    border-radius: 999px;
    padding: 2px 7px;
    background: rgba(34,197,94,.08);
  }
  .tl-entry.finished-checkered .tl-wf-badge {
    color: #22c55e !important;
  }
  .tl-entry.finished-checkered .tl-status-label {
    padding-right: 54px;
  }
  .issue-full-note { font-size: 14px; line-height: 1.6; color: var(--color-text, var(--text)); margin-bottom: 10px; white-space: pre-wrap; word-break: break-word; }
  .issue-photos { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
  .issue-photo-thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; border: 1px solid var(--color-border, var(--border)); cursor: pointer; transition: transform 0.15s; }
  .issue-photo-thumb:hover { transform: scale(1.05); }

  .resolve-section { background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 12px; padding: 12px; margin-top: 8px; }
  .resolve-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--color-text-subtle, var(--text3)); margin-bottom: 7px; }
  .resolved-info { font-size: 13px; color: #4ade80; background: rgba(34,197,94,0.1); border-radius: 8px; padding: 10px 12px; margin-top: 8px; border: 1px solid rgba(34,197,94,0.2); }
  .resolved-info .resolve-time { font-family: 'Share Tech Mono', monospace; font-size: 10px; color: var(--color-text-subtle, var(--text3)); margin-top: 3px; }
  .divider { height: 1px; background: var(--color-border, var(--border)); margin: 8px 0; }
  .photo-count-badge { font-size: 10px; background: var(--color-surface, var(--bg2)); border: 1px solid var(--color-border, var(--border)); border-radius: 10px; padding: 1px 6px; color: var(--color-text-subtle, var(--text3)); font-family: 'Share Tech Mono', monospace; }
  .action-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
  .issue-footer-actions { justify-content: space-between; }
  .issue-footer-actions-right { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }

  /* STATUS TIMELINE */
  .status-timeline { margin-top: 8px; }
  .tl-list { display: flex; flex-direction: column; gap: 12px; position: relative; }
  .tl-entry { position: relative; padding: 12px 13px 10px 15px; border-radius: 10px; background: var(--color-surface, var(--bg2)); border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 84%, transparent); border-left: 3px solid transparent; box-shadow: 0 4px 14px rgba(0,0,0,0.12); }
  .tl-wf-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; display: inline-flex; align-items: center; gap: 4px; margin-bottom: 5px; background: none; border: none; padding: 0; cursor: pointer; font-family: 'Rajdhani', sans-serif; }
  .tl-wf-badge:hover { opacity: 0.75; }
  .tl-wf-badge.no-action { cursor: default; }
  .tl-wf-badge.no-action:hover { opacity: 1; }
  .tl-header { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .tl-status-label { font-size: 15px; font-weight: 700; line-height: 1.3; }
  .tl-time { font-size: 12px; font-weight: 600; color: var(--color-text-muted, var(--text2)); font-family: 'Nunito', sans-serif; margin-top: 3px; }
  .tl-note-text { font-size: 13px; color: var(--color-text-muted, var(--text2)); margin-top: 4px; font-style: italic; }
  .tl-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; align-items: center; }
  .tl-history-btn { background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 70%, transparent); border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 78%, transparent); color: var(--color-text-muted, var(--text2)); font-size: 10px; padding: 2px 8px; border-radius: 999px; cursor: pointer; transition: all 0.1s; pointer-events: auto; user-select: none; font-weight: 700; font-family: 'Rajdhani', sans-serif; text-transform: uppercase; letter-spacing: 0.05em; }
  .tl-history-btn:hover,
  .tl-history-btn[aria-expanded="true"] { border-color: var(--color-info, var(--blue)); color: var(--color-info, var(--blue)); background: rgba(59,130,246,0.1); }
  .tl-workflow-history-panel { margin-top: 8px; padding: 9px 10px; border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 62%, transparent); border-radius: 9px; background: color-mix(in srgb, var(--color-bg, var(--bg)) 62%, transparent); }
  .tl-workflow-history-title { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.09em; color: var(--color-text-subtle, var(--text3)); margin-bottom: 7px; }
  .tl-workflow-history-row { display: grid; grid-template-columns: 18px minmax(92px, 0.8fr) minmax(0, 1.2fr); align-items: center; gap: 6px; min-height: 24px; font-size: 11px; color: var(--color-text-muted, var(--text2)); }
  .tl-workflow-history-row + .tl-workflow-history-row { margin-top: 4px; }
  .tl-workflow-history-row.missing { opacity: 0.55; }
  .tl-workflow-history-row.current { color: var(--color-text, var(--text)); }
  .tl-workflow-history-row.superseded { opacity: 0.68; }
  .tl-workflow-history-row.superseded .tl-workflow-history-label,
  .tl-workflow-history-row.superseded .tl-workflow-history-meta { text-decoration: line-through; text-decoration-thickness: 1px; text-decoration-color: color-mix(in srgb, currentColor 42%, transparent); }
  .tl-workflow-history-dot { width: 16px; height: 16px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 1px solid color-mix(in srgb, currentColor 45%, transparent); font-size: 9px; line-height: 1; color: var(--color-text-subtle, var(--text3)); }
  .tl-workflow-history-dot.called { color: #eab308; }
  .tl-workflow-history-dot.accepted { color: #22c55e; }
  .tl-workflow-history-dot.in-progress { color: #3b82f6; }
  .tl-workflow-history-dot.finished { color: #a855f7; }
  .tl-workflow-history-label { font-weight: 800; color: inherit; white-space: nowrap; }
  .tl-workflow-history-meta { font-family: 'Nunito', sans-serif; color: inherit; min-width: 0; overflow-wrap: anywhere; }
  .tl-workflow-history-empty { font-size: 11px; color: var(--color-text-subtle, var(--text3)); font-style: italic; margin-bottom: 7px; }
  @media (max-width: 420px) {
    .tl-workflow-history-row {
      grid-template-columns: 18px minmax(82px, auto) minmax(0, 1fr);
      gap: 5px;
    }
    .tl-workflow-history-meta {
      font-size: 10.5px;
    }
  }
  .tl-edit-row { display: flex; gap: 5px; margin-top: 5px; flex-wrap: wrap; align-items: center; }
  .tl-mini-select { background: var(--color-bg, var(--bg)); border: 1px solid var(--color-border, var(--border)); border-radius: 6px; padding: 4px 7px; color: var(--color-text, var(--text)); font-size: 11px; font-family: 'Nunito', sans-serif; outline: none; max-width: 100%; min-width: 0; user-select: auto; pointer-events: auto; }
  .tl-mini-select:focus { border-color: var(--color-accent, var(--accent)); }
  .tl-mini-input { background: var(--color-bg, var(--bg)); border: 1px solid var(--color-border, var(--border)); border-radius: 6px; padding: 4px 7px; color: var(--color-text, var(--text)); font-size: 11px; font-family: 'Nunito', sans-serif; outline: none; flex: 1; min-width: 80px; user-select: auto; pointer-events: auto; }
  .tl-mini-input::placeholder { color: var(--color-text-subtle, var(--text3)); }
  .tl-mini-input:focus { border-color: var(--color-accent, var(--accent)); }
  .tl-mini-btn { font-size: 10px; padding: 3px 9px; border-radius: 5px; border: none; cursor: pointer; font-family: 'Rajdhani', sans-serif; font-weight: 600; pointer-events: auto; user-select: none; }
  .tl-save-btn { background: var(--color-accent, var(--accent)); color: white; }
  .tl-cancel-btn { background: transparent; border: 1px solid var(--color-border, var(--border)); color: var(--color-text-muted, var(--text2)); }
  .tl-remove-btn { background: transparent; border: 1px solid rgba(239,68,68,0.62); color: #f87171; font-size: 10px; padding: 2px 7px; border-radius: 5px; cursor: pointer; transition: all 0.1s; font-weight: 600; pointer-events: auto; user-select: none; }
  .tl-remove-btn:hover { border-color: #ef4444; color: #ef4444; background: rgba(239,68,68,0.1); }
  .tl-remove-btn:disabled { opacity: 0.3; cursor: not-allowed; }
  .tl-edit-btn { background: transparent; border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 82%, transparent); color: var(--color-text-muted, var(--text2)); font-size: 10px; padding: 2px 7px; border-radius: 5px; cursor: pointer; transition: all 0.1s; pointer-events: auto; user-select: none; }
  .tl-edit-btn:hover { border-color: var(--color-text-subtle, var(--text3)); color: var(--color-text, var(--text)); background: rgba(255,255,255,0.05); }
  .tl-add-row { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--color-border, var(--border)); flex-wrap: wrap; align-items: center; min-width: 0; }
  .tl-add-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--color-text-subtle, var(--text3)); white-space: nowrap; }

  /* BUTTONS */
  .btn { font-family: 'Rajdhani', sans-serif; font-weight: 600; font-size: 13px; letter-spacing: 0.5px; padding: 6px 14px; border-radius: 7px; border: none; cursor: pointer; transition: all 0.15s; display: inline-flex; align-items: center; gap: 5px; }
  .btn:disabled { opacity: 0.5; cursor: not-allowed; }
  .btn-primary    { background: var(--color-accent, var(--accent)); color: white; }
  .btn-primary:hover:not(:disabled) { background: var(--color-accent-strong, var(--accent2)); transform: translateY(-1px); }
  .btn-success    { background: transparent; border: 1px solid var(--color-success, var(--green)); color: var(--color-success, var(--green)); box-shadow: 0 0 12px rgba(34,197,94,0.35), inset 0 0 8px rgba(34,197,94,0.1); }
  .btn-success:hover:not(:disabled) { background: var(--color-success-soft, var(--green-dim)); box-shadow: 0 0 16px rgba(34,197,94,0.5), inset 0 0 12px rgba(34,197,94,0.2); }
  .btn-blue       { background: var(--color-info, var(--blue)); color: white; }
  .btn-blue:hover:not(:disabled) { opacity: 0.85; }
  .btn-ghost      { background: transparent; border: 1px solid var(--color-border, var(--border)); color: var(--color-text-muted, var(--text2)); }
  .btn-ghost:hover:not(:disabled) { border-color: var(--color-text-muted, var(--text2)); color: var(--color-text, var(--text)); }
  .scope-link-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border: 1px solid var(--color-accent, var(--accent));
    border-radius: 999px;
    background: color-mix(in srgb, var(--color-accent, var(--accent)) 14%, transparent);
    color: var(--color-accent, var(--accent));
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1;
    cursor: pointer;
  }
  .scope-link-badge:hover { background: color-mix(in srgb, var(--color-accent, var(--accent)) 22%, transparent); }
  .btn-view       { background: transparent; border: 1px solid var(--color-info, var(--blue)); color: var(--color-info, var(--blue)); }
  .btn-view:hover:not(:disabled) { background: var(--color-info-soft, var(--blue-dim)); }
  .btn-danger     { background: transparent; border: 1px solid var(--color-danger, var(--red));      color: var(--color-danger, var(--red));      font-size: 11px; padding: 5px 11px; }
  .btn-danger:hover     { background: var(--color-danger-soft, var(--red-dim)); }
  .btn-reopen     { background: transparent; border: 1px solid var(--color-info, var(--blue));     color: var(--color-info, var(--blue));     font-size: 11px; padding: 5px 11px; }
  .btn-reopen:hover     { background: var(--color-info-soft, var(--blue-dim)); }
  .btn-alert      { background: transparent; border: 1px solid #dc2626;       color: #dc2626;       font-size: 11px; padding: 5px 11px; }
  .btn-alert:hover      { background: rgba(220,38,38,0.12); }
  .btn-maintenance{ background: transparent; border: 1px solid var(--color-warning, var(--yellow));   color: var(--color-warning, var(--yellow));   font-size: 11px; padding: 5px 11px; }
  .btn-maintenance:hover{ background: var(--color-warning-soft, var(--yellow-dim)); }
  .btn-materials  { background: transparent; border: 1px solid #8b5cf6;       color: #8b5cf6;       font-size: 11px; padding: 5px 11px; }
  .btn-materials:hover  { background: rgba(139,92,246,0.12); }
  .btn-tooldie    { background: transparent; border: 1px solid var(--color-orange, var(--orange));   color: var(--color-orange, var(--orange));   font-size: 11px; padding: 5px 11px; }
  .btn-tooldie:hover    { background: var(--color-orange-soft, var(--orange-dim)); }
  .btn-moldchange { background: transparent; border: 1px solid var(--color-babyblue, var(--babyblue)); color: var(--color-babyblue, var(--babyblue)); font-size: 11px; padding: 5px 11px; }
  .btn-moldchange:hover { background: var(--color-babyblue-soft, var(--babyblue-dim)); }
  .btn-startup         { background: transparent; border: 1px solid var(--color-teal, var(--teal));     color: var(--color-teal, var(--teal));     font-size: 11px; padding: 5px 11px; }
  .btn-startup:hover         { background: var(--color-teal-soft, var(--teal-dim)); }
  .btn-processengineer { background: transparent; border: 1px solid var(--color-purple, var(--purple));   color: var(--color-purple, var(--purple));   font-size: 11px; padding: 5px 11px; }
  .btn-processengineer:hover { background: var(--color-purple-soft, var(--purple-dim)); }
  .btn-quality    { background: transparent; border: 1px solid #06b6d4;       color: #06b6d4;       font-size: 11px; padding: 5px 11px; }
  .btn-quality:hover    { background: rgba(6,182,212,0.12); }
  .btn-controlman      { background: transparent; border: 1px solid var(--color-babyblue, var(--babyblue)); color: var(--color-babyblue, var(--babyblue)); font-size: 11px; padding: 5px 11px; }
  .btn-controlman:hover      { background: var(--color-babyblue-soft, var(--babyblue-dim)); }
  .btn-edit       { background: transparent; border: 1px solid var(--color-border, var(--border));   color: var(--color-text-muted, var(--text2));    font-size: 11px; padding: 5px 11px; }
  .btn-edit:hover       { border-color: var(--color-accent, var(--accent)); color: var(--color-accent, var(--accent)); }

  /* MODALS */
  .modal-overlay {
    display: flex;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0s linear 0.22s;
  }
  .modal-overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }
  .timer-select { appearance:none; background-image:linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%); background-position:calc(100% - 16px) 52%, calc(100% - 11px) 52%; background-size:5px 5px, 5px 5px; background-repeat:no-repeat; }
  .timer-modal-title { display:flex; align-items:center; gap:10px; }
  .timer-modal-icon { width:34px; height:34px; border-radius:8px; display:inline-flex; align-items:center; justify-content:center; background:linear-gradient(180deg, rgba(59,130,246,0.2), rgba(14,165,233,0.08)); border:1px solid rgba(96,165,250,0.36); box-shadow:0 0 18px rgba(14,165,233,0.14); }
  .timer-scrubber-modal {
    background: #040404;
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 34px;
    padding: 20px 22px 18px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.68), inset 0 1px 0 rgba(255,255,255,0.04);
    overflow: hidden;
  }
  .timer-running-panel {
    margin: 12px 0 10px;
    border-radius: 24px;
    padding: 14px;
    background:
      radial-gradient(circle at 78% 0%, rgba(255,154,51,0.22), transparent 42%),
      linear-gradient(180deg, rgba(20,10,3,0.94), rgba(5,5,5,0.98));
    border: 1px solid rgba(255,154,51,0.18);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 18px 40px rgba(0,0,0,0.32);
  }
  .timer-running-panel[hidden] { display: none; }
  .timer-running-topline { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:6px; }
  .timer-running-pill {
    display:inline-flex;
    align-items:center;
    border-radius:999px;
    padding:4px 9px;
    font-family:'Share Tech Mono', monospace;
    font-size:11px;
    font-weight:900;
    text-transform:uppercase;
    letter-spacing:.08em;
    color:#1b0b00;
    background:linear-gradient(180deg, #ffb45a, #ff8f28);
    box-shadow:0 0 16px rgba(255,154,51,0.24);
  }
  .timer-running-pill.paused { color:#241407; background:linear-gradient(180deg, #ffd59f, #d59a4d); }
  .timer-running-pill.overdue { color:#2a0303; background:linear-gradient(180deg, #ff9f9f, #fb5f5f); box-shadow:0 0 18px rgba(248,113,113,0.32); }
  .timer-running-due {
    min-width:0;
    color:rgba(255,226,196,0.58);
    font-family:'Share Tech Mono', monospace;
    font-size:12px;
    font-weight:800;
    text-align:right;
  }
  .timer-running-clock {
    margin: 2px 0 10px;
    font-family:'Share Tech Mono', monospace;
    font-size:58px;
    line-height:0.95;
    letter-spacing:-0.045em;
    color:#ff9a33;
    text-shadow:0 0 22px rgba(255,154,51,0.22);
  }
  .timer-running-actions { display:flex; gap:8px; margin-bottom:12px; }
  .timer-action-chip {
    border:1px solid rgba(255,154,51,0.22);
    border-radius: 13px;
    padding: 9px 12px;
    font-family:'Nunito', sans-serif;
    font-size:13px;
    font-weight:900;
    color:#ffe1bc;
    background:linear-gradient(180deg, rgba(71,32,5,0.88), rgba(31,13,2,0.94));
    cursor:pointer;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05);
    transition: transform .14s ease, border-color .14s ease, background .14s ease;
  }
  .timer-action-chip:hover { transform:translateY(-1px); border-color:rgba(255,154,51,0.48); background:linear-gradient(180deg, rgba(93,42,7,0.94), rgba(44,18,2,0.96)); }
  .timer-action-resume { border-color:rgba(99,255,171,0.24); color:#d8ffe9; background:linear-gradient(180deg, rgba(16,83,48,0.66), rgba(8,38,24,0.92)); }
  .timer-add-label {
    margin: 0 0 7px;
    font-size:10px;
    font-weight:900;
    letter-spacing:.14em;
    text-transform:uppercase;
    color:rgba(255,255,255,0.42);
  }
  .timer-add-grid { display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:8px; }
  .timer-scrubber-shell {
    margin: 12px 0 10px;
    border-radius: 28px;
    padding: 12px 14px 10px;
    overflow: hidden;
    background:
      radial-gradient(circle at top center, rgba(255,154,51,0.1), transparent 48%),
      linear-gradient(180deg, rgba(11,11,11,0.98), rgba(0,0,0,1));
    border: 1px solid rgba(255,255,255,0.05);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
  }
  .timer-preview {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin: 0 0 8px;
    border: none;
    border-radius: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }
  .timer-preview-kicker { font-size:10px; font-weight:900; letter-spacing:.14em; text-transform:uppercase; color:rgba(255,255,255,0.42); margin-bottom:8px; }
  .timer-preview-time {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 2px;
    font-family:'Share Tech Mono', monospace;
    font-size:54px;
    line-height:0.95;
    color:#ff9a33;
    text-shadow:0 0 18px rgba(255,154,51,0.18);
    letter-spacing:-0.04em;
    text-align:right;
  }
  .timer-preview-time.empty { color:var(--color-text-muted, var(--text2)); text-shadow:none; }
  .timer-preview-input {
    width: 1.9ch;
    min-width: 1.9ch;
    border: none;
    padding: 0;
    margin: 0;
    background: transparent;
    color: inherit;
    text-shadow: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-align: center;
    outline: none;
    border-radius: 10px;
    transition: background 0.16s ease, box-shadow 0.16s ease, color 0.16s ease;
    caret-color: #ffd1a3;
    -moz-appearance: textfield;
  }
  .timer-preview-input-mins {
    width: 2.8ch;
    min-width: 2.8ch;
  }
  .timer-preview-input::-webkit-outer-spin-button,
  .timer-preview-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
  .timer-preview-input::selection { background: rgba(255,154,51,0.24); color: #fff2df; }
  .timer-preview-input:hover {
    background: rgba(255,154,51,0.08);
    box-shadow: inset 0 0 0 1px rgba(255,154,51,0.14);
  }
  .timer-preview-input:focus {
    background: rgba(255,154,51,0.12);
    box-shadow: inset 0 0 0 1px rgba(255,154,51,0.34), 0 0 16px rgba(255,154,51,0.12);
  }
  .timer-preview-input.is-editing {
    color: #ffd8ad;
    text-shadow: 0 0 20px rgba(255,154,51,0.24);
  }
  .timer-preview-sep {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 0.55ch;
    opacity: 0.96;
  }
  .timer-scrubber-wrap {
    --timer-scrubber-gap: 7px;
    --timer-scrubber-inset: 22px;
    position: relative;
    padding-top: 8px;
  }
  .timer-scrubber-scale {
    position: relative;
    height: 26px;
    margin: 0 var(--timer-scrubber-inset) 10px;
    margin-bottom: 10px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 18px;
    font-weight: 800;
    color: rgba(255,154,51,0.72);
    letter-spacing: -0.03em;
    overflow: hidden;
  }
  .timer-scrubber-scale-label {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateX(-50%);
    white-space: nowrap;
  }
  .timer-scrubber-scale-label.edge-end { transform: translateX(-100%); }
  .timer-scrubber-lane {
    position: relative;
    padding: 18px var(--timer-scrubber-inset) 28px;
    height: 110px;
    box-sizing: border-box;
    touch-action: pan-x;
    user-select: none;
    cursor: ew-resize;
    outline: none;
    overflow: hidden;
  }
  .timer-scrubber-lane:focus-visible {
    box-shadow: inset 0 0 0 1px rgba(255,154,51,0.45);
    border-radius: 18px;
  }
  .timer-scrubber-bars {
    position: relative;
    height: 64px;
  }
  .timer-scrubber-bar {
    position: absolute;
    left: 0;
    bottom: 0;
    width: 4px;
    height: 44px;
    border-radius: 999px;
    background: rgba(255,154,51,0.2);
    box-shadow: 0 0 10px rgba(255,154,51,0.05);
    transition: background 0.14s ease, box-shadow 0.14s ease, opacity 0.14s ease, transform 0.14s ease;
    opacity: 0.82;
    transform: translateX(-50%);
  }
  .timer-scrubber-bar.major { height: 64px; }
  .timer-scrubber-bar.edge-start { transform: translateX(0); }
  .timer-scrubber-bar.edge-end { transform: translateX(-100%); }
  .timer-scrubber-bar.active {
    background: linear-gradient(180deg, #ffb04f, #ff922f);
    box-shadow: 0 0 16px rgba(255,154,51,0.28);
    opacity: 1;
  }
  .timer-scrubber-bar.current {
    transform: translateX(-50%) scaleY(1.08);
    box-shadow: 0 0 20px rgba(255,154,51,0.34);
  }
  .timer-scrubber-bar.current.edge-start { transform: translateX(0) scaleY(1.08); }
  .timer-scrubber-bar.current.edge-end { transform: translateX(-100%) scaleY(1.08); }
  .timer-scrubber-bar.future {
    opacity: 0.5;
    background: rgba(255,154,51,0.12);
  }
  .timer-scrubber-pointer {
    position: absolute;
    left: 50%;
    bottom: 2px;
    width: 0;
    height: 0;
    transform: translateX(-50%);
    border-left: 11px solid transparent;
    border-right: 11px solid transparent;
    border-bottom: 18px solid #ff9a33;
    filter: drop-shadow(0 0 10px rgba(255,154,51,0.22));
  }
  .timer-iphone-stack { display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:8px; margin: 14px 0 10px; }
  .timer-chip { border:1px solid rgba(255,154,51,0.14); border-radius: 12px; padding: 10px 8px; font-family:'Share Tech Mono', monospace; font-size:15px; font-weight:800; background: linear-gradient(180deg, rgba(38,18,3,0.92), rgba(26,11,2,0.94)); color: rgba(255,212,168,0.92); cursor:pointer; box-shadow: inset 0 1px 0 rgba(255,255,255,0.04); transition: transform .14s ease, border-color .14s ease, background .14s ease, color .14s ease; }
  .timer-chip:hover { border-color: rgba(255,154,51,0.42); color:#ffd1a3; background: linear-gradient(180deg, rgba(73,34,6,0.94), rgba(44,18,2,0.96)); transform:translateY(-1px); }
  .timer-chip-fast { border-color:rgba(255,154,51,0.28); color:#ffe1bc; background:linear-gradient(180deg, rgba(92,43,6,0.92), rgba(52,23,2,0.96)); }
  .timer-start-btn { min-width:124px; }
  .timer-modal-actions { justify-content: flex-start; }
  .timer-clear-btn { margin-left: auto; }
  @media (max-width: 420px) {
    .timer-iphone-stack { grid-template-columns: repeat(2, minmax(0,1fr)); }
    .timer-preview {
      flex-direction: column;
      align-items: flex-start;
    }
    .timer-preview-time { font-size:42px; text-align:left; }
    .timer-scrubber-scale {
      --timer-scrubber-inset: 12px;
      font-size: 15px;
    }
  }
  .modal {
    background: var(--color-surface, var(--bg2));
    border: 1px solid var(--color-border, var(--border));
    border-radius: 14px;
    padding: 24px;
    width: 520px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
    opacity: 0;
    transform: translateY(16px) scale(0.98);
    transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.22s ease;
  }
  .modal-overlay.visible > .modal {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  .profile-onboarding-overlay { z-index: 1200; }
  .profile-onboarding-modal { width: min(520px, 94vw); }
  .onboarding-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 14px 0;
    color: var(--color-text-muted, var(--text2));
    font-family: 'Nunito', sans-serif;
    font-size: 12px;
    font-weight: 800;
  }
  .onboarding-field input[type="text"] {
    width: 100%;
    box-sizing: border-box;
    background: var(--color-surface-raised, var(--bg3));
    border: 1px solid var(--color-border, var(--border));
    border-radius: 8px;
    color: var(--color-text, var(--text));
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    padding: 10px 12px;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
  }
  .onboarding-field input[type="text"]:focus {
    border-color: var(--color-accent, var(--accent));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--color-accent, var(--accent)) 20%, transparent);
  }
  .onboarding-plant-picker { position: relative; }
  .onboarding-plant-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--color-surface-raised, var(--bg3));
    border: 1px solid var(--color-border, var(--border));
    border-radius: 8px;
    color: var(--color-text, var(--text));
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 700;
    padding: 10px 12px;
    cursor: pointer;
    text-align: left;
  }
  .onboarding-plant-toggle.open {
    border-color: var(--color-accent, var(--accent));
    color: var(--color-accent, var(--accent));
  }
  .onboarding-plant-menu {
    display: none;
    margin-top: 6px;
    border: 1px solid var(--color-border, var(--border));
    border-radius: 10px;
    background: var(--color-surface, var(--bg2));
    max-height: 210px;
    overflow-y: auto;
    box-shadow: 0 12px 30px rgba(0,0,0,0.35);
  }
  .onboarding-plant-menu.visible { display: block; }
  .onboarding-plant-option {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    color: var(--color-text-muted, var(--text2));
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
  }
  .onboarding-plant-option:last-child { border-bottom: none; }
  .onboarding-plant-option:hover { background: var(--color-surface-raised, var(--bg3)); color: var(--color-text, var(--text)); }
  .onboarding-plant-option input { accent-color: var(--color-accent, var(--accent)); }
  .onboarding-plant-option small {
    color: var(--color-text-subtle, var(--text3));
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    font-weight: 600;
    margin-left: auto;
  }
  .onboarding-help {
    color: var(--color-text-subtle, var(--text3));
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
  }
  .onboarding-error {
    min-height: 18px;
    color: var(--color-danger, var(--red));
    font-size: 12px;
    font-weight: 800;
    margin-top: 4px;
  }

  .modal-title { font-family: 'Rajdhani', sans-serif; font-size: 20px; font-weight: 700; letter-spacing: 1px; margin-bottom: 5px; }
  .modal-machine { color: var(--color-accent, var(--accent)); }
  .modal-subtitle { font-size: 11px; color: var(--color-text-muted, var(--text2)); margin-bottom: 16px; font-family: 'Share Tech Mono', monospace; }
  .issue-attach-hint { font-size: 11px; line-height: 1.35; color: var(--color-text-subtle, var(--text3)); margin: -2px 0 8px; font-family:'Nunito', sans-serif; }
  .modal-kicker,
  .press-wiki-kicker,
  .store-section-label,
  .msg-sheet-label,
  .store-admin-tools-title {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    line-height: 1.35;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-text-subtle, var(--text3));
  }
  .modal-section-title,
  .press-wiki-card-title,
  .press-wiki-section-title,
  .msg-thread-name,
  .msg-sheet-title,
  .store-modal-title,
  .store-cs-title {
    font-family: 'Rajdhani', sans-serif;
    font-weight: 700;
    letter-spacing: 0.6px;
    line-height: 1.1;
  }
  .modal-section-subtitle,
  .press-wiki-card-subtitle,
  .press-wiki-meta,
  .msg-thread-sub,
  .msg-convo-time,
  .msg-convo-preview,
  .store-modal-xp,
  .store-admin-tools-sub,
  .store-cs-sub {
    color: var(--color-text-muted, var(--text2));
    line-height: 1.45;
  }
  .press-wiki-head { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding-bottom: 10px; border-bottom: 1px solid var(--color-border, var(--border)); }
  .press-wiki-head-copy { min-width: 0; display:flex; flex-direction:column; gap:4px; }
  .press-wiki-kicker { letter-spacing: 0.18em; color: var(--color-accent, var(--accent)); opacity: 0.85; }
  .press-wiki-title { font-size: 22px; }
  .press-wiki-meta { font-size: 10px; }
  .press-wiki-summary { font-size: 13px; line-height: 1.5; color: var(--color-text, var(--text)); max-width: 74ch; }
  .press-wiki-toolbar { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
  .press-wiki-toolbar-label { margin-bottom: 0; }
  .press-wiki-layout { display:grid; grid-template-columns: minmax(0,1.6fr) minmax(280px,0.9fr); gap: 14px; min-height: 0; flex: 1; overflow: hidden; }
  .press-wiki-main, .press-wiki-sidebar { min-height: 0; overflow: auto; display:flex; flex-direction:column; gap: 14px; }
  .press-wiki-card { border: 1px solid var(--color-border, var(--border)); border-radius: 14px; background: var(--color-surface-raised, var(--bg3)); padding: 14px; box-shadow: 0 10px 24px rgba(0,0,0,0.16); }
  .press-wiki-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap: 12px; margin-bottom: 12px; }
  .press-wiki-card-title { font-size: 16px; }
  .press-wiki-card-subtitle { font-size: 11px; color: var(--color-text-muted, var(--text2)); margin-top: 2px; line-height: 1.4; }
  .press-wiki-toc { display:flex; flex-direction:column; gap: 6px; margin-bottom: 12px; }
  .press-wiki-toc-empty { font-size: 12px; color: var(--color-text-muted, var(--text2)); font-style: italic; }
  .press-wiki-toc-link { display:flex; align-items:center; gap:8px; width:100%; border:1px solid var(--color-border, var(--border)); background: transparent; color: var(--color-text-muted, var(--text2)); border-radius: 10px; padding: 8px 10px; font-size: 12px; text-align:left; cursor:pointer; transition: border-color 0.15s, color 0.15s, background 0.15s; }
  .press-wiki-toc-link:hover { border-color: var(--color-accent, var(--accent)); color: var(--color-text, var(--text)); background: var(--focus-ring, var(--accent-glow)); }
  .press-wiki-toc-level-2 { margin-left: 10px; }
  .press-wiki-toc-level-3 { margin-left: 22px; font-size: 11px; }
  .press-wiki-body { display:flex; flex-direction:column; gap: 12px; }
  .press-wiki-empty { font-size: 13px; color: var(--color-text-muted, var(--text2)); line-height: 1.5; }
  .press-wiki-section { border: 1px solid var(--color-border, var(--border)); border-radius: 12px; background: rgba(0,0,0,0.06); padding: 12px; scroll-margin-top: 12px; }
  .press-wiki-section-title { font-size: 17px; margin-bottom: 8px; }
  .press-wiki-section-level-2 .press-wiki-section-title { font-size: 18px; }
  .press-wiki-section-level-3 .press-wiki-section-title { font-size: 15px; color: var(--color-text-muted, var(--text2)); }
  .press-wiki-section-body { white-space: pre-wrap; line-height: 1.55; font-size: 13px; color: var(--color-text, var(--text)); }
  .press-wiki-lead { border-left: 3px solid var(--color-accent, var(--accent)); padding-left: 12px; }
  .press-wiki-attachments { display:flex; flex-wrap:wrap; gap:8px; }
  .press-wiki-revisions { display:flex; flex-direction:column; gap: 8px; max-height: 240px; overflow:auto; }
  .press-wiki-event-feed { display:flex; flex-direction:column; gap: 10px; min-height: 160px; }
  .press-wiki-event-empty { color: var(--color-text-muted, var(--text2)); font-size: 12px; line-height: 1.5; }
  .press-wiki-event-card { display:flex; flex-direction:column; gap: 8px; border: 1px solid var(--color-border, var(--border)); border-radius: 12px; padding: 10px 12px; background: rgba(0,0,0,0.08); }
  .press-wiki-event-head { display:flex; align-items:flex-start; justify-content:space-between; gap: 10px; }
  .press-wiki-event-title { font-family:'Rajdhani', sans-serif; font-size: 15px; font-weight: 700; }
  .press-wiki-event-meta { font-family:'Share Tech Mono', monospace; font-size: 10px; color: var(--color-text-muted, var(--text2)); }
  .press-wiki-event-text { font-size: 13px; line-height: 1.5; color: var(--color-text, var(--text)); white-space: pre-wrap; }
  .press-wiki-event-photos { display:flex; flex-wrap:wrap; gap: 6px; }
  .press-wiki-editor { display:none; border-top: 1px solid var(--color-border, var(--border)); padding-top: 12px; }
  .press-wiki-editor-actions { display:flex; gap:8px; justify-content:flex-end; margin-top: 8px; }

  /* NOTES MODAL */
  body.notes-open { overflow: hidden; overscroll-behavior: none; }
  .notes-modal-header,
  .press-wiki-header-row,
  .notes-list-header,
  .tool-modal-nav-shell {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    padding: 8px 12px 6px;
    border-bottom: 1px solid var(--color-border, var(--border));
    background: var(--color-surface, var(--bg2));
    position: relative;
    z-index: 5;
    overflow: visible;
    touch-action: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
  }
  .notes-modal-header-copy {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 3px;
    flex: 0 0 auto;
    padding: 9px 12px;
    margin-right: 0;
  }
  .notes-editor-header-card {
    border-radius: 16px;
    background: var(--color-surface, var(--bg2));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  }
  .notes-editor-header-card:hover {
    transform: none;
    border-color: var(--color-border, var(--border));
  }
  .alerts-header-card {
    padding-top: 8px;
    padding-bottom: 8px;
    margin-top: 6px;
    margin-left: 12px;
    margin-right: 12px;
    width: auto;
  }
  #role-alerts-app-container {
    position: relative;
  }
  .role-alerts-close-fab {
    position: absolute;
    right: 12px;
    bottom: 12px;
    width: 42px;
    height: 42px;
    z-index: 6;
  }
  .notes-modal-kicker { font-family: 'Share Tech Mono', monospace; font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--color-warning, var(--yellow)); }
  .notes-modal-title-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
  .notes-modal-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1;
    background: linear-gradient(135deg, var(--color-accent, var(--accent)) 0%, var(--color-accent-strong, var(--accent2)) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
  }
  .notes-modal-context { font-family: 'Share Tech Mono', monospace; font-size: 10px; color: var(--color-text-muted, var(--text2)); letter-spacing: .08em; text-transform: uppercase; }
  .notes-modal-subtitle { font-family: 'Share Tech Mono', monospace; font-size: 10px; color: var(--color-text-muted, var(--text2)); line-height: 1.35; max-width: 100%; }
  .notes-modal-header-top,
  .notes-modal-meta-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    min-width: 0;
  }
  .notes-modal-meta-row { justify-content: space-between; }
  .notes-modal-sync-note {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--color-border, var(--border));
    background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 86%, white 2%);
    color: var(--color-text-subtle, var(--text3));
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .notes-editor-save-state {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    border: 1px solid var(--notes-chip-border);
    background: var(--notes-chip-bg);
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--color-warning, var(--yellow));
    white-space: nowrap;
  }
  .notes-editor-save-state.is-saving { color: var(--color-warning, var(--yellow)); }
  .notes-editor-save-state.is-error { color: var(--color-danger, var(--red)); border-color: color-mix(in srgb, var(--color-danger, var(--red)) 40%, var(--color-border, var(--border))); }
  .notes-editor-save-state.is-offline { color: var(--color-text-subtle, var(--text3)); border-color: color-mix(in srgb, var(--color-text-subtle, var(--text3)) 38%, var(--color-border, var(--border))); }
  .notes-modal-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    justify-content: center;
    flex-wrap: nowrap;
    min-width: 0;
    width: 100%;
    padding: 8px 12px 4px;
    position: relative;
    z-index: 6;
  }
  .tool-modal-nav-shell .tool-modal-nav-btn,
  .notes-modal-header .tool-modal-nav-btn,
  .press-wiki-header-row .tool-modal-nav-btn,
  .notes-list-header .tool-modal-nav-btn {
    position: static;
    top: auto;
    transform: none;
    flex: 0 0 auto;
  }
  .tool-modal-nav-title {
    min-width: 0;
    text-align: center;
    font-family: 'Rajdhani', sans-serif;
    font-size: 20px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: var(--color-accent, var(--accent));
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    touch-action: none !important;
    user-select: none !important;
    -webkit-user-select: none !important;
  }
  .press-wiki-header-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 0 12px 10px;
  }
  #notes-new-btn,
  #notes-create-btn {
    min-height: 40px;
    padding: 0 16px;
    border-radius: 12px;
    font-family: 'Nunito', sans-serif;
    font-weight: 800;
    letter-spacing: -0.01em;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.15);
  }
  .notes-modal-close { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--color-border, var(--border)); background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 90%, white 2%); color: var(--color-text-muted, var(--text2)); cursor: pointer; font-size: 18px; line-height: 1; transition: border-color .15s, color .15s, background .15s, transform .15s; }
  .notes-modal-close:hover { border-color: color-mix(in srgb, var(--color-teal, var(--teal)) 45%, var(--color-border, var(--border))); color: var(--color-text, var(--text)); background: rgba(255,255,255,0.04); transform: translateY(-1px); }
  .notes-modal-body { display: grid; grid-template-columns: 330px minmax(0, 1fr); min-height: 0; flex: 1; overflow: hidden; }
  .notes-list-panel {
    min-height: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--color-border, var(--border));
    background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 82%, var(--color-warning, var(--yellow)) 4%);
  }
  .notes-list-controls {
    padding: 12px;
    border-bottom: 1px solid var(--color-border, var(--border));
    display: flex;
    flex-direction: column;
    gap: 10px;
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 70%, white 2%), color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 96%, transparent));
  }
  .notes-search { width: 100%; background: color-mix(in srgb, var(--color-surface, var(--bg2)) 88%, white 3%); border-color: color-mix(in srgb, var(--color-border, var(--border)) 78%, var(--color-accent, var(--accent)) 22%); border-radius: 999px; }
  .notes-filter-row { display: flex; gap: 6px; flex-wrap: wrap; }
  .notes-filter-btn {
    border: 1px solid var(--notes-chip-border);
    background: var(--notes-chip-bg);
    color: var(--color-text-muted, var(--text2));
    border-radius: 999px;
    padding: 6px 10px;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s;
  }
  .notes-filter-btn.active,
  .notes-filter-btn:hover {
    border-color: var(--color-warning, var(--yellow));
    color: var(--color-text, var(--text));
    background: color-mix(in srgb, var(--color-warning, var(--yellow)) 10%, var(--color-surface, var(--bg2)));
  }
  .notes-list { flex: 1; min-height: 0; overflow: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
  .notes-list-empty {
    padding: 18px 10px;
    color: var(--color-text-subtle, var(--text3));
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
  }
  .notes-list-item {
    width: 100%;
    border: 1px solid var(--notes-chip-border);
    border-radius: 14px;
    background: var(--notes-chip-bg);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 0 0 1px rgba(255,255,255,0.02);
    padding: 11px 12px;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s, transform .15s, background .15s;
  }
  .notes-list-item:hover { border-color: color-mix(in srgb, var(--color-accent, var(--accent)) 56%, var(--color-border, var(--border))); background: var(--notes-chip-hover-bg); transform: translateY(-1px); }
  .notes-list-item.active {
    border-color: color-mix(in srgb, var(--color-accent, var(--accent)) 64%, var(--color-border, var(--border)));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-accent, var(--accent)) 42%, transparent), inset 0 1px 0 rgba(255,255,255,0.11);
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 76%, var(--color-accent, var(--accent)) 24%);
  }
  .notes-list-item-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
  .notes-list-item-title { font-family: 'Nunito', sans-serif; font-size: 15px; font-weight: 800; letter-spacing: -0.01em; color: var(--color-text, var(--text)); line-height: 1.15; }
  .notes-list-item-time { font-family: 'Share Tech Mono', monospace; font-size: 9px; color: var(--color-text-subtle, var(--text3)); white-space: nowrap; }
  .notes-list-item-preview { margin-top: 4px; font-family: 'Nunito', sans-serif; font-size: 12px; color: var(--color-text-muted, var(--text2)); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .notes-list-item-badges { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
  .notes-list-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 7px;
    border-radius: 999px;
    border: 1px solid var(--color-border, var(--border));
    background: var(--color-surface-raised, var(--bg3));
    color: var(--color-text-muted, var(--text2));
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .notes-list-badge.pinned { border-color: color-mix(in srgb, var(--color-warning, var(--yellow)) 45%, var(--color-border, var(--border))); color: var(--color-warning, var(--yellow)); }
  .notes-list-badge.linked { border-color: color-mix(in srgb, var(--color-teal, var(--teal)) 45%, var(--color-border, var(--border))); color: var(--color-teal, var(--teal)); }
  .notes-list-badge.archived { border-color: color-mix(in srgb, var(--color-text-subtle, var(--text3)) 45%, var(--color-border, var(--border))); color: var(--color-text-subtle, var(--text3)); }
  .notes-editor-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; padding: 12px 16px 18px; background: var(--color-bg, var(--bg)); }
  .notes-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
  .notes-editor-meta { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
  .notes-back-btn { display: none; align-self: flex-start; min-height: 36px; padding: 0 12px; border-radius: 999px; }
  .notes-editor-save-state { font-family: 'Share Tech Mono', monospace; font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--color-warning, var(--yellow)); }
  .notes-editor-updated { font-family: 'Nunito', sans-serif; font-size: 12px; color: var(--color-text-subtle, var(--text3)); }
  .notes-editor-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    padding: 8px;
    border-radius: 16px;
    border: 1px solid var(--notes-chip-border);
    background: var(--notes-chip-bg);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  }
  .notes-context-box { border: 1px solid var(--color-border, var(--border)); border-radius: 14px; background: var(--color-surface, var(--bg2)); padding: 10px 12px; }
  .notes-context-card { gap: 8px; }
  .notes-context-label { font-family: 'Share Tech Mono', monospace; font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--color-text-subtle, var(--text3)); margin-bottom: 8px; }
  .notes-context-summary {
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 700;
    color: var(--color-text, var(--text));
    line-height: 1.35;
  }
  .notes-context-help {
    font-family: 'Nunito', sans-serif;
    font-size: 11px;
    color: var(--color-text-subtle, var(--text3));
    line-height: 1.4;
  }
  .notes-context-chips { display: flex; gap: 8px; flex-wrap: wrap; }
  .notes-context-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid var(--color-border, var(--border));
    background: var(--color-surface, var(--bg2));
    color: var(--color-text, var(--text));
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .notes-context-chip button {
    background: none;
    border: none;
    color: var(--color-text-muted, var(--text2));
    padding: 0;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
  }
  .notes-context-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 10px;
  }
  .notes-editor-card {
    margin-bottom: 0;
    cursor: default;
    animation: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .notes-editor-card-main {
    flex: 0 0 auto;
    min-height: 0;
  }
  .notes-editor-card-checklist,
  .notes-editor-card-attachments,
  .notes-context-card {
    flex: 0 0 auto;
  }
  .notes-editor-card:hover {
    transform: none;
    border-color: var(--color-border, var(--border));
  }
  .notes-editor-card label {
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-text-muted, var(--text2));
    font-family: 'Share Tech Mono', monospace;
    margin-bottom: -2px;
  }
  .notes-editor-panel > label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--color-text-subtle, var(--text3));
    margin-top: 2px;
  }
  .notes-title,
  .notes-tags {
    background: var(--color-surface, var(--bg2));
    border-color: var(--color-border, var(--border));
    border-radius: 14px;
    min-height: 46px;
    color: var(--color-text, var(--text));
    caret-color: var(--color-text, var(--text));
  }
  .notes-title { font-family: 'Rajdhani', sans-serif; font-size: 20px; font-weight: 700; }
  .notes-tags { font-family: 'Share Tech Mono', monospace; font-size: 11px; letter-spacing: .05em; }
  .notes-editor-card-main .notes-title {
    font-size: 24px;
    letter-spacing: .6px;
    min-height: 52px;
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 84%, white 2%);
  }
  .notes-editor-card-main .notes-body {
    flex: 0 0 auto;
    min-height: 280px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--color-surface, var(--bg2)) 90%, white 2%), var(--color-surface, var(--bg2)));
  }
  .notes-editor-card-main.previewing .notes-body { display: none; }
  .notes-body-preview {
    flex: 0 0 auto;
    min-height: 280px;
    display: none;
    border: 1px solid var(--color-border, var(--border));
    border-radius: 16px;
    background: var(--color-surface, var(--bg2));
    color: var(--color-text, var(--text));
    padding: 14px 14px 18px;
    line-height: 1.55;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    overflow: auto;
  }
  .notes-editor-card-main.previewing .notes-body-preview { display: block; }
  .notes-body-preview.empty,
  .notes-body-preview-empty { color: var(--color-text-subtle, var(--text3)); }
  .notes-body-preview p { margin: 0 0 10px; }
  .notes-body-preview ul,
  .notes-body-preview ol { margin: 0 0 10px 20px; padding-left: 20px; }
  .notes-body-preview li { margin: 2px 0; }
  .notes-body-preview h1,
  .notes-body-preview h2,
  .notes-body-preview h3 { margin: 12px 0 8px; line-height: 1.2; }
  .notes-body-preview a { color: var(--color-info, var(--blue)); }
  .notes-title::placeholder,
  .notes-tags::placeholder { color: var(--color-text-subtle, var(--text3)); }
  .notes-tag-chips,
  .notes-tag-suggestions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }
  .notes-tag-empty {
    color: var(--color-text-subtle, var(--text3));
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    letter-spacing: .08em;
    text-transform: uppercase;
    line-height: 1.4;
  }
  .notes-tag-chip,
  .notes-tag-suggestion {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border-radius: 999px;
    border: 1px solid var(--notes-chip-border);
    background: var(--notes-chip-bg);
    color: var(--color-text-muted, var(--text2));
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    letter-spacing: .08em;
    text-transform: uppercase;
  }
  .notes-tag-chip { padding: 5px 8px 5px 10px; }
  .notes-tag-suggestion {
    padding: 5px 10px;
    cursor: pointer;
    transition: border-color .15s, color .15s, background .15s, transform .1s;
  }
  .notes-tag-suggestion:hover { border-color: var(--color-warning, var(--yellow)); color: var(--color-text, var(--text)); background: color-mix(in srgb, var(--color-warning, var(--yellow)) 10%, var(--color-surface, var(--bg2))); transform: translateY(-1px); }
  .notes-tag-chip button {
    border: none;
    background: none;
    color: var(--color-text-subtle, var(--text3));
    cursor: pointer;
    padding: 0;
    font-size: 11px;
    line-height: 1;
  }
  .notes-tag-chip button:hover { color: var(--color-text, var(--text)); }
  .notes-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
  .notes-toolbar-btn {
    border: 1px solid var(--notes-chip-border);
    background: var(--notes-chip-bg);
    color: var(--color-text-muted, var(--text2));
    border-radius: 20px;
    padding: 6px 12px;
    min-height: 30px;
    cursor: pointer;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    transition: border-color .15s, color .15s, background .15s, transform .1s;
  }
  .notes-toolbar-btn:hover { border-color: color-mix(in srgb, var(--color-accent, var(--accent)) 56%, var(--color-border, var(--border))); color: var(--color-text, var(--text)); background: var(--notes-chip-hover-bg); }
  .notes-toolbar-btn.active,
  .notes-toolbar-btn[aria-pressed="true"] {
    border-color: color-mix(in srgb, var(--color-accent, var(--accent)) 62%, var(--color-border, var(--border)));
    color: var(--color-text, var(--text));
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 74%, var(--color-accent, var(--accent)) 26%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.14);
  }
  .notes-toolbar-btn:active { transform: scale(.98); }
  .notes-menu-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
  }
  .notes-menu-trigger.open {
    border-color: var(--color-warning, var(--yellow));
    color: var(--color-text, var(--text));
    background: color-mix(in srgb, var(--color-warning, var(--yellow)) 8%, var(--color-surface, var(--bg2)));
  }
  .notes-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 60;
    min-width: 190px;
    padding: 8px;
    border: 1px solid var(--color-border, var(--border));
    border-radius: 16px;
    background:
      linear-gradient(180deg, color-mix(in srgb, var(--color-surface, var(--bg2)) 88%, white 2%), color-mix(in srgb, var(--color-surface, var(--bg2)) 96%, transparent));
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.28);
    flex-direction: column;
    gap: 6px;
  }
  .notes-menu.visible { display: flex; }
  .notes-menu button {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 10px;
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--color-text-muted, var(--text2));
    cursor: pointer;
    text-align: left;
    font-family: 'Nunito', sans-serif;
    font-size: 12.5px;
    font-weight: 700;
    transition: background .15s, color .15s, transform .15s;
  }
  .notes-menu button:hover { background: rgba(255,255,255,0.04); color: var(--color-text, var(--text)); transform: translateY(-1px); }
  .notes-menu button.danger { color: var(--color-text-muted, var(--text2)); }
  .notes-menu button.danger:hover { background: var(--color-danger-soft, var(--red-dim)); color: var(--color-danger, var(--red)); }
  .notes-menu-divider {
    width: 100%;
    height: 1px;
    margin: 4px 0;
    background: color-mix(in srgb, var(--color-border, var(--border)) 80%, transparent);
  }
  .notes-mobile-actions-wrap { display: none; }
  .notes-toolbar-more {
    position: relative;
    display: inline-flex;
    align-items: flex-start;
  }
  .notes-toolbar-more summary {
    list-style: none;
    cursor: pointer;
    user-select: none;
  }
  .notes-toolbar-more summary::-webkit-details-marker { display: none; }
  .notes-toolbar-more[open] .notes-toolbar-more-toggle {
    border-color: var(--color-warning, var(--yellow));
    color: var(--color-text, var(--text));
    background: color-mix(in srgb, var(--color-warning, var(--yellow)) 8%, var(--color-surface, var(--bg2)));
  }
  .notes-toolbar-more-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    z-index: 2;
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 10px;
    min-width: 180px;
    border: 1px solid var(--color-border, var(--border));
    border-radius: 16px;
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 94%, var(--color-warning, var(--yellow)) 6%);
    box-shadow: 0 18px 32px rgba(0, 0, 0, 0.28);
  }
  .notes-toolbar-more[open] .notes-toolbar-more-menu { display: flex; }
  .notes-toolbar-more-menu .notes-toolbar-btn { width: 100%; justify-content: flex-start; }
  .notes-body {
    min-height: 180px;
    border: 1px solid var(--color-border, var(--border));
    border-radius: 16px;
    background: var(--color-surface, var(--bg2));
    color: var(--color-text, var(--text));
    padding: 14px 14px 18px;
    line-height: 1.55;
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    outline: none;
    overflow: auto;
  }
  .notes-body:empty::before {
    content: attr(data-placeholder);
    color: var(--color-text-subtle, var(--text3));
  }
  .notes-body p { margin: 0 0 10px; }
  .notes-body ul,
  .notes-body ol { margin: 0 0 10px 20px; padding-left: 20px; }
  .notes-body li { margin: 2px 0; }
  .notes-body h1,
  .notes-body h2,
  .notes-body h3 { margin: 12px 0 8px; line-height: 1.2; }
  .notes-body a { color: var(--color-info, var(--blue)); }
  .notes-section-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 2px; }
  .notes-section-title { font-family: 'Share Tech Mono', monospace; font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--color-text-subtle, var(--text3)); }
  .notes-checklist { display: flex; flex-direction: column; gap: 8px; }
  .notes-checklist-empty {
    border: 1px dashed var(--color-border, var(--border));
    border-radius: 12px;
    padding: 12px;
    color: var(--color-text-subtle, var(--text3));
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    line-height: 1.5;
  }
  .notes-check-item {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    border: 1px solid var(--color-border, var(--border));
    border-radius: 12px;
    padding: 10px 12px;
    background: var(--color-surface, var(--bg2));
  }
  .notes-check-item input[type="checkbox"] { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--color-warning, var(--yellow)); flex-shrink: 0; }
  .notes-check-text {
    flex: 1;
    min-width: 0;
    border: none;
    background: transparent;
    color: var(--color-text, var(--text));
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    line-height: 1.45;
    outline: none;
    padding: 0;
  }
  .notes-check-text::placeholder { color: var(--color-text-subtle, var(--text3)); }
  .notes-check-remove {
    border: none;
    background: none;
    color: var(--color-text-subtle, var(--text3));
    cursor: pointer;
    padding: 0;
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
  }
  .notes-add-checklist-row { display: flex; gap: 8px; align-items: center; }
  .notes-add-checklist-row .input { flex: 1; background: var(--color-surface, var(--bg2)); border-color: var(--color-border, var(--border)); border-radius: 12px; }
  .notes-attachments { display: flex; flex-wrap: wrap; gap: 10px; }
  .notes-attachment {
    width: 88px;
    display: flex;
    flex-direction: column;
    gap: 6px;
  }
  .notes-attachment-thumb {
    width: 88px;
    height: 88px;
    border-radius: 14px;
    object-fit: cover;
    border: 1px solid var(--color-border, var(--border));
    background: var(--color-surface-raised, var(--bg3));
    display: block;
  }
  .notes-attachment-label {
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    line-height: 1.35;
    color: var(--color-text-subtle, var(--text3));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .notes-attachment-remove {
    border: none;
    background: none;
    color: var(--color-text-subtle, var(--text3));
    padding: 0;
    font-size: 12px;
    cursor: pointer;
    align-self: flex-start;
  }
  #notes-editor-frame.drop-active .notes-editor-card-attachments {
    border-color: color-mix(in srgb, var(--color-teal, var(--teal)) 55%, var(--color-border, var(--border)));
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 80%, var(--color-teal, var(--teal)) 20%);
  }
  .notes-drop-hint {
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px dashed var(--color-border, var(--border));
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 84%, transparent);
    color: var(--color-text-subtle, var(--text3));
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    letter-spacing: .08em;
    text-transform: uppercase;
    line-height: 1.5;
  }
  .notes-editor-panel .btn { min-height: 40px; }
  @media (min-width: 861px) {
    .notes-editor-panel {
      gap: 14px;
      padding: 16px 18px 22px;
    }
    .notes-editor-card {
      gap: 12px;
    }
    .notes-editor-card-main .notes-body,
    .notes-body-preview {
      min-height: 320px;
    }
  }
  @media (max-width: 860px) {
    .tool-modal-nav-btn {
      width: 30px;
      height: 30px;
    }
    .notes-modal-header {
      padding: 6px 10px 5px;
      gap: 8px;
    }
    .tool-modal-nav-title {
      font-size: 18px;
    }
    .notes-modal-subtitle { display: none; }
    .notes-modal-meta-row { display: none; }
    .notes-modal-header-actions {
      justify-content: center;
      flex-wrap: nowrap;
      overflow: visible;
      padding: 6px 10px 2px;
    }
    .notes-mobile-actions-wrap { display: inline-flex; }
    .notes-editor-actions { display: none; }
    .notes-modal-body { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr); }
    .notes-list-panel {
      border-right: none;
      border-bottom: none;
      min-height: 0;
      max-height: none;
    }
    .notes-editor-panel {
      padding: 12px 12px 14px;
    }
    .notes-editor-panel > .notes-editor-header-card {
      margin-bottom: 2px;
    }
    .notes-title,
    .notes-tags,
    .notes-add-checklist-row .input,
    #notes-checklist-input {
      padding-left: 14px;
      padding-right: 12px;
    }
    #notes-modal.notes-mobile-list .notes-editor-panel,
    #notes-modal.notes-mobile-list .notes-list-panel { display: none; }
    #notes-modal.notes-mobile-list .notes-list-panel { display: flex; }
    #notes-modal.notes-mobile-editor .notes-list-panel { display: none; }
    #notes-modal.notes-mobile-editor .notes-editor-panel { display: flex; }
    .notes-back-btn { display: inline-flex; }
    .notes-editor-head { display: contents; }
    .notes-editor-meta { order: 0; }
    .notes-editor-card-main { order: 1; }
    .notes-editor-card-checklist { order: 2; }
    .notes-editor-card-attachments { order: 3; }
    .notes-context-box { order: 4; }
    .notes-editor-actions {
      order: 11;
      position: sticky;
      bottom: 8px;
      z-index: 2;
      width: 100%;
      padding: 8px;
      border-radius: 18px;
      border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 70%, var(--color-teal, var(--teal)) 30%);
      background: color-mix(in srgb, var(--color-surface, var(--bg2)) 90%, var(--color-teal, var(--teal)) 10%);
      box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
      justify-content: flex-start;
    }
    .notes-editor-actions .btn { flex: 1 1 calc(33.333% - 8px); }
    .notes-toolbar {
      gap: 6px;
    }
    .notes-toolbar-btn {
      min-height: 42px;
      padding: 8px 9px;
    }
    .notes-editor-card {
      gap: 8px;
    }
    .notes-modal-kicker { font-size: 9px; }
    .notes-modal-title { font-size: 22px; }
    .notes-modal-context { font-size: 9px; }
    .press-wiki-header-content { padding-left: 10px; padding-right: 10px; }
    .notes-modal-header-actions .btn,
    .notes-modal-close {
      min-height: 34px;
      height: 34px;
    }
    #notes-new-btn,
    #notes-create-btn {
      min-height: 34px;
      padding: 0 12px;
      font-size: 12px;
    }
    .notes-menu-trigger {
      padding-left: 10px;
      padding-right: 10px;
      font-size: 12px;
    }
    .notes-editor-card-main .notes-body,
    .notes-body-preview {
      min-height: 300px;
    }
  }
  @media (max-width: 520px) {
    .tool-modal-nav-btn {
      width: 28px;
      height: 28px;
    }
    .notes-modal-header,
    .press-wiki-header-row,
    .notes-list-header,
    .tool-modal-nav-shell {
      padding-left: 8px;
      padding-right: 8px;
    }
    .tool-modal-nav-title {
      font-size: 17px;
    }
    #notes-modal #notes-new-btn,
    #notes-modal #notes-create-btn {
      flex: 1;
      min-width: 0;
      justify-content: center;
    }
    .notes-editor-panel {
      padding-top: 10px;
      padding-bottom: 18px;
    }
    .notes-editor-card-main {
      flex: 0 0 auto;
    }
    .notes-editor-head { gap: 8px; }
    .notes-editor-meta { gap: 2px; }
    .notes-editor-actions { gap: 6px; padding: 7px; }
    .notes-editor-actions .btn,
    .notes-toolbar-btn { min-height: 44px; }
    .notes-editor-card {
      padding: 14px;
    }
    .notes-editor-card-main .notes-body,
    .notes-body-preview {
      min-height: 200px;
    }
    .notes-context-box { padding: 8px 10px; }
    .notes-list-controls { padding: 10px; }
    .notes-list { padding: 8px; }
  }
  .role-alerts-toolbar {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap: 12px;
    flex-wrap: wrap;
  }

  /* Notes: operations logbook restyle */
  #notes-modal {
    --notes-rail: color-mix(in srgb, var(--color-accent, var(--accent)) 72%, var(--color-info, var(--blue)) 28%);
    --notes-panel-bg: color-mix(in srgb, var(--color-bg, var(--bg)) 92%, var(--color-surface, var(--bg2)) 8%);
    --notes-list-bg: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 88%, var(--color-bg, var(--bg)) 12%);
    --notes-row-bg: color-mix(in srgb, var(--color-surface, var(--bg2)) 88%, transparent);
    --notes-row-hover-bg: color-mix(in srgb, var(--color-surface, var(--bg2)) 82%, var(--color-accent, var(--accent)) 8%);
    --notes-control-bg: color-mix(in srgb, var(--color-surface, var(--bg2)) 86%, transparent);
  }
  @media (min-width: 701px) {
    #notes-phone-frame.phone {
      width: min(94vw, 1180px);
      height: min(88vh, 860px);
      border-radius: 12px;
      background: var(--notes-panel-bg);
      border-color: color-mix(in srgb, var(--color-border, var(--border)) 82%, var(--color-accent, var(--accent)) 18%);
      box-shadow: 0 24px 72px rgba(0,0,0,0.58);
    }
    #notes-modal .notes-drag-handle {
      display: none;
    }
  }
  #notes-app-container {
    background: var(--notes-panel-bg);
  }
  #notes-modal .notes-list-header {
    min-height: 44px;
    padding: 9px 14px;
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 86%, var(--color-bg, var(--bg)) 14%);
    border-bottom-color: color-mix(in srgb, var(--color-border, var(--border)) 86%, var(--color-accent, var(--accent)) 14%);
  }
  #notes-modal .tool-modal-nav-title {
    color: var(--color-text, var(--text));
    letter-spacing: 0.12em;
  }
  #notes-modal .notes-modal-body {
    grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
    background: var(--notes-panel-bg);
  }
  #notes-modal .notes-list-panel {
    background: var(--notes-list-bg);
    border-right-color: color-mix(in srgb, var(--color-border, var(--border)) 86%, var(--color-accent, var(--accent)) 14%);
  }
  #notes-modal .notes-list-controls {
    padding: 12px;
    gap: 9px;
    background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 78%, var(--color-bg, var(--bg)) 22%);
  }
  #notes-modal .search-wrap {
    margin-bottom: 0;
  }
  #notes-modal .search-box {
    min-height: 38px;
    border-radius: 8px;
    background: var(--notes-control-bg);
    border-color: color-mix(in srgb, var(--color-border, var(--border)) 86%, transparent);
    font-size: 13px;
    padding-top: 8px;
    padding-bottom: 8px;
  }
  #notes-modal .filter-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 0;
  }
  #notes-modal .filter-pill {
    border-radius: 7px;
    padding: 7px 6px;
    text-align: center;
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 74%, transparent);
    font-size: 10px;
    letter-spacing: 0.03em;
  }
  #notes-modal .filter-pill.active {
    background: color-mix(in srgb, var(--color-accent, var(--accent)) 20%, var(--color-surface, var(--bg2)) 80%);
    color: var(--color-text, var(--text));
    border-color: color-mix(in srgb, var(--color-accent, var(--accent)) 58%, var(--color-border, var(--border)));
  }
  #notes-modal .notes-list {
    padding: 8px;
    gap: 6px;
  }
  #notes-modal #notes-list .note-card {
    position: relative;
    margin-bottom: 0;
    padding: 10px 10px 10px 13px;
    border-radius: 8px;
    background: var(--notes-row-bg);
    border-color: color-mix(in srgb, var(--color-border, var(--border)) 88%, transparent);
    box-shadow: none;
    animation: none;
  }
  #notes-modal #notes-list .note-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: transparent;
  }
  #notes-modal #notes-list .note-card:hover {
    transform: none;
    background: var(--notes-row-hover-bg);
    border-color: color-mix(in srgb, var(--color-accent, var(--accent)) 45%, var(--color-border, var(--border)));
  }
  #notes-modal #notes-list .note-card.active {
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 80%, var(--color-accent, var(--accent)) 12%);
    border-color: color-mix(in srgb, var(--color-accent, var(--accent)) 54%, var(--color-border, var(--border)));
  }
  #notes-modal #notes-list .note-card.active::before {
    background: var(--notes-rail);
  }
  #notes-modal #notes-list .note-title {
    margin-bottom: 4px;
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 850;
    letter-spacing: 0;
  }
  #notes-modal #notes-list .note-preview {
    margin-bottom: 7px;
    font-size: 12px;
    line-height: 1.35;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }
  #notes-modal #notes-list .note-meta {
    align-items: center;
    gap: 6px;
  }
  #notes-modal #notes-list .tags {
    gap: 4px;
  }
  #notes-modal #notes-list .tag {
    padding: 2px 6px;
    border-radius: 5px;
    background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 80%, var(--color-accent, var(--accent)) 8%);
    border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 76%, var(--color-accent, var(--accent)) 24%);
    color: var(--color-text-muted, var(--text2));
    font-size: 8px;
    letter-spacing: 0.04em;
  }
  #notes-modal #notes-list .timestamp {
    margin-left: auto;
    font-size: 9px;
  }
  #notes-modal .notes-editor-panel {
    gap: 10px;
    padding: 14px 16px 18px;
    background: var(--notes-panel-bg);
  }
  #notes-modal .notes-modal-header-actions {
    justify-content: flex-end;
    padding: 0;
    width: auto;
  }
  #notes-modal .notes-modal-close {
    border-radius: 8px;
    width: 36px;
    height: 36px;
    background: var(--notes-control-bg);
  }
  #notes-modal #notes-create-btn,
  #notes-modal #notes-new-btn {
    border-radius: 8px;
    min-height: 36px;
    box-shadow: none;
  }
  #notes-modal #notes-create-btn.tool-create-action {
    border-radius: 999px;
    min-height: 44px;
    box-shadow: 0 10px 24px rgba(249,115,22,0.34), inset 0 1px 0 rgba(255,255,255,0.28);
  }
  #notes-modal .notes-editor-header-card {
    order: -2;
    padding: 11px 13px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 86%, transparent);
    border-left: 3px solid var(--notes-rail);
    box-shadow: none;
  }
  #notes-modal .notes-modal-kicker,
  #notes-modal .notes-modal-sync-note,
  #notes-modal .notes-editor-save-state {
    letter-spacing: 0.08em;
  }
  #notes-modal .notes-modal-kicker {
    color: var(--color-text-subtle, var(--text3));
  }
  #notes-modal .notes-modal-title {
    color: var(--color-text, var(--text));
    background: none;
    font-family: 'Nunito', sans-serif;
    font-size: 18px;
    font-weight: 850;
    letter-spacing: 0;
  }
  #notes-modal .notes-modal-subtitle,
  #notes-modal .notes-modal-sync-note {
    color: var(--color-text-subtle, var(--text3));
  }
  #notes-modal .notes-editor-head {
    order: -1;
    align-items: center;
    justify-content: flex-end;
  }
  #notes-modal .notes-back-btn {
    display: inline-flex;
  }
  #notes-modal .notes-editor-actions {
    padding: 4px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 70%, transparent);
    box-shadow: none;
  }
  #notes-modal .notes-editor-actions .btn {
    min-height: 32px;
    padding: 0 10px;
    border-radius: 6px;
    font-size: 12px;
  }
  #notes-modal .notes-editor-card {
    padding: 12px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 84%, transparent);
    box-shadow: none;
  }
  #notes-modal .notes-viewer {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  #notes-modal .notes-viewer[hidden],
  #notes-modal .notes-editor-card[hidden],
  #notes-modal .notes-viewer-card[hidden],
  #notes-modal #notes-edit-btn[hidden],
  #notes-modal #notes-done-btn[hidden] {
    display: none !important;
  }
  #notes-modal .notes-viewer-card {
    margin-bottom: 0;
    padding: 14px;
    border-radius: 8px;
    cursor: default;
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 84%, transparent);
    box-shadow: none;
  }
  #notes-modal .notes-viewer-card:hover {
    transform: none;
    border-color: var(--color-border, var(--border));
  }
  #notes-modal .notes-viewer-card:first-child {
    border-left: 3px solid var(--notes-rail);
  }
  #notes-modal .notes-viewer-title {
    font-family: 'Nunito', sans-serif;
    font-size: 28px;
    font-weight: 850;
    letter-spacing: 0;
    line-height: 1.12;
    color: var(--color-text, var(--text));
    margin-bottom: 6px;
  }
  #notes-modal .notes-viewer-meta {
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-text-subtle, var(--text3));
    margin-bottom: 12px;
  }
  #notes-modal .notes-viewer-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
  }
  #notes-modal .notes-viewer-body {
    min-height: 300px;
    padding: 4px 2px 8px;
    color: var(--color-text, var(--text));
    font-family: 'Nunito', sans-serif;
    font-size: 15px;
    line-height: 1.65;
    overflow-wrap: anywhere;
  }
  #notes-modal .notes-viewer-body.empty,
  #notes-modal .notes-body-preview-empty {
    color: var(--color-text-subtle, var(--text3));
  }
  #notes-modal .notes-viewer-body p { margin: 0 0 11px; }
  #notes-modal .notes-viewer-body ul,
  #notes-modal .notes-viewer-body ol { margin: 0 0 12px 20px; padding-left: 20px; }
  #notes-modal .notes-viewer-body li { margin: 3px 0; }
  #notes-modal .notes-viewer-body h1,
  #notes-modal .notes-viewer-body h2,
  #notes-modal .notes-viewer-body h3 { margin: 14px 0 8px; line-height: 1.18; }
  #notes-modal .notes-viewer-body a { color: var(--color-info, var(--blue)); }
  #notes-modal .notes-viewer-check-item {
    display: flex;
    align-items: flex-start;
    width: 100%;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 82%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--color-bg, var(--bg)) 24%, transparent);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
  }
  #notes-modal .notes-viewer-check-item:hover {
    border-color: color-mix(in srgb, var(--color-success, var(--green)) 34%, var(--color-border, var(--border)));
    background: color-mix(in srgb, var(--color-success, var(--green)) 8%, var(--color-bg, var(--bg)) 28%);
  }
  #notes-modal .notes-viewer-check-item:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--color-success, var(--green)) 72%, transparent);
    outline-offset: 2px;
  }
  #notes-modal .notes-viewer-check-item.done {
    opacity: 0.7;
  }
  #notes-modal .notes-viewer-check-item.done .notes-viewer-check-text {
    text-decoration: line-through;
  }
  #notes-modal .notes-viewer-check-mark {
    width: 18px;
    height: 18px;
    border-radius: 6px;
    border: 1px solid color-mix(in srgb, var(--color-success, var(--green)) 54%, var(--color-border, var(--border)));
    color: var(--color-success, var(--green));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 900;
    flex-shrink: 0;
    margin-top: 1px;
  }
  #notes-modal .notes-viewer-check-text {
    font-size: 14px;
    line-height: 1.45;
    color: var(--color-text, var(--text));
  }
  #notes-modal .notes-editor-card-main {
    padding: 14px;
  }
  #notes-modal .notes-editor-card-main label {
    margin-top: 4px;
    margin-bottom: -4px;
    color: var(--color-text-subtle, var(--text3));
    letter-spacing: 0.12em;
  }
  #notes-modal .notes-title,
  #notes-modal .notes-tags {
    border-radius: 8px;
    background: color-mix(in srgb, var(--color-bg, var(--bg)) 42%, var(--color-surface, var(--bg2)) 58%);
    border-color: color-mix(in srgb, var(--color-border, var(--border)) 84%, transparent);
  }
  #notes-modal .notes-editor-card-main .notes-title {
    min-height: 44px;
    padding: 0 2px;
    border-color: transparent;
    background: transparent;
    font-family: 'Nunito', sans-serif;
    font-size: 24px;
    font-weight: 850;
    letter-spacing: 0;
  }
  #notes-modal .notes-editor-card-main .notes-title:focus {
    border-color: color-mix(in srgb, var(--color-accent, var(--accent)) 42%, transparent);
    background: color-mix(in srgb, var(--color-bg, var(--bg)) 38%, transparent);
    padding-left: 10px;
  }
  #notes-modal .notes-body,
  #notes-modal .notes-body-preview {
    min-height: 360px;
    border-radius: 8px;
    background: color-mix(in srgb, var(--color-bg, var(--bg)) 44%, var(--color-surface, var(--bg2)) 56%);
    border-color: color-mix(in srgb, var(--color-border, var(--border)) 82%, transparent);
    font-size: 14px;
    line-height: 1.6;
  }
  #notes-modal .tag-hint {
    margin: -4px 0 0;
    color: var(--color-text-subtle, var(--text3));
    font-size: 9px;
  }
  #notes-modal .notes-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 6px;
    border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 82%, transparent);
    border-radius: 8px;
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 92%, transparent);
    gap: 5px;
  }
  #notes-modal .notes-toolbar-btn {
    min-height: 30px;
    border-radius: 6px;
    padding: 5px 9px;
    background: transparent;
    font-size: 10px;
  }
  #notes-modal #notes-bold-btn,
  #notes-modal #notes-italic-btn,
  #notes-modal #notes-underline-btn {
    width: 32px;
    padding-left: 0;
    padding-right: 0;
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
  }
  #notes-modal #notes-italic-btn { font-style: italic; }
  #notes-modal #notes-underline-btn { text-decoration: underline; }
  #notes-modal .notes-tag-chip,
  #notes-modal .notes-tag-suggestion,
  #notes-modal .notes-context-chip,
  #notes-modal .notes-list-badge {
    border-radius: 5px;
    background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 78%, transparent);
    font-size: 9px;
    letter-spacing: 0.04em;
  }
  #notes-modal .notes-editor-card-checklist,
  #notes-modal .notes-editor-card-attachments,
  #notes-modal .notes-context-card {
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 74%, transparent);
  }
  #notes-modal .notes-checklist-empty,
  #notes-modal .notes-drop-hint {
    border-radius: 8px;
    background: color-mix(in srgb, var(--color-bg, var(--bg)) 28%, transparent);
  }
  #notes-modal .notes-context-help {
    display: none;
  }
  #notes-modal #notes-new-btn {
    display: none;
  }
  @media (max-width: 860px) {
    #notes-modal .notes-modal-body {
      grid-template-columns: 1fr;
    }
    #notes-modal .notes-modal-header-actions {
      justify-content: center;
      padding: 6px 10px 2px;
      width: 100%;
    }
    #notes-modal .notes-editor-header-card {
      border-left-width: 0;
      border-top: 3px solid var(--notes-rail);
    }
    #notes-modal .notes-body,
    #notes-modal .notes-body-preview {
      min-height: 300px;
    }
    #notes-modal .filter-row {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }
  .role-alerts-toggle { flex-shrink: 0; display:flex; }
  .role-alerts-toggle .scope-btn { min-width: 0; }
  .role-alerts-toggle .scope-btn.active { background: color-mix(in srgb, var(--color-accent, var(--accent)) 72%, var(--color-surface, var(--bg2)) 28%); color: white; }
  .role-alerts-toggle .scope-btn:hover:not(.active) { color: var(--color-text, var(--text)); }
  .role-alerts-toggle .scope-btn:first-child { border-top-left-radius: 999px; border-bottom-left-radius: 999px; }
  .role-alerts-toggle .scope-btn:last-child { border-top-right-radius: 999px; border-bottom-right-radius: 999px; }
  .role-alerts-retry-fab {
    width: 42px;
    height: 42px;
    display:grid;
    place-items:center;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--color-orange, var(--orange)) 55%, rgba(255,255,255,0.12));
    background: linear-gradient(180deg, color-mix(in srgb, var(--color-orange, var(--orange)) 88%, white 12%), color-mix(in srgb, var(--color-orange, var(--orange)) 78%, black 22%));
    box-shadow: 0 10px 24px rgba(249,115,22,0.32), inset 0 1px 0 rgba(255,255,255,0.22);
    color: white;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
    touch-action: manipulation;
  }
  .role-alerts-retry-fab.spinning .role-alerts-retry-icon {
    animation: roleAlertsRetrySpin 0.65s ease-in-out;
  }
  .role-alerts-retry-fab:hover { transform: translateY(-1px); filter: brightness(1.05); }
  .role-alerts-retry-fab:focus-visible {
    outline: 2px solid rgba(255,255,255,0.8);
    outline-offset: 2px;
  }
  .role-alerts-retry-icon {
    width: 20px;
    height: 20px;
    color: white;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.25));
  }
  .role-alerts-close { white-space: nowrap; }
  .role-alerts-retry-fab { display: none; }
  .role-alerts-list {
    display:flex;
    flex-direction:column;
    gap: 12px;
    flex: 1;
    min-height: 0;
    overflow:auto;
    padding-right: 4px;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    touch-action: pan-y;
  }
  .role-alert-section { display:flex; flex-direction:column; gap:10px; }
  .role-alert-section-header {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-muted, var(--text2));
    padding: 0 2px;
  }
  .role-alert-section.active .role-alert-section-header {
    color: var(--color-text, var(--text));
  }
  .role-alert-section.accepted .role-alert-section-header {
    color: var(--color-text-subtle, var(--text3));
    opacity: 0.92;
  }
  .role-alert-section-count {
    font-family: 'Share Tech Mono', monospace;
    font-size: 9px;
    color: var(--color-text-muted, var(--text2));
    border: 1px solid rgba(255,255,255,0.08);
    background: rgba(255,255,255,0.05);
    border-radius: 999px;
    padding: 2px 7px;
  }
  .role-alert-section.active .role-alert-section-count {
    color: var(--color-accent, var(--accent));
    border-color: color-mix(in srgb, var(--color-accent, var(--accent)) 36%, rgba(255,255,255,0.12));
    background: color-mix(in srgb, var(--color-accent, var(--accent)) 13%, rgba(255,255,255,0.04));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-accent, var(--accent)) 8%, transparent);
  }
  .role-alert-section.accepted .role-alert-section-count {
    color: var(--color-text-subtle, var(--text3));
    border-color: rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.03);
  }
  .role-alert-section-body { display:flex; flex-direction:column; gap:9px; }
  .role-alert-section.active .role-alert-section-body { gap: 10px; }
  .role-alert-section.accepted .role-alert-section-body { gap: 8px; }
  .role-alert-card {
    border: 1px solid var(--role-alert-card-border, var(--color-border, var(--border)));
    border-radius: 18px;
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 82%, transparent);
    overflow: visible;
    box-shadow: 0 4px 24px rgba(0,0,0,0.3);
    transition: transform 0.18s, box-shadow 0.18s, opacity 0.18s, border-color 0.18s, background 0.18s;
  }
  .role-alert-section.active .role-alert-card {
    border-color: color-mix(in srgb, var(--role-alert-cat-color, var(--color-accent, var(--accent))) 42%, var(--color-border, var(--border)));
    box-shadow:
      0 4px 24px rgba(0,0,0,0.3),
      0 0 0 1px color-mix(in srgb, var(--role-alert-cat-color, var(--color-accent, var(--accent))) 8%, transparent);
  }
  .role-alert-section.accepted .role-alert-card {
    opacity: 0.9;
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 88%, transparent);
    border-color: color-mix(in srgb, var(--color-border, var(--border)) 82%, rgba(255,255,255,0.08));
    box-shadow: 0 4px 22px rgba(0,0,0,0.24);
    filter: saturate(0.96);
  }
  .role-alert-card:hover {
    border-color: color-mix(in srgb, var(--role-alert-cat-color, var(--color-text-muted, var(--text2))) 48%, var(--color-border, var(--border)));
    transform: translateY(-1px);
    box-shadow:
      0 4px 24px rgba(0,0,0,0.3),
      0 0 0 1px color-mix(in srgb, var(--role-alert-cat-color, var(--color-accent, var(--accent))) 10%, transparent);
  }
  .role-alert-card-body {
    width: 100%;
    display:block;
    padding: 14px 14px 10px;
    background: transparent;
    border: 0;
    color: inherit;
    text-align: left;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
  .role-alert-card-body:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--role-alert-cat-color, var(--color-accent, var(--accent))) 80%, white 20%);
    outline-offset: 2px;
  }
  .role-alert-card-shell {
    display:flex;
    flex-direction:column;
    gap: 8px;
  }
  .role-alert-card-header { margin-bottom: 0; }
  .role-alert-card-top {
    display:flex;
    align-items:flex-start;
    gap: 10px;
  }
  .role-alert-machine-tag {
    margin-top: 4px;
    flex-shrink: 0;
  }
  .role-alert-meta {
    flex: 1;
    min-width: 0;
    display:flex;
    flex-direction:column;
  }
  .role-alert-card-time {
    margin-top: 2px;
    padding-top: 6px;
    border-top: 1px solid rgba(255,255,255,0.08);
    color: var(--color-text-muted, var(--text2));
    font-size: 12.5px;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    line-height: 1.45;
  }
  .role-alert-card-time span {
    color: inherit;
  }
  .role-alert-section.accepted .role-alert-card-time {
    color: var(--color-text-subtle, var(--text3));
  }
  .role-alert-card-chip {
    display:inline-flex;
    align-items:center;
    gap:6px;
    min-height: 24px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.09);
    background: rgba(255,255,255,0.055);
    color: var(--color-text, var(--text));
    font-size: 10px;
    font-family: 'Share Tech Mono', monospace;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: nowrap;
  }
  .role-alert-card-side {
    display:none;
  }
  .role-alert-card-chip-state {
    border-color: color-mix(in srgb, var(--role-alert-cat-color, var(--color-accent, var(--accent))) 42%, rgba(255,255,255,0.16));
    background: color-mix(in srgb, var(--role-alert-cat-color, var(--color-accent, var(--accent))) 17%, rgba(255,255,255,0.05));
  }
  .role-alert-section.active .role-alert-card-chip-state {
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--role-alert-cat-color, var(--color-accent, var(--accent))) 12%, transparent);
  }
  .role-alert-section.accepted .role-alert-card-chip-state {
    opacity: 0.8;
    background: color-mix(in srgb, var(--role-alert-cat-color, var(--color-accent, var(--accent))) 12%, rgba(255,255,255,0.04));
  }
  .role-alert-card-chip-press {
    color: var(--color-text, var(--text));
    border-color: color-mix(in srgb, var(--color-text-subtle, var(--text3)) 55%, rgba(255,255,255,0.12));
    background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 82%, rgba(255,255,255,0.05));
  }
  .role-alert-section.accepted .role-alert-card-chip-press {
    color: var(--color-text-subtle, var(--text3));
    background: rgba(255,255,255,0.03);
  }
  .role-alert-card-sub {
    font-family: 'Rajdhani', sans-serif;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.1;
    letter-spacing: 0.2px;
    color: var(--color-text, var(--text));
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
  }
  .role-alert-card-note {
    font-size: 13px;
    color: var(--color-text-muted, var(--text2));
    line-height: 1.45;
    word-break: break-word;
    padding: 0;
    background: transparent;
    border: 0;
  }
  .role-alert-card-meta {
    display:flex;
    align-items:center;
    justify-content:flex-start;
    gap: 8px;
    flex-wrap:wrap;
    font-size: 11px;
    color: var(--color-text-muted, var(--text2));
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-transform: none;
    line-height: 1.4;
  }
  .role-alert-card-arrow {
    flex-shrink: 0;
    font-size: 24px;
    line-height: 1;
    color: var(--color-text-subtle, var(--text3));
    opacity: 0.62;
    padding-top: 5px;
  }
  .role-alert-card-actions {
    display:flex;
    flex-wrap:wrap;
    gap: 8px;
    padding: 0 14px 14px;
    margin-top: -2px;
  }
  .role-alert-action-btn {
    min-height: 38px;
    border-radius: 999px;
    padding: 0 14px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s, background 0.15s, border-color 0.15s, color 0.15s;
    touch-action: manipulation;
  }
  .role-alert-action-btn:hover { transform: translateY(-1px); }
  .role-alert-action-accept {
    border: 1px solid color-mix(in srgb, var(--color-success, var(--green)) 42%, rgba(255,255,255,0.08));
    color: var(--color-success, var(--green));
    background: linear-gradient(135deg, color-mix(in srgb, var(--color-success, var(--green)) 22%, transparent), color-mix(in srgb, var(--color-success, var(--green)) 8%, transparent));
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  }
  .role-alert-action-delete {
    border: 1px solid color-mix(in srgb, var(--color-danger, var(--red)) 30%, rgba(255,255,255,0.08));
    color: var(--color-danger, var(--red));
    background: rgba(255,255,255,0.035);
  }
  .role-alert-action-accept:hover {
    background: linear-gradient(135deg, color-mix(in srgb, var(--color-success, var(--green)) 28%, transparent), color-mix(in srgb, var(--color-success, var(--green)) 12%, transparent));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-success, var(--green)) 30%, transparent);
  }
  .role-alert-action-delete:hover {
    background: color-mix(in srgb, var(--color-danger, var(--red)) 10%, rgba(255,255,255,0.04));
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-danger, var(--red)) 20%, transparent);
  }
  .role-alert-section.accepted .role-alert-card-arrow {
    opacity: 0.52;
  }
  .role-alert-empty {
    padding: 16px 14px;
    display:flex;
    align-items:flex-start;
    gap:10px;
    border:1px dashed var(--color-border, var(--border));
    border-radius: 16px;
    background: linear-gradient(180deg, color-mix(in srgb, var(--color-surface, var(--bg2)) 88%, var(--color-surface-raised, var(--bg3)) 12%), color-mix(in srgb, var(--color-surface, var(--bg2)) 78%, var(--color-bg, var(--bg)) 22%));
  }
  .role-alert-empty-icon { width: 36px; height: 36px; flex-shrink: 0; display:grid; place-items:center; border-radius: 11px; background: color-mix(in srgb, var(--color-accent, var(--accent)) 12%, transparent); border: 1px solid color-mix(in srgb, var(--color-accent, var(--accent)) 28%, transparent); font-size: 16px; }
  .role-alert-empty-copy { display:flex; flex-direction:column; gap:4px; min-width: 0; }
  .role-alert-empty-title { font-family: 'Rajdhani', sans-serif; font-size: 15px; font-weight: 700; color: var(--color-text, var(--text)); letter-spacing: 0.15px; line-height: 1.15; }
  .role-alert-empty-sub { font-size: 11px; color: var(--color-text-muted, var(--text2)); line-height: 1.45; }
  .role-alert-empty-actions { display:flex; flex-wrap:wrap; gap:6px; margin-top: 2px; }
  .role-alert-empty-hint { margin-left:auto; align-self:center; font-size: 10px; line-height: 1.35; color: var(--color-text-subtle, var(--text3)); max-width: 160px; text-align:right; }
  label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--color-text-muted, var(--text2)); margin-bottom: 5px; }
  textarea { width: 100%; background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 8px; padding: 9px 11px; color: var(--color-text, var(--text)); font-family: 'Nunito', sans-serif; font-size: 13px; outline: none; resize: vertical; min-height: 90px; transition: border-color 0.2s; margin-bottom: 14px; }
  textarea:focus { border-color: var(--color-accent, var(--accent)); }
  .photo-upload-area { border: 2px dashed var(--color-border, var(--border)); border-radius: 8px; padding: 16px; text-align: center; cursor: pointer; transition: all 0.2s; margin-bottom: 10px; position: relative; }
  /* Log issue category picker */
  .log-cat-all-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(68px, 1fr));
    gap: 6px;
    margin-bottom: 8px;
  }
  .log-cat-btn { width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 9px 4px; border-radius: 12px; border: 2px solid transparent; cursor: pointer; transition: all 0.15s; background: var(--color-surface-raised, var(--bg3)); font-family: 'Nunito', sans-serif; }
  .log-cat-btn:active { transform: scale(0.95); }
  .log-cat-btn.selected { border-color: currentColor; }
  .log-cat-btn.search-match { animation: searchCatPulse 1.4s ease-in-out infinite; border-color: currentColor; }
  .swipe-category-panel.visible .swipe-status-tile.search-match { animation: searchCatPulse 1.4s ease-in-out infinite; border-color: currentColor; box-shadow: 0 0 8px currentColor; }
  .log-cat-icon { font-size: 18px; line-height: 1; }
  .log-cat-label { font-size: 9px; font-weight: 800; letter-spacing: 0.2px; white-space: nowrap; }
  .log-cat-selected { display: none; align-items: center; gap: 8px; margin-bottom: 8px; }
  .log-cat-selected.visible { display: flex; }
  .log-cat-pill { font-size: 11px; font-weight: 700; padding: 4px 12px; border-radius: 20px; border: 1px solid; display: inline-flex; align-items: center; gap: 4px; text-transform: uppercase; letter-spacing: 0.4px; cursor: pointer; }
  .log-cat-clear { font-size: 11px; color: var(--color-text-subtle, var(--text3)); background: none; border: none; cursor: pointer; font-family: 'Nunito', sans-serif; }
  .log-cat-clear:active { color: var(--color-text-muted, var(--text2)); }
  .log-sub-row { display: none; flex-wrap: wrap; gap: 5px; margin-bottom: 4px; }
  .log-sub-row.visible { display: flex; }
  .log-sub-row.visible.search-mode { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  .search-bar-row { display: none; }
  .search-bar-row.visible { display: block; min-height: 42px; margin-bottom: 6px; }
  .log-sub-chip { font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 20px; border: 1px solid; cursor: pointer; font-family: 'Nunito', sans-serif; transition: background 0.12s, transform 0.1s; }
  .log-sub-chip:active { transform: scale(0.94); }
  .log-sub-chip.selected { filter: brightness(1.2); }
  .log-sub-chip.skip { color: var(--color-text-subtle, var(--text3)) !important; border-color: var(--color-border, var(--border)) !important; background: transparent !important; font-style: italic; }
  .quality-defect-summary {
    display: none;
    align-items: flex-start;
    gap: 10px;
    margin: 10px 0 6px;
    padding: 10px;
    border: 1px solid rgba(6,182,212,0.34);
    border-radius: 12px;
    background: rgba(6,182,212,0.08);
  }
  .quality-defect-summary.visible { display: flex; }
  .quality-defect-summary-icon {
    flex: 0 0 auto;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9px;
    border: 1px solid rgba(6,182,212,0.35);
    color: #67e8f9;
    background: rgba(6,182,212,0.11);
    font-family: 'Share Tech Mono', monospace;
    font-size: 11px;
    font-weight: 700;
  }
  .quality-defect-summary-copy { flex: 1; min-width: 0; }
  .quality-defect-summary-label {
    color: var(--color-text, var(--text));
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
  }
  .quality-defect-summary-desc {
    margin-top: 3px;
    color: var(--color-text-muted, var(--text2));
    font-size: 12px;
    line-height: 1.35;
  }
  .quality-defect-summary-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
  }
  .quality-defect-link {
    border: 0;
    background: transparent;
    padding: 0;
    color: #67e8f9;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-size: 12px;
    font-weight: 800;
  }
  .quality-defect-modal {
    max-width: 780px;
    width: min(94vw, 780px);
    max-height: min(88vh, 760px);
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
  }
  .quality-defect-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--color-border, var(--border));
    background: var(--color-surface, var(--bg2));
  }
  .quality-defect-modal-close {
    flex: 0 0 auto;
    width: 44px;
    height: 44px;
    border: 1px solid var(--color-border, var(--border));
    border-radius: 50%;
    background: var(--color-surface-raised, var(--bg3));
    color: var(--color-text-muted, var(--text2));
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
  }
  .quality-defect-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: minmax(240px, 0.9fr) minmax(280px, 1.1fr);
    gap: 12px;
    padding: 14px;
    overflow: auto;
  }
  .quality-defect-picker { display: flex; flex-direction: column; gap: 10px; min-width: 0; min-height: 0; }
  .quality-defect-search {
    position: sticky;
    top: 0;
    z-index: 2;
    width: 100%;
    min-height: 42px;
    background: var(--color-surface-raised, var(--bg3));
    border: 1px solid var(--color-border, var(--border));
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--color-text, var(--text));
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    outline: none;
  }
  .quality-defect-search:focus { border-color: #06b6d4; box-shadow: 0 0 0 3px rgba(6,182,212,0.12); }
  .quality-defect-list {
    display: grid;
    gap: 6px;
    max-height: 468px;
    overflow: auto;
    padding-right: 2px;
  }
  .quality-defect-item {
    min-height: 50px;
    border: 1px solid var(--color-border, var(--border));
    border-radius: 11px;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
    color: var(--color-text, var(--text));
    padding: 9px 10px;
    cursor: pointer;
    text-align: left;
    font-family: 'Nunito', sans-serif;
    transition: transform 0.1s, border-color 0.15s, background 0.15s;
  }
  .quality-defect-item:active { transform: scale(0.98); }
  .quality-defect-item.selected {
    border-color: rgba(6,182,212,0.66);
    background: rgba(6,182,212,0.1);
  }
  .quality-defect-item-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.25;
  }
  .quality-defect-item-desc {
    margin-top: 4px;
    color: var(--color-text-muted, var(--text2));
    font-size: 11px;
    line-height: 1.35;
  }
  .quality-defect-item-check {
    flex: 0 0 auto;
    opacity: 0;
    color: #67e8f9;
    font-size: 15px;
    font-weight: 900;
  }
  .quality-defect-item.selected .quality-defect-item-check { opacity: 1; }
  .quality-defect-suggestions {
    min-width: 0;
    min-height: 420px;
    border: 1px solid var(--color-border, var(--border));
    border-radius: 13px;
    padding: 13px;
    background: var(--color-surface-raised, var(--bg3));
  }
  .quality-defect-empty {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--color-text-muted, var(--text2));
    font-size: 13px;
    line-height: 1.4;
  }
  .quality-defect-suggestion-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
  }
  .quality-defect-suggestion-title {
    font-family: 'Rajdhani', sans-serif;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.1;
  }
  .quality-defect-suggestion-desc {
    margin-top: 5px;
    color: var(--color-text-muted, var(--text2));
    font-size: 12px;
    line-height: 1.4;
  }
  .quality-defect-back {
    display: none;
    margin: 0 0 10px;
    border: 1px solid rgba(6,182,212,0.28);
    border-radius: 9px;
    background: rgba(6,182,212,0.08);
    color: #67e8f9;
    min-height: 36px;
    padding: 0 10px;
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-size: 12px;
    font-weight: 800;
  }
  .quality-defect-tabs {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    padding: 4px;
    border: 1px solid var(--color-border, var(--border));
    border-radius: 10px;
    background: var(--color-surface, var(--bg2));
  }
  .quality-defect-tab {
    flex: 1;
    min-width: 0;
    min-height: 32px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--color-text-muted, var(--text2));
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-size: 11px;
    font-weight: 900;
  }
  .quality-defect-tab.active {
    background: rgba(6,182,212,0.15);
    color: #67e8f9;
  }
  .quality-defect-call-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    color: var(--color-text-muted, var(--text2));
    font-size: 13px;
    line-height: 1.4;
  }
  .quality-defect-call-strip span:not(.quality-defect-call-sep) {
    color: #67e8f9;
    font-weight: 800;
  }
  .quality-defect-call-sep {
    color: var(--color-text-subtle, var(--text3));
  }
  .quality-defect-section {
    margin-top: 12px;
    padding-top: 11px;
    border-top: 1px solid var(--color-border, var(--border));
  }
  .quality-defect-section-title {
    margin-bottom: 7px;
    color: #67e8f9;
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  .quality-defect-suggestion-list {
    margin: 0;
    padding-left: 18px;
    color: var(--color-text-muted, var(--text2));
    font-size: 12px;
    line-height: 1.4;
  }
  .quality-defect-suggestion-list li + li { margin-top: 5px; }
  .quality-defect-modal-actions {
    flex: 0 0 auto;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border-top: 1px solid var(--color-border, var(--border));
  }
  .quality-defect-modal-state {
    min-width: 0;
    color: var(--color-text-muted, var(--text2));
    font-size: 12px;
  }
  .quality-defect-modal-buttons { display: flex; gap: 8px; }
  .response-escalation-overlay.visible {
    display: flex;
  }
  .response-escalation-modal {
    width: min(94vw, 460px);
    max-height: min(82vh, 620px);
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .response-escalation-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--color-border, var(--border));
    background: var(--color-surface, var(--bg2));
  }
  .response-escalation-kicker {
    color: var(--color-text-subtle, var(--text3));
    font-family: 'Share Tech Mono', monospace;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
  }
  .response-escalation-head h3 {
    margin: 3px 0 0;
    color: var(--color-text, var(--text));
    font-family: 'Rajdhani', sans-serif;
    font-size: 22px;
    line-height: 1.1;
  }
  .response-escalation-body {
    display: grid;
    gap: 10px;
    padding: 14px;
    overflow-y: auto;
  }
  .response-escalation-choice {
    display: grid;
    gap: 8px;
    border: 1px solid color-mix(in srgb, var(--path-color, var(--color-accent, var(--accent))) 36%, transparent);
    border-radius: 12px;
    padding: 11px;
    background: color-mix(in srgb, var(--path-color, var(--color-accent, var(--accent))) 8%, transparent);
  }
  .response-escalation-path {
    color: var(--color-text, var(--text));
    font-size: 14px;
    font-weight: 900;
    line-height: 1.2;
  }
  .response-escalation-trigger,
  .response-escalation-note {
    color: var(--color-text-muted, var(--text2));
    font-size: 12px;
    font-weight: 700;
    line-height: 1.35;
  }
  .response-escalation-confirm {
    justify-self: stretch;
    min-height: 40px;
    border: 1px solid color-mix(in srgb, var(--path-color, var(--color-accent, var(--accent))) 58%, transparent);
    border-radius: 10px;
    background: color-mix(in srgb, var(--path-color, var(--color-accent, var(--accent))) 18%, transparent);
    color: var(--color-text, var(--text));
    cursor: pointer;
    font-family: 'Nunito', sans-serif;
    font-size: 13px;
    font-weight: 900;
  }
  .response-escalation-confirm:disabled {
    cursor: wait;
    opacity: 0.7;
  }
  .response-escalation-actions {
    display: flex;
    justify-content: flex-end;
    padding: 12px 14px;
    border-top: 1px solid var(--color-border, var(--border));
    background: var(--color-surface, var(--bg2));
  }
  .issue-quality-defect {
    margin-top: 10px;
    border: 1px solid rgba(6,182,212,0.25);
    border-radius: 10px;
    padding: 9px 10px;
    background: rgba(6,182,212,0.07);
  }
  .issue-quality-defect-title {
    color: #67e8f9;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.25;
  }
  .issue-quality-defect-desc {
    margin-top: 3px;
    color: var(--color-text-muted, var(--text2));
    font-size: 12px;
    line-height: 1.35;
  }
  .issue-quality-defect-list {
    margin: 6px 0 0;
    padding-left: 18px;
    color: var(--color-text-muted, var(--text2));
    font-size: 11px;
    line-height: 1.35;
  }
  .issue-quick-phrases { 
    display:flex; 
    flex-wrap:nowrap; 
    gap:8px; 
    margin: 4px 0 12px; 
    overflow-x: auto; 
    padding-bottom: 8px;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    flex-shrink: 0;
  }
  .issue-quick-phrases::-webkit-scrollbar { display: none; }
  .issue-quick-phrase { 
    flex: 0 0 auto;
    border: 1px solid var(--color-border, var(--border)); 
    background: var(--color-surface-raised, var(--bg3)); 
    color: var(--color-text-muted, var(--text2)); 
    border-radius: 999px; 
    padding: 6px 12px; 
    font-size: 12px; 
    font-family:'Nunito', sans-serif; 
    font-weight:700; 
    cursor:pointer; 
    transition: all 0.15s; 
  }
  .issue-quick-phrase:active { transform: scale(0.95); }
  .issue-quick-phrase:hover { border-color: var(--color-accent, var(--accent)); color: var(--color-text, var(--text)); background: var(--focus-ring, var(--accent-glow)); }
  .issue-urgent-row { margin-bottom: 10px; }
  .issue-press-row {
    margin-bottom: 14px;
    flex-shrink: 0;
  }
  .issue-press-row label {
    margin-bottom: 6px;
  }
  .issue-machine-select {
    width: 100%;
    background: var(--color-surface-raised, var(--bg3));
    border: 1px solid var(--color-border, var(--border));
    border-radius: 10px;
    padding: 9px 12px;
    color: var(--color-text, var(--text));
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 700;
    outline: none;
  }
  .issue-machine-select:focus {
    border-color: var(--color-accent, var(--accent));
    box-shadow: 0 0 0 3px var(--focus-ring, var(--accent-glow));
  }
  .issue-urgent-toggle { display:inline-flex; align-items:center; cursor:pointer; position: relative; }
  .issue-urgent-toggle input { display:none; }
  .issue-urgent-pill.icon-only {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--color-border, var(--border));
    background: var(--color-surface-raised, var(--bg3));
    font-size: 18px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0.6;
    filter: grayscale(1);
  }
  .issue-urgent-toggle input:checked + .issue-urgent-pill.icon-only {
    opacity: 1;
    filter: grayscale(0);
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.5);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.25);
    transform: scale(1.1);
  }
  .issue-advanced-toggle { width:100%; display:flex; align-items:center; justify-content:space-between; gap:10px; background: transparent; border: 1px solid var(--color-border, var(--border)); border-radius: 10px; padding: 10px 12px; color: var(--color-text-muted, var(--text2)); cursor:pointer; font-family:'Nunito', sans-serif; font-size: 12px; font-weight: 700; margin-bottom: 10px; }
  .issue-advanced-toggle:active { transform: scale(0.99); }
  .issue-advanced-toggle-state { color: var(--color-accent, var(--accent)); }
  .issue-advanced-panel { display:none; padding: 12px 0 0; border-top: 1px dashed var(--color-border, var(--border)); margin-top: 2px; }
  .issue-advanced-panel.visible { display:block; }
  .subcategory-sheet-overlay {
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.22s ease, visibility 0s linear 0.22s;
  }
  .subcategory-sheet-overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition-delay: 0s;
  }
  .subcategory-sheet {
    width: min(640px, 100vw);
    max-width: 100vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--color-surface, var(--bg2));
    border: 1px solid var(--color-border, var(--border));
    border-bottom: none;
    border-radius: 22px 22px 0 0;
    padding: 12px 14px 14px;
    box-shadow: 0 -18px 48px rgba(0,0,0,0.52);
    opacity: 0;
    transform: translateY(16px) scale(0.985);
    transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.22s ease;
  }
  .subcategory-sheet-overlay.visible > .subcategory-sheet {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  .subcategory-sheet-header {
    flex: 0 0 auto;
    background: var(--color-surface, var(--bg2));
    margin: -12px -14px 12px -14px;
    padding: 12px 14px 12px 14px;
    border-bottom: 1px solid var(--color-border, var(--border));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  .subcategory-sheet-body {
    flex: 1 1 auto;
    overflow-y: auto;
    min-height: 0;
    margin-bottom: 12px;
    -webkit-overflow-scrolling: touch;
  }
  .subcategory-sheet-handle {
    width: 44px;
    height: 4px;
    border-radius: 999px;
    background: var(--color-border, var(--border));
    margin: 4px auto 12px;
  }
  .subcategory-sheet-head {
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap: 12px;
    margin-bottom: 14px;
  }
  .subcategory-sheet-copy { min-width: 0; }
  .subcategory-sheet-kicker {
    font-family:'Share Tech Mono', monospace;
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    color: var(--color-accent, var(--accent));
    margin-bottom: 4px;
  }
  .subcategory-sheet-title {
    font-family:'Rajdhani', sans-serif;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 0.4px;
    line-height: 1.1;
  }
  .subcategory-sheet-subtitle {
    margin-top: 6px;
    font-size: 12px;
    color: var(--color-text-muted, var(--text2));
    line-height: 1.4;
  }
  .subcategory-sheet-close {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--color-border, var(--border));
    background: var(--color-surface-raised, var(--bg3));
    color: var(--color-text-muted, var(--text2));
    cursor:pointer;
    font-size: 18px;
    line-height: 1;
  }
  .subcategory-sheet-section { margin-bottom: 14px; }
  .subcategory-sheet-label {
    font-family:'Share Tech Mono', monospace;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--color-text-subtle, var(--text3));
    margin-bottom: 8px;
  }
  .subcategory-parent-row {
    display:flex;
    gap: 8px;
    overflow-x:auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .subcategory-parent-row::-webkit-scrollbar { display:none; }
  .subcategory-parent-pill {
    flex: 0 0 auto;
    border: 1px solid var(--color-border, var(--border));
    background: var(--color-surface-raised, var(--bg3));
    color: var(--color-text-muted, var(--text2));
    border-radius: 12px;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    cursor:pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.1s;
  }
  .subcategory-parent-pill:active { transform: scale(0.97); }
  .subcategory-parent-pill.selected {
    border-color: var(--color-accent, var(--accent));
    color: var(--color-accent, var(--accent));
    background: var(--focus-ring, var(--accent-glow));
  }
  .subcategory-grid {
    display:grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px;
  }
  .response-path-section[hidden] { display: none !important; }
  .response-path-list {
    display: grid;
    gap: 6px;
  }
  .response-path-card {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
    min-height: 42px;
    border: 1px solid color-mix(in srgb, var(--path-color, var(--color-accent, var(--accent))) 34%, transparent);
    border-radius: 10px;
    background: color-mix(in srgb, var(--path-color, var(--color-accent, var(--accent))) 9%, transparent);
    padding: 8px 10px;
  }
  .response-path-title {
    color: var(--color-text, var(--text));
    font-size: 12px;
    font-weight: 900;
    line-height: 1.2;
  }
  .response-path-trigger {
    color: var(--color-text-muted, var(--text2));
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
  }
  .subcategory-item {
    min-height: 42px;
    border: 1px solid var(--color-border, var(--border));
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
    color: var(--color-text, var(--text));
    padding: 6px 10px;
    text-align:left;
    cursor:pointer;
    transition: transform 0.1s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap: 6px;
    font-family:'Nunito', sans-serif;
    font-weight: 700;
    font-size: 12px;
    line-height: 1.2;
  }
  .subcategory-item:active { transform: scale(0.98); }
  .subcategory-item:hover { border-color: var(--color-accent, var(--accent)); background: var(--focus-ring, var(--accent-glow)); }
  .subcategory-item.selected {
    border-color: var(--color-accent, var(--accent));
    box-shadow: 0 0 0 1px rgba(249,115,22,0.22), 0 0 18px rgba(249,115,22,0.14);
    background: rgba(249,115,22,0.08);
  }
  .subcategory-item-label { min-width: 0; }
  .subcategory-item-check {
    flex: 0 0 auto;
    opacity: 0;
    color: var(--color-accent, var(--accent));
    font-size: 16px;
    line-height: 1;
  }
  .subcategory-item.selected .subcategory-item-check { opacity: 1; }
  .subcategory-empty {
    grid-column: 1 / -1;
    border: 1px dashed var(--color-border, var(--border));
    border-radius: 14px;
    padding: 20px 14px;
    color: var(--color-text-muted, var(--text2));
    font-size: 13px;
    text-align:center;
    background: var(--color-surface-raised, var(--bg3));
  }
  /* ── Search mode (reverse subcategory lookup) ── */
  .search-input {
    width: 100%;
    min-height: 42px;
    background: var(--color-surface-raised, var(--bg3));
    border: 1px solid var(--color-border, var(--border));
    border-radius: 10px;
    padding: 10px 12px;
    color: var(--color-text, var(--text));
    font-family: 'Nunito', sans-serif;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
  }
  .search-input:focus { border-color: var(--color-accent, var(--accent)); }
  .search-input::placeholder { color: var(--color-text-subtle, var(--text3)); font-weight: 400; }
  .search-mode-item {
    min-height: 42px;
    border: 1px solid color-mix(in srgb, var(--color-text-muted, var(--text2)) 25%, transparent);
    border-radius: 10px;
    background: linear-gradient(180deg, rgba(255,255,255,0.03), transparent);
    color: var(--color-text, var(--text));
    padding: 6px 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Nunito', sans-serif;
    font-weight: 700;
    font-size: 12px;
    line-height: 1.2;
    transition: transform 0.1s, border-color 0.15s, background 0.15s;
  }
  .search-mode-item:active { transform: scale(0.97); }
  .search-mode-item:hover { border-color: var(--color-accent, var(--accent)); background: var(--focus-ring, var(--accent-glow)); }
  .search-mode-item.selected { border-color: var(--color-accent, var(--accent)); background: var(--focus-ring, var(--accent-glow)); box-shadow: 0 0 0 1px rgba(249,115,22,0.22), 0 0 18px rgba(249,115,22,0.14); }
  .search-mode-item-label { flex: 1; min-width: 0; }
  .search-mode-count {
    flex: 0 0 auto;
    font-size: 10px;
    font-weight: 600;
    color: var(--color-text-subtle, var(--text3));
    background: var(--color-surface-raised, var(--bg3));
    border-radius: 8px;
    padding: 2px 7px;
    font-family: 'Share Tech Mono', monospace;
  }
  .search-no-match {
    padding: 12px 0;
    color: var(--color-text-subtle, var(--text3));
    font-size: 12px;
    text-align: center;
    font-family: 'Nunito', sans-serif;
  }


  .subcategory-sheet-footer {
    position: sticky;
    bottom: 0;
    display:flex;
    gap: 10px;
    justify-content:flex-end;
    padding-top: 12px;
    margin-top: 10px;
    background: linear-gradient(180deg, rgba(0,0,0,0), var(--color-surface, var(--bg2)) 18px);
  }
  .subcategory-sheet-secondary,
  .subcategory-sheet-primary { min-height: 44px; }
  .subcategory-sheet-secondary { margin-right:auto; }
  /* New photo buttons */
  .photo-stack { display:flex; flex-direction:column; gap:8px; margin-bottom:8px; }
  .photo-btn-row { display: flex; gap: 8px; margin-bottom: 0; }
  .photo-source-row { display:none; gap: 8px; }
  .photo-source-row.visible { display:flex; }
  .photo-pick-btn { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px; border-radius: 10px; border: 1px dashed var(--color-border, var(--border)); background: transparent; color: var(--color-text-muted, var(--text2)); font-size: 13px; font-family: 'Nunito', sans-serif; font-weight: 600; cursor: pointer; transition: all 0.15s; }
  .photo-add-btn { border-style: solid; border-color: rgba(249,115,22,0.35); color: var(--color-accent, var(--accent)); background: rgba(249,115,22,0.06); }
  .photo-pick-btn:active { border-color: var(--color-accent, var(--accent)); color: var(--color-accent, var(--accent)); }
  .photo-upload-area:hover, .photo-upload-area.drag-over { border-color: var(--color-accent, var(--accent)); background: var(--focus-ring, var(--accent-glow)); }
  .photo-upload-area input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
  .upload-text { font-size: 12px; color: var(--color-text-muted, var(--text2)); }
  .upload-icon { font-size: 20px; margin-bottom: 4px; }
  .photo-previews { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 12px; }
  .photo-preview-item { position: relative; }
  .photo-preview-img { width: 66px; height: 66px; object-fit: cover; border-radius: 6px; border: 1px solid var(--color-border, var(--border)); }
  .photo-remove { position: absolute; top: -5px; right: -5px; background: var(--color-danger, var(--red)); color: white; border: none; border-radius: 50%; width: 17px; height: 17px; font-size: 9px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
  .modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
  .sms-compose-modal { width: min(560px, 95vw); }
  .sms-recipient-picker { max-height: 140px; overflow-y: auto; background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 8px; padding: 6px; margin-bottom: 10px; }
  .sms-recipient-empty { font-size: 12px; color: var(--color-text-subtle, var(--text3)); padding: 6px; }
  .sms-recipient-row { display: flex; align-items: center; gap: 8px; padding: 6px; border-radius: 6px; font-size: 12px; color: var(--color-text, var(--text)); }
  .sms-recipient-row:hover { background: var(--bg4); }
  .sms-recipient-row input { margin: 0; }
  .sms-recipient-phone { color: var(--color-text-subtle, var(--text3)); font-family: 'Share Tech Mono', monospace; font-size: 11px; margin-left: auto; }
  .sms-toggle-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 10px 0; text-transform: none; letter-spacing: 0; font-family: 'Nunito', sans-serif; color: var(--color-text, var(--text)); }

  /* LIGHTBOX */
.lightbox {
  display: flex;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 2000;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0s linear 0.22s;
}
.lightbox.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}
.lightbox img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 8px;
  user-select: none;
  -webkit-user-drag: none;
  opacity: 0;
  transform: translateY(12px) scale(0.985);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.22s ease;
}
.lightbox.visible img { opacity: 1; transform: translateY(0) scale(1); }
.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  font-size: 30px;
  color: white;
  cursor: pointer;
  z-index: 1;
  opacity: 0;
  transform: translateY(-6px);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.22s ease;
}
.lightbox.visible .lightbox-close { opacity: 1; transform: translateY(0); }
.lightbox-download {
  position: absolute;
  top: 24px;
  right: 76px;
  z-index: 1;
  border: 1px solid rgba(255,255,255,0.45);
  border-radius: 7px;
  padding: 7px 10px;
  background: rgba(0,0,0,0.28);
  color: white;
  font: 700 12px 'Nunito', sans-serif;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-6px);
  transition: background 0.15s, transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.22s ease;
}
.lightbox.visible .lightbox-download { opacity: 1; transform: translateY(0); }
.lightbox-download:hover { background: rgba(255,255,255,0.18); }
.lightbox-download:disabled { cursor: default; opacity: 0.45; }
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(calc(-50% + 8px)) scale(0.985);
  background: rgba(255,255,255,0.15);
  border: none;
  color: white;
  font-size: 22px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.22s ease;
  opacity: 0;
}
.lightbox.visible .lightbox-nav { opacity: 1; transform: translateY(-50%) scale(1); }
.lightbox-nav:hover { background: rgba(255,255,255,0.28); }
.lightbox-nav.prev { left: 16px; }
.lightbox-nav.next { right: 16px; }
.lightbox-counter {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  color: rgba(255,255,255,0.75);
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.22s ease;
}
.lightbox.visible .lightbox-counter { opacity: 1; transform: translateX(-50%) translateY(0); }
.lightbox-meta {
  position: absolute;
  bottom: 44px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  color: rgba(255,255,255,0.88);
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  pointer-events: none;
  opacity: 0;
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.22s ease;
}
.lightbox.visible .lightbox-meta { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 480px) {
  .lightbox-download { top: 22px; right: 64px; padding: 6px 8px; font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .modal-overlay,
  #editorModal.modal-overlay,
  .admin-overlay,
  .subcategory-sheet-overlay,
  .lightbox,
  .msg-sheet-overlay,
  .modal,
  #editorModal .modal,
  .phone,
  .admin-panel-inner,
  .subcategory-sheet,
  .msg-sheet {
    transition: none !important;
    animation: none !important;
  }
  .issue-card.action-confirmed,
  .issue-card.resolved-pop,
  .issue-card.evidence-added,
  .press-btn.action-pulse,
  .swipe-status-tile.confirmed,
  .swipe-sub-inner .subcategory-item.confirmed,
  .wf-step-btn.wf-step-confirmed,
  .action-mini-celebration {
    animation: none !important;
  }
  .issue-card.action-confirmed,
  .issue-card.resolved-pop,
  .issue-card.evidence-added {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--action-feedback-color, var(--color-accent, var(--accent))) 42%, transparent), 0 4px 24px rgba(0,0,0,0.3);
  }
  .issue-card.resolved-pop::before,
  .action-mini-celebration {
    display: none !important;
  }
}

  .empty-state { text-align: center; padding: 50px 20px; color: var(--color-text-subtle, var(--text3)); width: 100%; }
  .empty-state-icon { font-size: 36px; margin-bottom: 10px; }
  .empty-state-text { font-size: 14px; }
  .mascot-empty-wrap { display:flex; justify-content:center; margin-bottom:16px; opacity:0.85; }
  .load-more-row { width: 100%; display: flex; justify-content: center; padding: 16px 0 8px; }
  .load-more-btn { background: transparent; border: 1px solid var(--color-border, var(--border)); border-radius: 20px; color: var(--color-text-muted, var(--text2)); font-family: 'Nunito', sans-serif; font-size: 13px; padding: 8px 20px; cursor: pointer; display: flex; align-items: center; gap: 8px; transition: border-color 0.15s, color 0.15s; }
  .load-more-btn:hover { border-color: var(--color-accent, var(--accent)); color: var(--color-accent, var(--accent)); }
  .load-more-count { font-family: 'Share Tech Mono', monospace; font-size: 11px; color: var(--color-text-subtle, var(--text3)); background: var(--color-surface-raised, var(--bg3)); border-radius: 10px; padding: 1px 7px; }
  .shift-badge { font-family: 'Share Tech Mono', monospace; font-size: 10px; font-weight: 600; border: 1px solid; border-radius: 4px; padding: 1px 5px; white-space: nowrap; }
  .shift-filter-row { display:flex; gap:6px; flex-wrap:wrap; align-items:center; margin-top:8px; }
  .shift-dropdown-wrap { position:relative; display:inline-flex; }
  .shift-filter-pill { background:var(--color-surface-raised, var(--bg3)); border:1px solid var(--color-border, var(--border)); border-radius:14px; color:var(--color-text-muted, var(--text2)); font-family:'Nunito',sans-serif; font-size:12px; padding:4px 12px; cursor:pointer; transition:border-color 0.15s,color 0.15s,background 0.15s; }
  .shift-filter-pill.active { border-color:var(--color-accent, var(--accent)); color:var(--color-accent, var(--accent)); background:color-mix(in srgb,var(--color-accent, var(--accent)) 10%,transparent); }
  .shift-dropdown-btn { display:inline-flex; align-items:center; justify-content:space-between; gap:8px; min-width:118px; }
  .shift-dropdown-btn.open .shift-dropdown-arrow { transform:rotate(180deg); }
  .shift-dropdown-arrow { display:inline-flex; transition:transform 0.15s ease; }
  .shift-dropdown { left:0; right:auto; min-width:138px; z-index:260; }
  .filter-clear-pill { color: var(--color-accent, var(--accent)); border-color: color-mix(in srgb, var(--color-accent, var(--accent)) 45%, var(--color-border, var(--border))); background: color-mix(in srgb, var(--color-accent, var(--accent)) 7%, var(--color-surface-raised, var(--bg3))); }
  .filter-clear-pill:hover { color: var(--color-text, var(--text)); border-color: var(--color-accent, var(--accent)); background: color-mix(in srgb, var(--color-accent, var(--accent)) 12%, var(--color-surface-raised, var(--bg3))); }

  @media (max-width: 980px) {
    .press-wiki-layout { grid-template-columns: 1fr; }
    .press-wiki-sidebar { order: 2; }
    .press-wiki-main { order: 1; }
  }
  @media (max-width: 700px) {
    body {
      background-attachment: scroll;
    }
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal-overlay.visible { align-items: flex-end; }
    .modal-overlay {
      backdrop-filter: none;
      -webkit-backdrop-filter: none;
    }
    body.modal-swipe-dragging { overscroll-behavior: none; }
    .phone {
      width: 100vw;
      max-width: 100vw;
      height: 100dvh;
      max-height: 100dvh;
      border-radius: 22px 22px 0 0;
      margin: 0;
      border-left: none;
      border-right: none;
      border-bottom: none;
      box-shadow: 0 -18px 48px rgba(0,0,0,0.45);
    }
    .phone > .app-container {
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
    }
    .modal {
      width: 100vw;
      max-width: 100vw;
      max-height: calc(100dvh - 10px);
      border-radius: 22px 22px 0 0;
      padding: 18px 16px calc(16px + env(safe-area-inset-bottom));
      margin-top: auto;
      overflow-x: hidden;
      overflow-y: auto;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      box-shadow: 0 -18px 48px rgba(0,0,0,0.45);
      position: relative;
    }
    .modal::before,
    .store-modal::before {
      content: '';
      display: block;
      width: 64px;
      height: 7px;
      border-radius: 999px;
      background: color-mix(in srgb, var(--color-text-subtle, var(--text3)) 58%, transparent);
      margin: 0 auto 12px;
      opacity: 0.9;
      flex-shrink: 0;
    }
    .store-modal::before {
      cursor: grab;
      touch-action: none;
      user-select: none;
      -webkit-user-drag: none;
    }
    .modal > .modal-title:first-child,
    .modal > .modal-header-row:first-child,
    .press-wiki-header-row {
      position: sticky;
      top: 0;
      z-index: 3;
      background: linear-gradient(180deg, var(--color-surface, var(--bg2)) 82%, rgba(0,0,0,0));
      padding-top: 2px;
      padding-bottom: 10px;
      margin-top: -2px;
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
    }
    .modal-title,
    .press-wiki-title,
    .store-modal-title {
      font-family: 'Rajdhani', sans-serif;
      font-weight: 700;
      letter-spacing: 0.6px;
      line-height: 1;
    }
    .modal-title,
    .store-modal-title {
      font-size: 22px;
    }
    .press-wiki-title {
      font-size: 22px;
    }
    .store-modal-title {
      gap: 8px;
    }
    .store-modal-title svg {
      flex-shrink: 0;
      width: 18px;
      height: 18px;
    }
    .msg-header-tabs {
      flex: 0 0 auto;
      order: 3;
      margin-top: 4px;
    }
    .msg-header-actions {
      order: 2;
      margin-left: auto;
    }
    .msg-icon-btn,
    .msg-close-btn,
    .store-modal-close {
      width: 36px;
      height: 36px;
    }
    .press-wiki-header-row {
      position: sticky;
      top: 0;
      z-index: 3;
      background: linear-gradient(180deg, var(--color-surface, var(--bg2)) 82%, rgba(0,0,0,0));
      padding-top: 2px;
      padding-bottom: 8px;
      margin-top: -2px;
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
    }

    .modal-actions {
      position: sticky;
      bottom: 0;
      background: linear-gradient(180deg, rgba(0,0,0,0), var(--color-surface, var(--bg2)) 18px);
      padding-top: 10px;
      padding-bottom: calc(2px + env(safe-area-inset-bottom));
      margin-top: 10px;
    }
    .modal-actions .btn { min-height: 44px; padding-left: 14px; padding-right: 14px; }
    .photo-source-row.visible { flex-direction: column; }
    .photo-source-row.visible .photo-pick-btn { width: 100%; }
    .issue-quick-phrase { padding: 8px 12px; }
    .quality-defect-modal-overlay {
      align-items: flex-end;
      padding: 0;
    }
    .quality-defect-modal {
      width: 100vw;
      max-width: 100vw;
      max-height: 96vh;
      border-radius: 22px 22px 0 0;
    }
    .quality-defect-modal-body {
      display: block;
      overflow-y: auto;
    }
    .quality-defect-list {
      max-height: none;
      overflow: visible;
    }
    .quality-defect-suggestions {
      display: none;
      min-height: 0;
    }
    .quality-defect-modal-overlay.detail-mode .quality-defect-picker {
      display: none;
    }
    .quality-defect-modal-overlay.detail-mode .quality-defect-suggestions {
      display: block;
    }
    .quality-defect-back {
      display: inline-flex;
      align-items: center;
    }
    .quality-defect-modal-header {
      padding: 14px 18px 10px;
    }
    .quality-defect-modal .modal-title {
      font-size: 22px;
      line-height: 1;
    }
    .quality-defect-modal .modal-subtitle {
      font-size: 11px;
      line-height: 1.3;
    }
    .quality-defect-modal-state {
      display: none;
    }
    .quality-defect-modal-actions {
      align-items: stretch;
      flex-direction: column;
    }
    .quality-defect-modal-buttons {
      width: 100%;
      flex-wrap: wrap;
    }
    .quality-defect-modal-buttons .btn {
      flex: 1;
      min-width: 0;
    }
    #quality-defect-modal-confirm {
      order: 3;
      flex: 1 0 100%;
      min-height: 48px;
    }
    #quality-defect-modal-clear {
      order: 1;
      flex: 0 1 auto;
      border-color: transparent;
      background: transparent;
      color: var(--color-text-muted, var(--text2));
    }
    #quality-defect-modal-cancel {
      order: 2;
      flex: 1;
    }
    .subcategory-sheet {
      width: 100vw;
      max-height: calc(100dvh - 10px);
      padding: 10px 12px 12px;
      border-radius: 22px 22px 0 0;
      display: flex;
      flex-direction: column;
      overflow: hidden;
    }
    .subcategory-sheet-header {
      margin: -10px -12px 12px -12px;
      padding: 10px 12px 10px 12px;
      background: var(--color-surface, var(--bg2));
      border-bottom: 1px solid var(--color-border, var(--border));
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
    }
    .subcategory-sheet-head {
      margin: 0 0 10px 0;
    }
    .subcategory-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .subcategory-sheet-title { font-size: 20px; }
    .role-alerts-modal {
      align-items: flex-end;
      padding: 8px;
      opacity: 0;
      visibility: hidden;
      pointer-events: none;
    }
    .role-alerts-modal.visible {
      opacity: 1;
      visibility: visible;
      pointer-events: auto;
    }
    .store-modal-header {
      position: sticky;
      top: 0;
      z-index: 3;
      background: linear-gradient(180deg, var(--color-surface, var(--bg2)) 82%, rgba(0,0,0,0));
      padding-top: 2px;
      padding-bottom: 10px;
      margin-top: -2px;
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
    }
    .notes-modal-a-header,
    .notes-modal-b-header {
      position: sticky;
      top: 0;
      z-index: 3;
      background: linear-gradient(180deg, var(--color-surface, var(--bg2)) 82%, rgba(0,0,0,0));
      padding-top: 2px;
      padding-bottom: 12px;
      margin-top: -2px;
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
    }
    .role-alerts-toolbar { align-items: stretch; }
    .role-alerts-toggle,
    .msg-header-tabs,
    .store-modal-tabs {
      display: flex;
      align-items: stretch;
      gap: 0;
      width: 100%;
      border: 1px solid var(--color-border, var(--border));
      border-radius: 999px;
      overflow: hidden;
      background: var(--color-surface-raised, var(--bg3));
      flex-shrink: 0;
    }
    .role-alerts-toggle {
      flex-wrap: nowrap;
    }
    .role-alerts-toggle .scope-btn,
    .msg-header-tabs .msg-tab,
    .store-modal-tabs .store-tab {
      flex: 1 1 0;
      min-width: 0;
      border: none;
      border-right: 1px solid var(--color-border, var(--border));
      border-radius: 0;
      padding: 8px 10px;
      font-family: 'Rajdhani', sans-serif;
      font-size: 12px;
      font-weight: 700;
      letter-spacing: 0.04em;
      line-height: 1;
      color: var(--color-text-muted, var(--text2));
      background: transparent;
      white-space: nowrap;
    }
    .role-alerts-toggle .scope-btn:last-child,
    .msg-header-tabs .msg-tab:last-child,
    .store-modal-tabs .store-tab:last-child {
      border-right: none;
    }
    .role-alerts-toggle .scope-btn.active,
    .msg-header-tabs .msg-tab.active,
    .store-modal-tabs .store-tab.active {
      background: var(--color-accent, var(--accent));
      color: white;
    }
    .msg-header-tabs .msg-tab.active {
      background: var(--ios-blue);
    }
    .store-modal-tabs {
      padding: 0;
      border-bottom: 1px solid var(--color-border, var(--border));
      border-radius: 16px 16px 12px 12px;
      margin-bottom: 6px;
    }
    .store-modal-tabs .store-tab {
      padding: 8px 10px;
      margin-bottom: 0;
    }
    .store-tab-soon {
      font-size: 8px;
      letter-spacing: 0.08em;
      background: color-mix(in srgb, var(--color-surface, var(--bg2)) 85%, white 15%);
      color: var(--color-text-subtle, var(--text3));
    }
    .msg-header-tabs {
      max-width: none;
      margin-top: 2px;
      margin-bottom: 0;
    }
    .msg-header-tabs .msg-tab {
      font-size: 11px;
    }
    .role-alerts-toggle { width: 100%; }
    .role-alerts-toggle .scope-btn { flex: 1 1 0; }
    .role-alerts-list {
      padding-right: 2px;
      touch-action: pan-y;
    }
    .role-alert-section-header {
      font-size: 10px;
      letter-spacing: 0.1em;
    }
    .role-alert-section-count {
      min-width: 28px;
      padding: 2px 6px;
      text-align: center;
    }
    .role-alert-card-body { padding: 12px 12px 8px; }
    .role-alert-card-shell { gap: 7px; }
    .role-alert-card-arrow { display: none; }
    .role-alert-card-actions { padding: 0 12px 12px; gap: 8px; }
    .role-alert-card-top { gap: 8px; }
    .role-alert-card-time {
      font-size: 11px;
      padding-top: 5px;
    }
    .role-alert-card-sub {
      font-size: 16px;
    }
    .role-alert-card-note {
      font-size: 12px;
      line-height: 1.38;
    }
    .role-alert-card-chip {
      min-height: 22px;
      padding: 0 8px;
      font-size: 9px;
    }
    .role-alert-action-btn { flex: 1 1 120px; min-height: 44px; }
    .role-alert-empty { flex-direction: column; gap: 10px; }
    .role-alert-empty-hint { margin-left: 0; align-self: stretch; text-align: left; max-width: none; }
    .role-alert-empty-icon { width: 34px; height: 34px; font-size: 15px; }
    .role-alert-empty-copy { gap: 3px; }
    .role-alert-empty-title { font-size: 14px; }
    .role-alert-empty-sub { font-size: 10px; }
    .role-alert-empty-actions { gap: 6px; }
    .role-alert-empty-hint { display: none; }
    .role-alerts-close-fab { width: 46px; height: 46px; right: 10px; bottom: 10px; }
  }

  /* ── MASCOT ANIMATIONS ── */
  @keyframes mascot-flame-flicker { 0%,100%{transform:scaleX(1) scaleY(1) rotate(0deg)} 20%{transform:scaleX(1.04) scaleY(0.97) rotate(1deg)} 40%{transform:scaleX(0.97) scaleY(1.03) rotate(-1deg)} 60%{transform:scaleX(1.03) scaleY(0.98) rotate(0.5deg)} 80%{transform:scaleX(0.98) scaleY(1.02) rotate(-0.5deg)} }
  @keyframes mascot-flame-glow { 0%,100%{filter:drop-shadow(0 0 6px rgba(245,166,35,0.5))} 50%{filter:drop-shadow(0 0 18px rgba(245,166,35,0.95))} }
  @keyframes mascot-wrench-spin { 0%{transform:rotate(-20deg)} 50%{transform:rotate(20deg)} 100%{transform:rotate(-20deg)} }
  @keyframes mascot-gear-rotate { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }
  @keyframes mascot-gear-counter { from{transform:rotate(0deg)} to{transform:rotate(-360deg)} }
  @keyframes roleAlertsRetrySpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
  }
  @keyframes mascot-gauge-bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-5px)} }
  @keyframes mascot-mold-left { 0%,100%{transform:translateX(0)} 40%,60%{transform:translateX(-10px)} }
  @keyframes mascot-mold-right { 0%,100%{transform:translateX(0)} 40%,60%{transform:translateX(10px)} }
  @keyframes mascot-mold-glow { 0%,100%{opacity:0.2} 50%{opacity:0.8} }
  @keyframes mascot-mag-scan { 0%{transform:translate(0,0) rotate(-15deg)} 25%{transform:translate(18px,-8px) rotate(5deg)} 50%{transform:translate(30px,5px) rotate(-5deg)} 75%{transform:translate(10px,15px) rotate(10deg)} 100%{transform:translate(0,0) rotate(-15deg)} }
  @keyframes mascot-scan-pulse { 0%,100%{opacity:0.15} 50%{opacity:0.7} }
  @keyframes mascot-wave-bob { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-7px)} }
  @keyframes mascot-line-draw { 0%{stroke-dashoffset:200} 100%{stroke-dashoffset:0} }
  @keyframes mascot-node-pop { 0%,80%,100%{opacity:0.4} 40%{opacity:1} }
  @keyframes mascot-lift-bounce { 0%,100%{transform:translateY(0) rotate(0deg)} 30%{transform:translateY(-8px) rotate(1deg)} 60%{transform:translateY(-4px) rotate(-0.5deg)} }
  @keyframes mascot-fork-raise { 0%,100%{transform:translateY(0)} 40%,60%{transform:translateY(-14px)} }
  @keyframes mascot-wheel-spin { from{transform:rotate(0deg)} to{transform:rotate(360deg)} }
  .mascot-flame-body { animation: mascot-flame-flicker 1.8s ease-in-out infinite, mascot-flame-glow 1.8s ease-in-out infinite; transform-origin: center 140px; }
  .mascot-wrench-anim { animation: mascot-wrench-spin 2.5s ease-in-out infinite; transform-origin: 80px 100px; }
  .mascot-gear-outer { animation: mascot-gear-rotate 6s linear infinite; transform-origin: 90px 86px; }
  .mascot-gear-inner { animation: mascot-gear-counter 4s linear infinite; transform-origin: 90px 86px; }
  .mascot-gauge-body { animation: mascot-gauge-bob 3s ease-in-out infinite; }
  .mascot-mold-left { animation: mascot-mold-left 3.5s ease-in-out infinite; }
  .mascot-mold-right { animation: mascot-mold-right 3.5s ease-in-out infinite; }
  .mascot-mold-seam { animation: mascot-mold-glow 3.5s ease-in-out infinite; }
  .mascot-mag-body { animation: mascot-mag-scan 4s ease-in-out infinite; transform-origin: 80px 80px; }
  .mascot-scan-beam { animation: mascot-scan-pulse 1.6s ease-in-out infinite; }
  .mascot-sigma-body { animation: mascot-wave-bob 3s ease-in-out infinite; }
  .mascot-wave-line { stroke-dasharray: 200; animation: mascot-line-draw 2s linear infinite; }
  .mascot-data-node { animation: mascot-node-pop 2s ease-in-out infinite; }
  .mascot-lift-chassis { animation: mascot-lift-bounce 2.2s ease-in-out infinite; }
  .mascot-lift-forks { animation: mascot-fork-raise 2.2s ease-in-out infinite; }
  .mascot-lift-wheel { animation: mascot-wheel-spin 1.1s linear infinite; transform-origin: center; }
  /* CINDER (startup) — heat ring animations */
  @keyframes mascot-heat-pulse { 0%,100%{transform:scale(1);opacity:0.5} 50%{transform:scale(1.14);opacity:1} }
  @keyframes mascot-heat-bob   { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-5px)} }
  @keyframes mascot-heat-wave  { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }
  .mascot-heat-ring-1 { animation: mascot-heat-pulse 2s ease-in-out infinite;       transform-origin: 90px 90px; }
  .mascot-heat-ring-2 { animation: mascot-heat-pulse 2s ease-in-out 0.45s infinite; transform-origin: 90px 90px; }
  .mascot-heat-ring-3 { animation: mascot-heat-pulse 2s ease-in-out 0.9s  infinite; transform-origin: 90px 90px; }
  .mascot-heat-waves  { animation: mascot-heat-wave 1.5s ease-in-out infinite; }
  .mascot-ramp-body   { animation: mascot-heat-bob  2.5s ease-in-out infinite; }
  /* HAZARD (alert) — E-STOP pulse */
  @keyframes mascot-estop-pulse { 0%,100%{transform:scale(1)} 45%,55%{transform:scale(1.06)} }
  @keyframes mascot-estop-flash { 0%,100%{opacity:0.35} 45%,55%{opacity:0.9} }
  .mascot-estop-body { animation: mascot-estop-pulse 0.85s ease-in-out infinite; transform-origin: 90px 82px; }
  .mascot-estop-ring { animation: mascot-estop-flash 0.85s ease-in-out infinite; }
  /* KLAX (open) — bell swing + waves */
  @keyframes mascot-bell-swing { 0%,100%{transform:rotate(-7deg)} 50%{transform:rotate(7deg)} }
  @keyframes mascot-bell-wave  { 0%{opacity:0;transform:scale(1)} 40%{opacity:0.6} 100%{opacity:0;transform:scale(1.28)} }
  .mascot-bell-body  { animation: mascot-bell-swing 0.65s ease-in-out infinite; transform-origin: 90px 65px; }
  .mascot-bell-wave1 { animation: mascot-bell-wave 1.3s ease-out infinite; transform-origin: 90px 90px; }
  .mascot-bell-wave2 { animation: mascot-bell-wave 1.3s ease-out 0.65s infinite; transform-origin: 90px 90px; }
  /* CLEAR (resolved) — calm glow pulse */
  @keyframes mascot-clear-pulse { 0%,100%{opacity:0.45;transform:scale(1)} 50%{opacity:0.85;transform:scale(1.07)} }
  @keyframes mascot-clear-ray   { 0%,100%{opacity:0.25} 50%{opacity:0.85} }
  .mascot-clear-dome  { animation: mascot-clear-pulse 2.4s ease-in-out infinite; transform-origin: 90px 80px; }
  .mascot-clear-glow  { animation: mascot-clear-pulse 2.4s ease-in-out infinite; transform-origin: 90px 80px; }
  .mascot-clear-ray   { animation: mascot-clear-ray   2.4s ease-in-out infinite; }
  /* Mascot character-card popover */
  .mascot-popover-backdrop { position:fixed; inset:0; z-index:9100; background:rgba(0,0,0,0.58); backdrop-filter:blur(3px); display:flex; align-items:center; justify-content:center; opacity:0; pointer-events:none; transition:opacity 0.2s; }
  .mascot-popover-backdrop.visible { opacity:1; pointer-events:all; }
  .mascot-popover { background:var(--card,#1e2330); border:1px solid var(--border,#2a3045); border-radius:22px; padding:24px 20px 22px; max-width:300px; width:90vw; display:flex; flex-direction:column; align-items:center; gap:6px; position:relative; transform:scale(0.88) translateY(16px); transition:transform 0.28s cubic-bezier(0.34,1.56,0.64,1); }
  .mascot-popover-backdrop.visible .mascot-popover { transform:scale(1) translateY(0); }
  .mascot-popover::before { content:''; position:absolute; top:0; left:0; right:0; height:3px; border-radius:22px 22px 0 0; background:var(--mascot-accent,#f5a623); }
  .mascot-popover-close { position:absolute; top:12px; right:14px; background:none; border:none; color:var(--text3,#6b7280); font-size:16px; cursor:pointer; padding:4px 6px; border-radius:6px; line-height:1; }
  .mascot-popover-close:hover { color:var(--color-text, var(--text)); background:var(--color-surface-raised, var(--bg3)); }
  .mascot-popover-name { font-family:'Rajdhani',sans-serif; font-size:26px; font-weight:700; letter-spacing:2px; text-transform:uppercase; margin-top:4px; line-height:1; }
  .mascot-popover-role { font-family:'Share Tech Mono',monospace; font-size:10px; letter-spacing:2px; text-transform:uppercase; opacity:0.5; margin-top:-2px; }
  .mascot-popover-tagline { font-size:12px; color:var(--text2,#9ca3af); text-align:center; font-style:italic; line-height:1.5; margin-top:2px; max-width:220px; }
  .mascot-popover-divider { width:100%; height:1px; background:var(--border,#2a3045); margin:10px 0 4px; }
  .mascot-popover-badge-label { font-family:'Share Tech Mono',monospace; font-size:9px; letter-spacing:3px; text-transform:uppercase; opacity:0.4; align-self:flex-start; }
  .mascot-popover-facts { width:100%; display:flex; flex-direction:column; gap:6px; margin-top:2px; }
  .mascot-popover-fact { display:flex; justify-content:space-between; align-items:baseline; gap:8px; }
  .mascot-popover-fact-label { font-family:'Share Tech Mono',monospace; font-size:10px; opacity:0.45; flex-shrink:0; }
  .mascot-popover-fact-value { font-size:12px; font-weight:600; color:var(--color-text, var(--text)); text-align:right; max-width:62%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  /* Issue card mascot badge */
  .issue-mascot-badge { width:36px; height:36px; cursor:pointer; flex-shrink:0; border-radius:10px; background:rgba(255,255,255,0.04); border:1px solid rgba(255,255,255,0.08); display:flex; align-items:center; justify-content:center; transition:background 0.15s, border-color 0.15s, transform 0.1s; overflow:hidden; padding:1px; }
  .issue-mascot-badge:hover { background:rgba(255,255,255,0.09); border-color:rgba(255,255,255,0.2); }
  .issue-mascot-badge:active { transform:scale(0.91); }
  ::-webkit-scrollbar { width: 6px; height: 6px; }
  ::-webkit-scrollbar-track { background: var(--color-bg, var(--bg)); }
  ::-webkit-scrollbar-thumb { background: var(--color-border, var(--border)); border-radius: 3px; }
  .spinner { display: inline-block; width: 13px; height: 13px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.7s linear infinite; }
  @keyframes spin { to{transform:rotate(360deg)} }

  #app { display: none; }
  #app.visible { display: block; }

  /* ── SPOTLIGHT TUTORIAL ── */
  .spotlight-overlay { position: fixed; inset: 0; z-index: 9190; pointer-events: none; }
  .spotlight-overlay.visible { pointer-events: none; }
  .spotlight-hl { position: fixed; z-index: 9195; border-radius: 14px; pointer-events: none; box-shadow: 0 0 0 9999px rgba(0,0,0,0.72); border: 2px solid rgba(255,255,255,0.18); opacity: 0; transition: top 0.38s cubic-bezier(0.4,0,0.2,1), left 0.38s cubic-bezier(0.4,0,0.2,1), width 0.38s cubic-bezier(0.4,0,0.2,1), height 0.38s cubic-bezier(0.4,0,0.2,1), opacity 0.25s; }
  .spotlight-hl.active { opacity: 1; }
  .spt-wrap { display: none; position: fixed; z-index: 9200; pointer-events: none; width: min(300px, calc(100vw - 24px)); }
  .spt-wrap.visible { display: block; }
  .spt-card { pointer-events: all; background: var(--color-surface, var(--bg2)); border: 1px solid var(--color-border, var(--border)); border-radius: 18px; padding: 0 0 14px; overflow: hidden; position: relative; }
  .spt-accent-bar { height: 3px; width: 100%; transition: background 0.3s; }
  .spt-skip-btn { position: absolute; top: 10px; right: 12px; background: none; border: none; color: var(--color-text-subtle, var(--text3)); font-size: 10px; font-family: 'Share Tech Mono', monospace; letter-spacing: 1px; text-transform: uppercase; cursor: pointer; padding: 3px 7px; border-radius: 5px; line-height: 1; z-index: 1; }
  .spt-skip-btn:hover { color: var(--color-text, var(--text)); background: var(--color-surface-raised, var(--bg3)); }
  .spt-mascot-header { display: flex; align-items: center; gap: 9px; padding: 12px 14px 6px; }
  .spt-mascot-name { font-family: 'Rajdhani', sans-serif; font-size: 13px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; line-height: 1; }
  .spt-mascot-tagline { font-family: 'Share Tech Mono', monospace; font-size: 9px; opacity: 0.5; font-style: italic; line-height: 1.4; margin-top: 2px; }
  .spt-wf-area { padding: 10px 14px 4px; }
  .spt-wf-vis { display: flex; align-items: center; }
  .spt-wf-step { display: flex; flex-direction: column; align-items: center; gap: 5px; }
  .spt-wf-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--color-border, var(--border)); border: 2px solid var(--color-border, var(--border)); }
  .spt-wf-step.wf-done .spt-wf-dot { background: var(--color-success, var(--green)); border-color: var(--color-success, var(--green)); }
  .spt-wf-step.wf-active .spt-wf-dot { background: var(--color-info, var(--blue)); border-color: var(--color-info, var(--blue)); box-shadow: 0 0 7px rgba(59,130,246,0.55); }
  .spt-wf-label { font-family: 'Share Tech Mono', monospace; font-size: 8px; letter-spacing: 1px; text-transform: uppercase; color: var(--color-text-subtle, var(--text3)); white-space: nowrap; }
  .spt-wf-step.wf-done .spt-wf-label { color: var(--color-success, var(--green)); }
  .spt-wf-step.wf-active .spt-wf-label { color: var(--color-info, var(--blue)); }
  .spt-wf-line { width: 18px; height: 2px; background: var(--color-success, var(--green)); margin-bottom: 18px; flex-shrink: 0; }
  .spt-wf-line.pending { background: var(--color-border, var(--border)); }
  .spt-content { padding: 0 14px 2px; }
  .spt-headline { font-family: 'Rajdhani', sans-serif; font-size: 17px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--color-text, var(--text)); line-height: 1.2; margin-bottom: 5px; }
  .spt-body { font-size: 12px; color: var(--color-text-muted, var(--text2)); line-height: 1.6; font-family: 'Nunito', sans-serif; }
  .spt-progress { display: flex; gap: 6px; align-items: center; padding: 10px 14px 8px; }
  .spt-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--color-border, var(--border)); transition: background 0.2s, transform 0.2s; }
  .spt-dot.active { background: var(--spt-accent, var(--color-accent, var(--accent))); transform: scale(1.4); }
  .spt-nav { display: flex; gap: 8px; padding: 0 14px; }
  .spt-back-btn { flex: 0 0 auto; }
  .spt-next-btn { flex: 1; }
  .spt-caret { position: absolute; pointer-events: none; width: 0; height: 0; }
  .spt-caret-up { border-left: 9px solid transparent; border-right: 9px solid transparent; border-bottom: 9px solid var(--color-border, var(--border)); top: -10px; }
  .spt-caret-up::after { content: ''; position: absolute; top: 2px; left: -8px; width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 8px solid var(--color-surface, var(--bg2)); }
  .spt-caret-down { border-left: 9px solid transparent; border-right: 9px solid transparent; border-top: 9px solid var(--color-border, var(--border)); bottom: -10px; }
  .spt-caret-down::after { content: ''; position: absolute; top: -11px; left: -8px; width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-top: 8px solid var(--color-surface, var(--bg2)); }

  /* STORE MODAL */
  .store-modal-overlay { padding: 16px; }
  .embedded-admin-overlay { z-index: 12000; align-items: center; justify-content: center; padding: 12px; }
  .embedded-admin-shell {
    width: min(1220px, 100%);
    height: min(94vh, 980px);
    background: var(--color-surface, var(--bg2));
    border: 1px solid var(--color-border, var(--border));
    border-radius: 14px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  }
  .embedded-admin-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid var(--color-border, var(--border));
    background: var(--color-surface, var(--bg2));
    flex-shrink: 0;
  }
  .embedded-admin-title { font-weight: 700; font-family: 'Rajdhani', sans-serif; letter-spacing: 0.06em; }
  .embedded-admin-iframe { flex: 1; width: 100%; border: 0; background: #0d1117; min-height: 0; }
  body.admin-portal-open { overflow: hidden; overscroll-behavior: none; }
  @media (max-width: 900px) {
    .embedded-admin-overlay { padding: 0; }
    .embedded-admin-shell {
      width: 100vw;
      height: 100dvh;
      max-height: none;
      border-radius: 0;
      border-left: 0;
      border-right: 0;
    }
  }
  .store-modal {
    background: var(--color-surface, var(--bg2)); border: 1px solid var(--color-border, var(--border));
    border-radius: 18px; width: 100%; max-width: 680px; max-height: 90vh;
    display: flex; flex-direction: column; overflow: hidden;
    box-shadow: 0 24px 80px rgba(0,0,0,0.55);
    opacity: 0;
    transform: translateY(18px) scale(0.985);
    transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.22s ease;
  }
  .store-modal-overlay.visible > .store-modal { opacity: 1; transform: translateY(0) scale(1); }
  .store-modal-header {
    display: flex; align-items: center; gap: 12px;
    padding: 18px 20px 16px; border-bottom: 1px solid var(--color-border, var(--border)); flex-shrink: 0;
  }
  .store-modal-title {
    display: flex; align-items: center; gap: 10px;
    font-family: 'Rajdhani', sans-serif; font-size: 20px; font-weight: 700;
    color: var(--color-text, var(--text)); letter-spacing: 0.02em; flex: 1;
  }
  .store-modal-xp {
    display: flex; align-items: center; gap: 6px;
    background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border));
    border-radius: 20px; padding: 5px 12px;
    font-size: 12px; font-weight: 700; color: var(--color-warning, var(--yellow));
    font-family: 'Share Tech Mono', monospace; white-space: nowrap; flex-shrink: 0;
  }
  .store-modal-close {
    width: 32px; height: 32px; border-radius: 8px; background: var(--color-surface-raised, var(--bg3));
    border: 1px solid var(--color-border, var(--border)); color: var(--color-text-subtle, var(--text3)); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, color 0.15s; flex-shrink: 0;
  }
  .store-modal-close:hover { background: var(--color-bg, var(--bg)); color: var(--color-text, var(--text)); }
  .store-modal-tabs {
    display: flex; gap: 4px; padding: 12px 20px 0; flex-shrink: 0;
    border-bottom: 1px solid var(--color-border, var(--border));
  }
  .store-tab {
    padding: 8px 16px; border-radius: 8px 8px 0 0; border: 1px solid transparent;
    border-bottom: none; background: transparent; color: var(--color-text-subtle, var(--text3));
    font-size: 13px; font-weight: 600; font-family: 'Nunito', sans-serif;
    cursor: pointer; transition: color 0.15s, background 0.15s; display: flex; align-items: center; gap: 6px;
  }
  .store-tab:hover { color: var(--color-text-muted, var(--text2)); }
  .store-tab.active {
    background: var(--color-surface, var(--bg2)); border-color: var(--color-border, var(--border)); color: var(--color-accent, var(--accent));
    margin-bottom: -1px; padding-bottom: 9px;
  }
  .store-tab-soon {
    font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em;
    background: var(--color-surface-raised, var(--bg3)); color: var(--color-text-subtle, var(--text3)); border-radius: 4px; padding: 1px 5px;
  }
  .store-modal-body { overflow-y: auto; flex: 1; padding: 20px; }
  .store-tab-panel { display: none; }
  .store-tab-panel.active { display: block; }
  .store-admin-tools {
    margin-top: 14px;
    border: 1px dashed var(--color-border, var(--border));
    border-radius: 10px;
    background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 82%, transparent);
    padding: 10px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }
  .store-admin-tools-copy { min-width: 0; }
  .store-admin-tools-title { font-size: 11px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--color-text-muted, var(--text2)); }
.store-admin-tools-sub { margin-top: 2px; font-size: 11px; color: var(--color-text-subtle, var(--text3)); }

/* Inline admin panel */
.admin-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.56);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
  z-index: 1200;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0s linear 0.22s;
}
.admin-overlay.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}
.admin-panel-inner {
  width: min(980px, 100%);
  max-height: 90vh;
  overflow: auto;
  background: var(--color-surface, var(--bg2));
  border: 1px solid var(--color-border, var(--border));
  border-radius: 12px;
  padding: 14px;
  opacity: 0;
  transform: translateY(16px) scale(0.985);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.22s ease;
}
.admin-overlay.visible > .admin-panel-inner { opacity: 1; transform: translateY(0) scale(1); }
.admin-panel-head,
.admin-panel-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.admin-panel-head { margin-bottom: 12px; }
.admin-panel-foot { margin-top: 12px; }
.admin-panel-title { font-size: 18px; font-weight: 800; }
.admin-panel-sub { font-size: 12px; color: var(--color-text-muted, var(--text2)); margin-top: 2px; }
.admin-status-list { display: grid; gap: 8px; }
.admin-status-row {
  border: 1px solid var(--color-border, var(--border));
  border-radius: 10px;
  background: var(--color-surface-raised, var(--bg3));
  padding: 10px;
}
.admin-row-main { display: grid; gap: 8px; }
.admin-label-input,
.admin-input,
.admin-mini-controls select {
  width: 100%;
  background: var(--color-bg, var(--bg));
  border: 1px solid var(--color-border, var(--border));
  border-radius: 8px;
  color: var(--color-text, var(--text));
  padding: 8px 10px;
}
.admin-status-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.admin-status-icon { font-size: 18px; min-width: 22px; text-align: center; }
.admin-edit-preview-pill {
  border: 1px solid var(--color-border, var(--border));
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  margin-left: auto;
}
.icon-picker, .color-picker { display: flex; flex-wrap: wrap; gap: 6px; }
.icon-opt, .color-opt {
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--color-border, var(--border));
  border-radius: 7px;
  cursor: pointer;
  background: var(--color-bg, var(--bg));
  position: relative;
}
.icon-opt.selected, .color-opt.selected { border-color: var(--color-accent, var(--accent)); }
.color-opt .check { display:none; color:#fff; font-size:11px; text-shadow:0 1px 2px rgba(0,0,0,.35); }
.color-opt.selected .check { display:block; }
.admin-section-label { font-size: 11px; color: var(--color-text-muted, var(--text2)); text-transform: uppercase; letter-spacing: .04em; }
.admin-subs-area { display: grid; gap: 8px; }
.admin-mini-label { font-size: 11px; color: var(--color-text-muted, var(--text2)); }
.admin-mini-controls { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: center; }
.admin-mini-btn, .admin-add-btn, .admin-btn {
  border: 1px solid var(--color-border, var(--border));
  background: var(--color-surface-raised, var(--bg3));
  color: var(--color-text, var(--text));
  border-radius: 8px;
  padding: 8px 10px;
  cursor: pointer;
}
.admin-btn-ghost { background: transparent; color: var(--color-text-muted, var(--text2)); }
.admin-btn-primary { background: var(--color-accent, var(--accent)); border-color: var(--color-accent, var(--accent)); color: #fff; }
.admin-actions { display:flex; gap:8px; justify-content:flex-end; }
.admin-add-wrap { margin-top: 4px; }
.admin-add-form {
  margin-top: 8px;
  border: 1px dashed var(--color-border, var(--border));
  border-radius: 10px;
  padding: 10px;
  display: grid;
  gap: 8px;
}
  .store-section-label {
    margin-bottom: 12px;
  }
  /* Theme grid */
  .store-theme-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
  }
  .store-theme-card {
    border-radius: 12px; border: 1.5px solid var(--color-border, var(--border));
    background: var(--color-surface-raised, var(--bg3)); overflow: hidden; cursor: pointer;
    transition: border-color 0.18s, box-shadow 0.18s, transform 0.15s;
    user-select: none;
  }
  .store-theme-card:hover { border-color: var(--color-text-muted, var(--text2)); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(0,0,0,0.25); }
  .store-theme-card.stc-active { border-color: var(--color-accent, var(--accent)); box-shadow: 0 0 0 2px var(--color-accent, var(--accent)), 0 6px 20px rgba(0,0,0,0.25); }
  .store-theme-card.stc-dim { opacity: 0.55; cursor: default; }
  .store-theme-card.stc-dim:hover { transform: none; box-shadow: none; }
  /* Theme card preview area */
  .stc-preview {
    height: 88px; position: relative; overflow: hidden;
    background: var(--stc-bg, #111);
  }
  .stc-preview-bg { position: absolute; inset: 0; background: var(--stc-bg, #111); }
  .stc-preview-stripe {
    position: absolute; top: 0; left: 0; right: 0; height: 3px;
    background: var(--stc-accent, #f97316);
  }
  .stc-preview-ui {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
  }
  .stc-ui-header {
    height: 22px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    box-sizing: border-box;
  }
  .stc-ui-body {
    flex: 1;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    box-sizing: border-box;
  }
  .stc-ui-card {
    padding: 6px 8px;
    border-radius: 6px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }
  .stc-ui-row {
    display: flex;
    align-items: center;
    gap: 6px;
  }
  .stc-ui-nav {
    height: 18px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    box-sizing: border-box;
  }
  .stc-ui-dot {
    border-radius: 50%;
    flex-shrink: 0;
  }
  .stc-ui-dot-sm {
    width: 6px;
    height: 6px;
  }
  .stc-ui-line-sm {
    height: 4px;
    border-radius: 2px;
  }
  .stc-active-check {
    position: absolute; top: 6px; right: 8px;
    color: var(--stc-accent, #f97316); font-size: 14px; font-weight: 900;
    text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  }
  /* Theme card footer */
  .stc-footer {
    padding: 8px 10px 9px; display: flex; flex-direction: column; align-items: stretch;
    gap: 7px; background: var(--color-surface-raised, var(--bg3));
    border-top: 1px solid var(--color-border, var(--border));
  }
  .stc-name {
    font-size: 12px; font-weight: 800; color: var(--color-text, var(--text));
    line-height: 1.2; min-width: 0; letter-spacing: 0.01em;
    text-shadow: 0 1px 0 rgba(0,0,0,0.2);
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .stc-action { flex-shrink: 0; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
  .stc-badge {
    font-size: 9px; font-weight: 800; text-transform: uppercase;
    letter-spacing: 0.04em; padding: 2px 6px; border-radius: 4px;
  }
  .stc-badge-active { background: rgba(var(--accent-rgb,249,115,22),0.15); color: var(--color-accent, var(--accent)); }
  .stc-badge-owned { background: rgba(34,197,94,0.12); color: var(--green, #22c55e); }
  .stc-badge-locked { background: var(--color-surface, var(--bg2)); color: var(--color-text-subtle, var(--text3)); }
  .stc-btn {
    font-size: 10px; font-weight: 800; padding: 3px 9px; border-radius: 6px;
    border: none; cursor: pointer; font-family: 'Share Tech Mono', monospace;
    transition: opacity 0.15s, transform 0.1s, border-color 0.15s, background 0.15s;
    white-space: nowrap; line-height: 1.2;
  }
  .stc-price-btn { background: var(--color-accent, var(--accent)); color: #000; }
  .stc-preview-btn { background: transparent; color: var(--color-text-muted, var(--text2)); border: 1px solid var(--color-border, var(--border)); }
  .stc-preview-btn:hover { color: var(--color-text, var(--text)); border-color: var(--color-text-muted, var(--text2)); background: var(--color-surface, var(--bg2)); transform: scale(1.03); }
  .stc-price-btn:hover { opacity: 0.88; transform: scale(1.04); }
  /* Coming soon panels */
  .store-coming-soon {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 60px 20px; text-align: center; gap: 10px;
  }
  .store-cs-icon { font-size: 40px; margin-bottom: 4px; }
  .store-cs-title { font-size: 15px; color: var(--color-text-muted, var(--text2)); }
  .store-cs-sub { font-size: 13px; color: var(--color-text-subtle, var(--text3)); max-width: 260px; }
  /* Purchase confirm modal */
  .store-confirm-icon { font-size: 36px; margin-bottom: 4px; }
  /* Store XP in dropdown */
  .ud-store-xp {
    font-size: 10px; font-weight: 700; color: var(--color-warning, var(--yellow));
    font-family: 'Share Tech Mono', monospace; background: var(--color-surface-raised, var(--bg3));
    border: 1px solid var(--color-border, var(--border)); border-radius: 10px; padding: 2px 7px;
    flex-shrink: 0;
  }

  /* THEME EDITOR MODAL */
  .modal.theme-editor-modal { 
    width: 580px; 
    max-width: 98vw; 
    max-height: 88vh; 
    overflow-y: auto; 
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 82%, transparent) !important;
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border: 1px solid color-mix(in srgb, var(--color-accent, var(--accent)) 12%, var(--color-border, var(--border)));
    box-shadow: 0 32px 96px rgba(0, 0, 0, 0.65), inset 0 1px 0 rgba(255,255,255,0.06);
  }
  .te-section { margin-bottom: 18px; }
  .te-section-label { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 1.5px; color: var(--color-text-subtle, var(--text3)); margin-bottom: 8px; }
  .te-search-row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
  .te-theme-search { width: 100%; background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 8px; padding: 8px 10px; color: var(--color-text, var(--text)); font-size: 12px; font-family: 'Nunito', sans-serif; outline: none; }
  .te-theme-search:focus { border-color: var(--color-accent, var(--accent)); box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-accent, var(--accent)) 55%, transparent); }
  .te-var-count { font-size: 10px; color: var(--color-text-subtle, var(--text3)); font-family: 'Share Tech Mono', monospace; white-space: nowrap; }
  .te-vars-list { display: flex; flex-direction: column; gap: 7px; max-height: 44vh; overflow-y: auto; padding-right: 4px; }
  .te-var-item { border: 1px solid var(--color-border, var(--border)); background: var(--color-surface-raised, var(--bg3)); border-radius: 9px; padding: 8px 10px; }
  .te-var-item-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 7px; }
  .te-var-name { font-family: 'Share Tech Mono', monospace; font-size: 11px; color: var(--color-text, var(--text)); font-weight: 700; }
  .te-var-hint { font-size: 10px; color: var(--color-text-subtle, var(--text3)); text-transform: uppercase; letter-spacing: 0.06em; }
  .te-var-controls { display: flex; gap: 8px; align-items: center; }
  .te-var-text { flex: 1; min-width: 0; background: var(--color-surface, var(--bg2)); border: 1px solid var(--color-border, var(--border)); border-radius: 7px; color: var(--color-text, var(--text)); font-size: 12px; padding: 6px 8px; font-family: 'Share Tech Mono', monospace; }
  .te-var-text:focus { outline: none; border-color: var(--color-accent, var(--accent)); }
  .te-var-color { width: 38px; height: 30px; border: 1px solid var(--color-border, var(--border)); border-radius: 6px; padding: 2px; background: var(--color-surface, var(--bg2)); cursor: pointer; }
  .te-var-reset { border: 1px solid var(--color-border, var(--border)); background: var(--color-surface, var(--bg2)); color: var(--color-text-muted, var(--text2)); border-radius: 6px; font-size: 11px; font-weight: 700; padding: 6px 8px; cursor: pointer; font-family: 'Nunito', sans-serif; }
  .te-var-reset:hover { border-color: var(--color-accent, var(--accent)); color: var(--color-accent, var(--accent)); }
  .te-empty-vars { border: 1px dashed var(--color-border, var(--border)); border-radius: 9px; padding: 12px; color: var(--color-text-subtle, var(--text3)); font-size: 12px; text-align: center; }
  .te-save-row { display: flex; gap: 8px; align-items: center; }
  .te-color-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
  .te-color-row { display: flex; align-items: center; gap: 8px; }
  .te-color-label { font-size: 11px; color: var(--color-text-muted, var(--text2)); flex: 1; font-weight: 600; }
  .te-color-input { width: 34px; height: 26px; border: 1px solid var(--color-border, var(--border)); border-radius: 6px; padding: 2px 3px; background: var(--color-surface-raised, var(--bg3)); cursor: pointer; flex-shrink: 0; }
  .te-color-hex { font-family: 'Share Tech Mono', monospace; font-size: 10px; color: var(--color-text-subtle, var(--text3)); width: 58px; flex-shrink: 0; }
  .te-saved-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
  .te-saved-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 8px; }
  .te-saved-name { flex: 1; font-size: 12px; font-weight: 700; color: var(--color-text, var(--text)); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .te-saved-swatches { display: flex; gap: 3px; flex-shrink: 0; }
  .te-saved-swatch { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(255,255,255,0.15); }
  .te-saved-apply { font-size: 10px; font-weight: 700; padding: 3px 9px; border-radius: 6px; background: var(--color-surface, var(--bg2)); border: 1px solid var(--color-border, var(--border)); color: var(--color-text-muted, var(--text2)); cursor: pointer; font-family: 'Nunito', sans-serif; transition: border-color 0.15s, color 0.15s; flex-shrink: 0; }
  .te-saved-apply:hover { border-color: var(--color-accent, var(--accent)); color: var(--color-accent, var(--accent)); }
.te-saved-delete { font-size: 13px; color: var(--color-text-subtle, var(--text3)); background: none; border: none; cursor: pointer; padding: 2px 4px; flex-shrink: 0; transition: color 0.15s; }
.te-saved-delete:hover { color: var(--color-danger, var(--red)); }
.te-base-select { width: 100%; background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 8px; padding: 7px 10px; color: var(--color-text, var(--text)); font-size: 12px; font-family: 'Nunito', sans-serif; outline: none; cursor: pointer; }

  /* Accordion Variables Grouping */
  .te-accordion { 
    border: 1px solid var(--color-border, var(--border)); 
    border-radius: 10px; 
    margin-bottom: 10px; 
    overflow: hidden; 
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 80%, transparent); 
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    flex-shrink: 0; 
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
  }
  .te-accordion.open {
    border-color: color-mix(in srgb, var(--color-accent, var(--accent)) 40%, var(--color-border, var(--border)));
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  }
  .te-accordion-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    padding: 11px 14px; 
    background: var(--color-surface-raised, var(--bg3)); 
    cursor: pointer; 
    user-select: none; 
    font-size: 12px; 
    font-weight: 700; 
    color: var(--color-text-muted, var(--text2)); 
    border-bottom: 1px solid transparent; 
    transition: all 0.2s ease; 
  }
  .te-accordion.open .te-accordion-header { 
    border-bottom-color: var(--color-border, var(--border)); 
    color: var(--color-text, var(--text)); 
    background: color-mix(in srgb, var(--color-accent, var(--accent)) 4%, var(--color-surface-raised, var(--bg3)));
  }
  .te-accordion-header:hover { 
    background: color-mix(in srgb, var(--color-surface, var(--bg2)) 60%, var(--color-surface-raised, var(--bg3))); 
  }
  .te-accordion-icon { 
    transition: transform 0.22s cubic-bezier(0.2, 0.8, 0.2, 1); 
    font-size: 11px; 
  }
  .te-accordion.open .te-accordion-icon { 
    transform: rotate(90deg); 
  }
  .te-accordion-content { 
    display: grid; 
    grid-template-rows: 0fr; 
    transition: grid-template-rows 0.26s cubic-bezier(0.2, 0.8, 0.2, 1); 
    background: var(--color-surface, var(--bg2)); 
  }
  .te-accordion.open .te-accordion-content { 
    grid-template-rows: 1fr; 
  }
  .te-accordion-inner {
    overflow: hidden;
    padding: 0 10px;
    display: flex;
    flex-direction: column;
    gap: 7px;
    transition: padding 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
  }
  .te-accordion.open .te-accordion-inner {
    padding: 10px;
  }

  /* Contrast Ratio Badge */
  .te-contrast-badge { 
    display: inline-flex; 
    align-items: center; 
    gap: 6px; 
    padding: 5px 10px; 
    border-radius: 8px; 
    font-size: 11px; 
    font-weight: 700; 
    font-family: 'Share Tech Mono', monospace; 
    transition: all 0.2s ease;
  }
  .te-contrast-aaa { 
    background: rgba(16, 185, 129, 0.16); 
    color: #10b981; 
    border: 1px solid rgba(16, 185, 129, 0.3); 
    box-shadow: 0 0 8px rgba(16, 185, 129, 0.15);
  }
  .te-contrast-aa { 
    background: rgba(34, 197, 94, 0.14); 
    color: var(--color-success, var(--green)); 
    border: 1px solid rgba(34, 197, 94, 0.25); 
  }
  .te-contrast-warning { 
    background: rgba(245, 158, 11, 0.14); 
    color: var(--color-warning, var(--yellow)); 
    border: 1px solid rgba(245, 158, 11, 0.25); 
  }
  .te-contrast-fail { 
    background: rgba(239, 68, 68, 0.14); 
    color: var(--color-danger, var(--red)); 
    border: 1px solid rgba(239, 68, 68, 0.25); 
  }

/* MESSAGING MODAL */
/* AP Tracker messaging shell styles moved out of index.html */
:root {
  --ios-blue: #007AFF;
  --ios-blue-dim: rgba(0,122,255,0.15);
  --bubble-sent: #007AFF;
  --bubble-recv: var(--bg3, #1e2535);
  --radius-bubble: 18px;
}
.msg-btn-wrap { position: relative; }
.msg-badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--color-danger, var(--red)); color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px;
  border-radius: 9px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--color-bg, var(--bg));
  animation: msgBadgePop 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
}
@keyframes msgBadgePop { from{transform:scale(0)} to{transform:scale(1)} }
.msg-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px 0;
  border-bottom: 1px solid var(--color-border, var(--border));
  flex-shrink: 0;
  gap: 12px;
}
.msg-header-left { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
  .msg-header-title { font-size: 15px; font-weight: 700; color: var(--color-text, var(--text)); letter-spacing: 0.3px; }
.msg-header-tabs { display: flex; gap: 0; }
.msg-tab {
  font-family: 'Nunito', sans-serif;
  font-size: 12px; font-weight: 600;
  padding: 8px 14px 10px;
  color: var(--color-text-subtle, var(--text3));
  background: none; border: none; cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}
.msg-tab.active { color: var(--color-text, var(--text)); border-bottom-color: var(--color-warning, var(--yellow)); }
.msg-tab-badge {
  background: var(--color-danger, var(--red)); color: #fff;
  font-size: 9px; font-weight: 700;
  min-width: 15px; height: 15px;
  border-radius: 8px; padding: 0 3px;
  display: inline-flex; align-items: center; justify-content: center;
  margin-left: 4px; vertical-align: middle;
}
.msg-header-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.msg-icon-btn {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border));
  color: var(--color-text-muted, var(--text2)); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s;
  font-size: 15px;
}
.msg-icon-btn:hover { background: var(--bg4); color: var(--color-text, var(--text)); }
.msg-close-btn {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border));
  color: var(--color-text-muted, var(--text2)); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; line-height: 1;
  transition: background 0.15s, color 0.15s;
}
.msg-close-btn:hover { background: rgba(248,113,113,0.2); color: var(--color-danger, var(--red)); }
.msg-body { display: flex; flex: 1; overflow: hidden; position: relative; }
.msg-list-panel {
  width: min(320px, 42%);
  position: relative;
  inset: auto;
  z-index: 2;
  transition: transform 0.25s;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  border-right: 1px solid var(--color-border, var(--border));
  background: var(--color-bg, var(--bg));
}
.msg-list-panel.hidden { transform: translateX(-100%); }
.msg-search-wrap { padding: 10px 12px 8px; flex-shrink: 0; position: relative; }
.msg-search-input {
  width: 100%;
  background: var(--color-surface-raised, var(--bg3));
  border: 1px solid var(--color-border, var(--border));
  border-radius: 10px;
  padding: 7px 12px 7px 32px;
  color: var(--color-text, var(--text));
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}
.msg-search-input:focus { border-color: var(--ios-blue); }
.msg-search-icon {
  position: absolute; left: 22px; top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-subtle, var(--text3)); pointer-events: none;
}
.msg-convos-list { flex: 1; overflow-y: auto; padding: 4px 0; }
.msg-convos-list::-webkit-scrollbar { width: 4px; }
.msg-convos-list::-webkit-scrollbar-track { background: transparent; }
.msg-convos-list::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 2px; }
.msg-convo-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; cursor: pointer;
  transition: background 0.12s;
  border-radius: 10px; margin: 1px 6px;
}
.msg-convo-row:hover { background: var(--color-surface-raised, var(--bg3)); }
.msg-convo-row.active { background: color-mix(in srgb, var(--color-warning, var(--yellow)) 15%, var(--color-surface, var(--bg2))); }
.msg-convo-row.active .msg-convo-name { color: var(--color-text, var(--text)); }
.msg-avatar-online {
  position: absolute; bottom: 1px; right: 1px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--color-success, var(--green)); border: 2px solid var(--color-bg, var(--bg));
}
.msg-convo-info { flex: 1; min-width: 0; }
.msg-convo-name-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; margin-bottom: 2px; }
.msg-convo-name { font-size: 13px; font-weight: 700; color: var(--color-text, var(--text)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-convo-time { font-size: 10px; color: var(--color-text-subtle, var(--text3)); flex-shrink: 0; }
.msg-convo-preview { font-size: 12px; color: var(--color-text-subtle, var(--text3)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-convo-preview.unread { color: var(--color-text-muted, var(--text2)); font-weight: 600; }
.msg-unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-warning, var(--yellow)); flex-shrink: 0; }
.msg-pin-icon { font-size: 10px; color: var(--color-text-subtle, var(--text3)); flex-shrink: 0; }
.msg-new-btn {
  margin: 8px 10px; padding: 9px 12px;
  background: var(--ios-blue); border: none; border-radius: 10px;
  color: #fff; font-family: 'Nunito', sans-serif;
  font-size: 13px; font-weight: 700;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: opacity 0.15s; flex-shrink: 0;
}
.msg-new-btn:hover { opacity: 0.88; }
.msg-thread-panel {
  width: 100%;
  flex: 1; display: flex; flex-direction: column;
  overflow: hidden; background: var(--color-surface, var(--bg2)); min-width: 0;
}
.msg-thread-header {
  padding: 12px 16px; border-bottom: 1px solid var(--color-border, var(--border));
  display: flex; align-items: center; gap: 10px;
  flex-shrink: 0; background: var(--color-surface, var(--bg2));
}
.msg-thread-name { font-size: 14px; color: var(--color-text, var(--text)); }
.msg-thread-sub { font-size: 11px; color: var(--color-text-subtle, var(--text3)); margin-top: 1px; }
.msg-thread-header-actions { margin-left: auto; display: flex; gap: 6px; }
.msg-messages {
  flex: 1; overflow-y: auto;
  padding: 12px 16px;
  display: flex; flex-direction: column; gap: 4px;
  scroll-behavior: smooth;
}
.msg-messages::-webkit-scrollbar { width: 4px; }
.msg-messages::-webkit-scrollbar-track { background: transparent; }
.msg-messages::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 2px; }
.msg-date-sep {
  display: flex; align-items: center; gap: 8px;
  color: var(--color-text-subtle, var(--text3)); font-size: 10px; font-weight: 600;
  letter-spacing: 0.5px; text-transform: uppercase; margin: 8px 0;
}
.msg-date-sep::before, .msg-date-sep::after { content: ''; flex: 1; height: 1px; background: var(--color-border, var(--border)); }
.msg-row { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 2px; }
.msg-row.sent { flex-direction: row-reverse; }
.msg-row.sent .msg-row-avatar { display: none; }
.msg-bubble-group { display: flex; flex-direction: column; gap: 2px; max-width: 72%; }
.msg-row.sent .msg-bubble-group { align-items: flex-end; }
.msg-sender-name { font-size: 10px; color: var(--color-text-subtle, var(--text3)); font-weight: 600; margin-bottom: 2px; padding-left: 4px; }
.msg-bubble-wrap { position: relative; display: inline-flex; flex-direction: column; }
.msg-bubble {
  padding: 9px 13px; border-radius: var(--radius-bubble);
  font-size: 14px; line-height: 1.45; word-break: break-word;
  position: relative; cursor: pointer; transition: opacity 0.12s;
}
.msg-bubble:hover { opacity: 0.92; }
.msg-bubble.recv {
  background: var(--bubble-recv); color: var(--color-text, var(--text));
  border: 1px solid var(--color-border, var(--border)); border-bottom-left-radius: 5px;
}
.msg-bubble.sent { background: var(--bubble-sent); color: #fff; border-bottom-right-radius: 5px; }
.msg-bubble-time {
  font-size: 10px; color: var(--color-text-subtle, var(--text3)); margin-top: 3px;
  display: flex; align-items: center; gap: 4px;
}
.msg-row.sent .msg-bubble-time { justify-content: flex-end; }
.msg-read-tick { font-size: 11px; }
.msg-read-tick.read { color: var(--ios-blue); }
.msg-read-tick.sent-only { color: var(--color-text-subtle, var(--text3)); }
.msg-reactions { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.msg-reaction {
  background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border));
  border-radius: 12px; padding: 2px 7px; font-size: 12px; cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  display: flex; align-items: center; gap: 3px;
}
.msg-reaction:hover { background: var(--bg4); border-color: var(--ios-blue); }
.msg-reaction.mine { background: var(--ios-blue-dim); border-color: var(--ios-blue); }
.msg-reaction-count { font-size: 10px; font-weight: 600; color: var(--color-text-muted, var(--text2)); }
.msg-reaction-picker {
  position: absolute; bottom: calc(100% + 6px);
  background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border));
  border-radius: 14px; padding: 6px 8px;
  display: flex; gap: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 10; white-space: nowrap;
  animation: msgPickerPop 0.15s cubic-bezier(0.175,0.885,0.32,1.275);
}
.msg-row.sent .msg-reaction-picker { right: 0; }
.msg-row.recv .msg-reaction-picker { left: 0; }
@keyframes msgPickerPop { from{transform:scale(0.8);opacity:0} to{transform:scale(1);opacity:1} }
.msg-reaction-emoji { font-size: 20px; cursor: pointer; padding: 2px; border-radius: 6px; transition: background 0.1s, transform 0.1s; }
.msg-reaction-emoji:hover { background: var(--bg4); transform: scale(1.2); }
.msg-typing-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0 2px; opacity: 0; transition: opacity 0.2s; height: 0; overflow: hidden;
}
.msg-typing-row.visible { opacity: 1; height: auto; }
.msg-typing-bubble {
  background: var(--bubble-recv); border: 1px solid var(--color-border, var(--border));
  border-radius: 18px; border-bottom-left-radius: 5px;
  padding: 10px 14px; display: flex; gap: 4px; align-items: center;
}
.msg-typing-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--color-text-subtle, var(--text3));
  animation: msgTypingBounce 1.2s infinite;
}
.msg-typing-dot:nth-child(2) { animation-delay: 0.2s; }
.msg-typing-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes msgTypingBounce {
  0%,60%,100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-5px); opacity: 1; }
}
.msg-typing-text { font-size: 11px; color: var(--color-text-subtle, var(--text3)); }
.msg-composer {
  border-top: 1px solid var(--color-border, var(--border)); padding: 10px 12px;
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--color-surface, var(--bg2)); flex-shrink: 0;
}
.msg-composer-input {
  flex: 1; background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border));
  border-radius: 20px; padding: 9px 14px; color: var(--color-text, var(--text));
  font-family: 'Nunito', sans-serif; font-size: 14px; outline: none;
  resize: none; max-height: 100px; overflow-y: auto; line-height: 1.4;
  transition: border-color 0.15s;
}
.msg-composer-input:focus { border-color: var(--color-warning, var(--yellow)); }
.msg-composer-input::placeholder { color: var(--color-text-subtle, var(--text3)); }
.msg-send-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--color-accent, var(--accent)); border: none; color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.15s, transform 0.1s; flex-shrink: 0;
}
.msg-send-btn:hover { opacity: 0.9; }
.msg-send-btn:active { transform: scale(0.93); }
.msg-send-btn:disabled { background: var(--bg4); cursor: default; }
.msg-emoji-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border));
  color: var(--color-text-muted, var(--text2)); cursor: pointer; font-size: 18px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s; flex-shrink: 0;
}
.msg-emoji-btn:hover { background: var(--bg4); }
.msg-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; color: var(--color-text-subtle, var(--text3)); gap: 10px;
}
.msg-empty-icon { font-size: 40px; opacity: 0.4; }
.msg-empty-text { font-size: 13px; font-weight: 500; }
.msg-sheet-overlay {
  position: fixed; inset: 0; z-index: 1100;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0s linear 0.22s;
}
.msg-sheet-overlay.visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition-delay: 0s;
}
.msg-sheet {
  background: var(--color-surface, var(--bg2)); border: 1px solid var(--color-border, var(--border));
  border-radius: 20px 20px 0 0; width: 100%; max-width: 480px;
  padding: 20px 20px 32px;
  max-height: 80vh; overflow-y: auto;
  opacity: 0;
  transform: translateY(20px);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.22s ease;
}
.msg-sheet-overlay.visible > .msg-sheet { opacity: 1; transform: translateY(0); }
.msg-sheet-handle {
  width: 64px;
  height: 7px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--color-text-subtle, var(--text3)) 58%, transparent);
  margin: 0 auto 12px;
  opacity: 0.9;
}
.msg-sheet-title { font-size: 16px; margin-bottom: 16px; }
.msg-sheet-label { margin-bottom: 6px; }
.msg-sheet-input {
  width: 100%; background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border)); border-radius: 10px;
  padding: 10px 13px; color: var(--color-text, var(--text)); font-family: 'Nunito', sans-serif; font-size: 14px;
  outline: none; margin-bottom: 14px; transition: border-color 0.15s;
}
.msg-sheet-input:focus { border-color: var(--ios-blue); }
.msg-member-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; max-height: 200px; overflow-y: auto; }
.msg-member-row {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 10px;
  cursor: pointer; transition: background 0.12s;
}
.msg-member-row:hover { background: var(--color-surface-raised, var(--bg3)); }
.msg-member-row.selected { background: var(--ios-blue-dim); }
.msg-member-check {
  margin-left: auto; width: 20px; height: 20px;
  border-radius: 50%; border: 2px solid var(--color-border, var(--border));
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; color: #fff; transition: background 0.15s, border-color 0.15s;
}
.msg-member-row.selected .msg-member-check { background: var(--ios-blue); border-color: var(--ios-blue); }
.msg-sheet-btn {
  width: 100%; padding: 13px; background: var(--ios-blue); color: #fff;
  border: none; border-radius: 12px; font-family: 'Nunito', sans-serif;
  font-size: 15px; font-weight: 700; cursor: pointer; transition: opacity 0.15s;
}
.msg-sheet-btn:hover { opacity: 0.9; }
.msg-sheet-btn:disabled { background: var(--bg4); color: var(--color-text-subtle, var(--text3)); cursor: default; }
.msg-sheet-cancel {
  width: 100%; padding: 13px; background: var(--color-surface-raised, var(--bg3)); color: var(--color-text-muted, var(--text2));
  border: 1px solid var(--color-border, var(--border)); border-radius: 12px;
  font-family: 'Nunito', sans-serif; font-size: 15px; font-weight: 600;
  cursor: pointer; margin-top: 8px; transition: background 0.15s;
}
.msg-sheet-cancel:hover { background: var(--bg4); }
.msg-toast-container {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 2000; display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.msg-toast {
  background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border));
  border-radius: 14px; padding: 10px 16px;
  display: flex; align-items: center; gap: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  animation: msgToastIn 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
  pointer-events: auto; min-width: 220px; max-width: 320px; cursor: pointer;
}
@keyframes msgToastIn { from{transform:translateY(20px);opacity:0} to{transform:translateY(0);opacity:1} }
.msg-toast-name { font-size: 12px; font-weight: 700; color: var(--color-text, var(--text)); }
.msg-toast-msg { font-size: 12px; color: var(--color-text-muted, var(--text2)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-ctx-menu {
  position: fixed; z-index: 1500;
  background: var(--color-surface-raised, var(--bg3)); border: 1px solid var(--color-border, var(--border));
  border-radius: 12px; padding: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4); min-width: 150px;
  animation: msgPickerPop 0.15s cubic-bezier(0.175,0.885,0.32,1.275);
}
.msg-ctx-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 8px;
  font-size: 13px; color: var(--color-text, var(--text)); cursor: pointer; transition: background 0.1s;
}
.msg-ctx-item:hover { background: var(--bg4); }
.msg-ctx-item.danger { color: var(--color-danger, var(--red)); }
.msg-back-btn { display: none !important; }
@media (max-width: 600px) {
  .msg-list-panel {
    width: 100%;
    position: absolute;
    inset: 0;
    border-right: none;
  }
  .msg-back-btn { display: flex !important; }
  #messaging-modal .msg-header-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    margin-top: 0;
    flex: 0 0 auto;
  }
  #messaging-modal .msg-header-tabs .msg-tab {
    padding: 7px 6px 8px;
    font-size: 10px;
    line-height: 1;
    border: 1px solid var(--color-border, var(--border));
    border-radius: 12px;
    background: var(--color-surface-raised, var(--bg3));
    text-align: center;
  }
  #messaging-modal .msg-header-tabs .msg-tab.active {
    border-color: var(--color-warning, var(--yellow));
    background: color-mix(in srgb, var(--color-warning, var(--yellow)) 10%, var(--color-surface-raised, var(--bg3)));
  }
  .store-modal-overlay { padding: 0; }
    .store-modal {
      width: 100vw;
      max-width: 100vw;
      max-height: calc(100dvh - 10px);
      border-radius: 22px 22px 0 0;
      margin-top: auto;
      padding-top: 12px;
      overflow-y: auto;
      overflow-x: hidden;
      overscroll-behavior: contain;
      -webkit-overflow-scrolling: touch;
      position: relative;
  }
  .store-modal::before {
    width: 64px;
    height: 7px;
    margin: 0 auto 12px;
  }
  .store-modal-header {
    position: sticky;
    top: 0;
    z-index: 3;
    background: linear-gradient(180deg, var(--color-surface, var(--bg2)) 82%, rgba(0,0,0,0));
    padding-top: 0;
    padding-bottom: 12px;
    margin-top: -6px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
}
[data-messages-trigger] { position: relative; }
.msg-btn-badge {
  position: absolute; top: -5px; right: -5px;
  background: var(--color-danger, var(--red)); color: #fff;
  font-size: 9px; font-weight: 700;
  min-width: 16px; height: 16px;
  border-radius: 8px; padding: 0 3px;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid var(--color-bg, var(--bg));
  animation: msgBadgePop 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
}
/* A quick-menu badge belongs in its row instead of the button's top-right corner. */
.header-quick-menu .msg-btn-badge.header-quick-item-badge {
  position: static;
  top: auto;
  right: auto;
}
.header-quick-menu .header-quick-item-title-row .header-quick-item-badge {
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  border-width: 1px;
  font-size: 10px;
  line-height: 1;
}

/* Mobile frame */
.phone {
  --notes-chip-border: color-mix(in srgb, var(--color-border, var(--border)) 70%, var(--color-accent, var(--accent)) 30%);
  --notes-chip-bg: linear-gradient(180deg, color-mix(in srgb, var(--color-surface, var(--bg2)) 82%, white 2%), color-mix(in srgb, var(--color-surface, var(--bg2)) 96%, transparent));
  --notes-chip-hover-bg: color-mix(in srgb, var(--color-surface, var(--bg2)) 80%, rgba(255,255,255,0.08) 20%);
  width: 375px;
  height: 750px;
  background: var(--color-bg, var(--bg));
  border-radius: 44px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--color-border, var(--border));
  flex-shrink: 0;
  opacity: 0;
  transform: translateY(16px) scale(0.985);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.22s ease;
}
.modal-overlay.visible > .phone {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Drag handle */
.notes-drag-handle {
  width: 36px;
  height: 5px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--color-border, var(--border)) 60%, white 40%);
  margin: 10px auto;
  cursor: grab;
  flex-shrink: 0;
  touch-action: none;
}
.notes-drag-handle:active {
  cursor: grabbing;
}
#add-modal .notes-drag-handle,
#notes-modal .notes-drag-handle,
#press-wiki-modal .notes-drag-handle,
#messaging-modal .notes-drag-handle,
#role-alerts-modal .notes-drag-handle {
  width: 56px;
  height: 8px;
  border-radius: 999px;
  margin: 12px auto 8px;
  background: color-mix(in srgb, var(--color-border, var(--border)) 68%, white 32%);
  box-shadow: 0 1px 0 rgba(255,255,255,0.05), inset 0 1px 0 rgba(255,255,255,0.18);
  touch-action: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}
#add-modal .notes-drag-handle::before,
#notes-modal .notes-drag-handle::before,
#press-wiki-modal .notes-drag-handle::before,
#messaging-modal .notes-drag-handle::before,
#role-alerts-modal .notes-drag-handle::before {
  content: '';
  display: block;
  width: 100%;
  height: 32px; /* Thicker touch target area (32px instead of 22px) for even easier grabbing */
  margin-top: -12px;
  margin-bottom: -12px;
}

/* Tool modals on desktop: use full screen real estate */
@media (min-width: 701px) {
  #press-wiki-frame.phone,
  #notes-phone-frame.phone,
  #notes-editor-frame.phone,
  #todos-frame.phone,
  #messaging-frame.phone,
  #add-modal-frame.phone,
  #role-alerts-frame.phone {
    width: min(90vw, 1000px);
    height: min(85vh, 800px);
    border-radius: 16px;
    box-shadow: 0 24px 80px rgba(0,0,0,0.6);
  }
  #press-wiki-frame .notes-drag-handle,
  #notes-phone-frame .notes-drag-handle,
  #notes-editor-frame .notes-drag-handle,
  #notes-editor-drag-handle,
  #todos-frame .notes-drag-handle,
  #messaging-frame .notes-drag-handle,
  #add-modal-frame .notes-drag-handle,
  #role-alerts-frame .notes-drag-handle {
    display: none;
  }
}

/* Sync banner (AP-Tracker style) */
.sync-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-surface-raised, var(--bg3));
  border-bottom: 1px solid var(--color-border, var(--border));
  padding: 6px 16px;
  font-size: 11px;
  color: var(--color-text-muted, var(--text2));
  font-family: 'Share Tech Mono', monospace;
}
.sync-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-success, var(--green));
  flex-shrink: 0;
}
.sync-dot.syncing { background: var(--color-warning, var(--yellow)); animation: pulse 1.2s infinite; }
@keyframes pulse { 0%,100%{opacity:1}50%{opacity:0.3} }

/* Main content */
.app-container {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 20px;
}

/* Header */
.header {
  margin-bottom: 20px;
  padding-top: 8px;
}
.tool-modal-nav-btn {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--color-border, var(--border));
  background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 88%, white 2%);
  color: var(--color-text-muted, var(--text2));
  cursor: pointer;
  z-index: 8;
  box-shadow: 0 8px 18px rgba(0,0,0,0.18);
  transition: border-color 0.15s, color 0.15s, background 0.15s, transform 0.15s, box-shadow 0.15s;
}
.tool-modal-nav-btn:hover {
  border-color: color-mix(in srgb, var(--color-accent, var(--accent)) 52%, var(--color-border, var(--border)));
  color: var(--color-text, var(--text));
  background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 80%, white 6%);
  box-shadow: 0 10px 22px rgba(0,0,0,0.22);
  transform: translateY(-1px);
}
.tool-modal-nav-btn:active {
  transform: scale(0.96);
}
.tool-modal-nav-btn svg {
  display: block;
  flex-shrink: 0;
}
.greeting {
  font-family: 'Rajdhani', sans-serif;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 1px;
  background: linear-gradient(135deg, var(--color-accent, var(--accent)) 0%, var(--color-accent-strong, var(--accent2)) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.subtitle {
  font-size: 12px;
  color: var(--color-text-muted, var(--text2));
  margin-top: 4px;
  font-family: 'Share Tech Mono', monospace;
}

/* Search bar (AP-Tracker style) */
.search-wrap {
  position: relative;
  margin-bottom: 16px;
}
.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-subtle, var(--text3));
  font-size: 14px;
  pointer-events: none;
}
.search-box {
  width: 100%;
  background: var(--color-surface-raised, var(--bg3));
  border: 1px solid var(--color-border, var(--border));
  border-radius: 10px;
  padding: 11px 12px 11px 36px;
  color: var(--color-text, var(--text));
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
.search-box:focus {
  border-color: var(--color-accent, var(--accent));
}

@media (hover: none) and (pointer: coarse) {
  input:not([type="checkbox"]):not([type="radio"]):not([type="range"]):not([type="color"]),
  select,
  textarea,
  [contenteditable="true"] {
    font-size: 16px !important;
  }
}

/* Filter pills (AP-Tracker stat-pill style) */
.filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.filter-pill {
  background: var(--color-surface-raised, var(--bg3));
  border: 1px solid var(--color-border, var(--border));
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 11px;
  font-family: 'Share Tech Mono', monospace;
  font-weight: 600;
  color: var(--color-text-muted, var(--text2));
  cursor: pointer;
  transition: all 0.15s;
}
.filter-pill.active {
  background: var(--color-accent, var(--accent));
  color: white;
  border-color: var(--color-accent, var(--accent));
}
.filter-pill:hover {
  border-color: var(--color-text-muted, var(--text2));
  color: var(--color-text, var(--text));
}

/* Note card (AP-Tracker issue-card style) */
.note-card {
  background: var(--color-surface, var(--bg2));
  border: 1px solid var(--color-border, var(--border));
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: all 0.2s;
  animation: fadeSlideUp 0.3s ease;
}
.note-card:active {
  transform: scale(0.98);
  border-color: var(--color-accent, var(--accent));
}
@keyframes fadeSlideUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.note-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--color-text, var(--text));
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.note-preview {
  font-size: 13px;
  color: var(--color-text-muted, var(--text2));
  line-height: 1.4;
  margin-bottom: 10px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
}
.note-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.tag {
  font-size: 9px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--focus-ring, var(--accent-glow));
  color: var(--color-accent, var(--accent));
  font-family: 'Share Tech Mono', monospace;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.timestamp {
  font-size: 10px;
  color: var(--color-text-subtle, var(--text3));
  font-family: 'Share Tech Mono', monospace;
}
.pin-icon {
  color: var(--color-warning, var(--yellow));
  font-size: 14px;
}

/* Empty state (AP-Tracker style) */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-subtle, var(--text3));
}
.empty-state-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.5;
}
.empty-state-text {
  font-size: 13px;
}

/* FAB (AP-Tracker style) */
.fab {
  position: absolute;
  bottom: 20px;
  right: 16px;
  width: 56px;
  height: 56px;
  background: var(--color-accent, var(--accent));
  border-radius: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 28px;
  font-weight: 500;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(249,115,22,0.3);
  cursor: pointer;
  transition: all 0.2s ease;
  z-index: 10;
}
.fab:active {
  transform: scale(0.92);
}

/* Unified workspace shell for AP Tracker tools */
#press-wiki-modal,
#notes-modal,
#todos-modal,
#messaging-modal,
#role-alerts-modal,
#add-modal {
  --tool-accent: var(--color-accent, var(--accent));
  --tool-accent-soft: color-mix(in srgb, var(--tool-accent) 14%, var(--color-surface, var(--bg2)));
  --tool-panel-bg: color-mix(in srgb, var(--color-bg, var(--bg)) 92%, var(--color-surface, var(--bg2)) 8%);
  --tool-list-bg: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 86%, var(--color-bg, var(--bg)) 14%);
  --tool-control-bg: color-mix(in srgb, var(--color-surface, var(--bg2)) 86%, transparent);
}
#press-wiki-modal { --tool-accent: var(--color-teal, var(--teal)); }
#notes-modal { --tool-accent: var(--color-accent, var(--accent)); }
#todos-modal { --tool-accent: var(--color-success, var(--green)); }
#messaging-modal { --tool-accent: var(--color-info, var(--blue)); }
#role-alerts-modal { --tool-accent: var(--color-danger, var(--red)); }
#add-modal { --tool-accent: var(--color-accent, var(--accent)); }

@media (min-width: 701px) {
  #press-wiki-frame.phone,
  #notes-phone-frame.phone,
  #todos-frame.phone,
  #messaging-frame.phone,
  #add-modal-frame.phone,
  #role-alerts-frame.phone {
    width: min(94vw, 1180px);
    height: min(88vh, 860px);
    border-radius: 12px;
    background: var(--tool-panel-bg);
    border-color: color-mix(in srgb, var(--color-border, var(--border)) 82%, var(--tool-accent) 18%);
    box-shadow: 0 24px 72px rgba(0,0,0,0.58);
  }
}

#press-wiki-app-container,
#notes-app-container,
#todos-app-container,
#messaging-app-container,
#role-alerts-app-container,
#add-modal-app-container {
  background: var(--tool-panel-bg) !important;
}

#press-wiki-modal .tool-modal-nav-shell,
#notes-modal .tool-modal-nav-shell,
#todos-modal .tool-modal-nav-shell,
#messaging-modal .tool-modal-nav-shell,
#role-alerts-modal .tool-modal-nav-shell,
#add-modal .tool-modal-nav-shell {
  min-height: 44px;
  margin-bottom: 0;
  padding: 9px 14px;
  background: color-mix(in srgb, var(--color-surface, var(--bg2)) 86%, var(--color-bg, var(--bg)) 14%);
  border-bottom-color: color-mix(in srgb, var(--color-border, var(--border)) 86%, var(--tool-accent) 14%);
}

#press-wiki-modal .tool-modal-nav-title,
#notes-modal .tool-modal-nav-title,
#todos-modal .tool-modal-nav-title,
#messaging-modal .tool-modal-nav-title,
#role-alerts-modal .tool-modal-nav-title,
#add-modal .tool-modal-nav-title {
  color: var(--color-text, var(--text));
  letter-spacing: 0.12em;
}

#press-wiki-modal .tool-modal-nav-btn:hover,
#notes-modal .tool-modal-nav-btn:hover,
#todos-modal .tool-modal-nav-btn:hover,
#messaging-modal .tool-modal-nav-btn:hover,
#role-alerts-modal .tool-modal-nav-btn:hover,
#add-modal .tool-modal-nav-btn:hover {
  border-color: color-mix(in srgb, var(--tool-accent) 52%, var(--color-border, var(--border)));
}

.tool-modal-control-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px;
  padding: 10px 12px !important;
  border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 82%, var(--tool-accent) 18%);
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 84%, var(--tool-accent-soft) 16%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06);
  flex-shrink: 0;
}

.tool-modal-control-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.tool-modal-kicker {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
  line-height: 1.2;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--tool-accent) 72%, var(--color-text, var(--text)) 28%);
}

.tool-modal-subtitle {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.28;
  color: var(--color-text-muted, var(--text2));
}

.tool-modal-scroll-body {
  min-height: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.tool-modal-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-top: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 84%, var(--tool-accent) 16%);
  background: color-mix(in srgb, var(--color-surface, var(--bg2)) 88%, var(--color-bg, var(--bg)) 12%);
  box-shadow: 0 -10px 24px rgba(0,0,0,0.12);
  flex-shrink: 0;
}

.tool-modal-footer-status {
  min-width: 0;
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--color-text-subtle, var(--text3));
}

.tool-create-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.tool-create-copy {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.tool-create-kicker {
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--color-text-subtle, var(--text3));
}

.tool-create-subtitle {
  font-size: 12px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-text-muted, var(--text2));
}

.tool-create-action {
  width: 44px !important;
  min-width: 44px !important;
  height: 44px !important;
  min-height: 44px !important;
  display: inline-grid !important;
  place-items: center;
  padding: 0 !important;
  border-radius: 999px !important;
  border: 1px solid color-mix(in srgb, var(--color-orange, var(--orange, #f97316)) 62%, rgba(255,255,255,0.18)) !important;
  background: linear-gradient(180deg, color-mix(in srgb, var(--color-orange, var(--orange, #f97316)) 92%, white 8%), color-mix(in srgb, var(--color-orange, var(--orange, #f97316)) 82%, black 18%)) !important;
  box-shadow: 0 10px 24px rgba(249,115,22,0.34), inset 0 1px 0 rgba(255,255,255,0.28) !important;
  color: white !important;
  font-family: 'Rajdhani', sans-serif !important;
  font-size: 26px !important;
  font-weight: 800 !important;
  line-height: 1 !important;
  text-align: center;
  flex: 0 0 44px;
}

.tool-create-action:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.tool-create-action:active {
  transform: translateY(0) scale(0.96);
}

.tool-create-action:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--color-orange, var(--orange, #f97316)) 76%, white 24%);
  outline-offset: 3px;
}

.tool-create-panel {
  flex-shrink: 0;
}

#todos-modal .note-card,
#role-alerts-modal .role-alert-card,
#press-wiki-modal .press-wiki-card {
  border-radius: 8px;
  background: color-mix(in srgb, var(--color-surface, var(--bg2)) 84%, transparent);
  border-color: color-mix(in srgb, var(--color-border, var(--border)) 88%, transparent);
  box-shadow: none;
}

#todos-modal .note-card:hover,
#role-alerts-modal .role-alert-card:hover,
#press-wiki-modal .press-wiki-card:hover {
  border-color: color-mix(in srgb, var(--tool-accent) 45%, var(--color-border, var(--border)));
}

#todos-modal .filter-pill.active,
#role-alerts-modal .scope-btn.active,
#messaging-modal .msg-tab.active {
  border-color: color-mix(in srgb, var(--tool-accent) 58%, var(--color-border, var(--border)));
  background: color-mix(in srgb, var(--tool-accent) 18%, var(--color-surface, var(--bg2)) 82%);
  color: var(--color-text, var(--text));
}

#role-alerts-modal .role-alerts-toolbar {
  align-items: center;
}

#role-alerts-modal .role-alerts-toggle {
  width: auto;
  max-width: 100%;
  padding: 3px;
  gap: 3px;
  border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 82%, var(--tool-accent) 18%);
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-surface, var(--bg2)) 80%, transparent);
  overflow: visible;
}

#role-alerts-modal .role-alerts-toggle .scope-btn {
  min-height: 32px;
  border: 0;
  border-radius: 7px;
  padding: 0 11px;
  color: var(--color-text-muted, var(--text2));
  background: transparent;
}

#role-alerts-modal .role-alerts-toggle .scope-btn.active {
  background: color-mix(in srgb, var(--tool-accent) 72%, var(--color-surface, var(--bg2)) 28%);
  color: white;
}

#role-alerts-modal .role-alerts-list {
  padding: 0 12px 12px !important;
  gap: 10px;
  background: transparent;
}

#role-alerts-modal .role-alert-section-header {
  padding: 0 2px;
}

#role-alerts-modal .role-alert-section-count {
  border-color: color-mix(in srgb, var(--tool-accent) 28%, var(--color-border, var(--border)));
}

#role-alerts-modal .role-alert-card {
  border-left: 3px solid var(--role-alert-cat-color, var(--tool-accent));
  border-radius: 8px;
  background: color-mix(in srgb, var(--color-surface, var(--bg2)) 88%, var(--color-bg, var(--bg)) 12%);
}

#role-alerts-modal .role-alert-card-body {
  padding: 12px 12px 9px;
}

#role-alerts-modal .role-alert-card-time {
  font-size: 11.5px;
}

#role-alerts-modal .role-alert-card-actions {
  padding: 0 12px 12px;
}

#role-alerts-modal .role-alert-action-btn {
  min-height: 36px;
  border-radius: 8px;
}

#role-alerts-modal .role-alert-empty {
  margin: 0;
  border-radius: 8px;
  background: color-mix(in srgb, var(--color-surface, var(--bg2)) 86%, var(--color-bg, var(--bg)) 14%);
}

#role-alerts-modal .role-alert-empty-icon {
  background: color-mix(in srgb, var(--tool-accent) 14%, transparent);
  border-color: color-mix(in srgb, var(--tool-accent) 30%, transparent);
}

#role-alerts-modal .role-alerts-close-fab {
  display: none;
}

#todos-modal .filter-row,
#notes-modal .filter-row,
#messaging-modal .msg-header-tabs {
  border-color: color-mix(in srgb, var(--color-border, var(--border)) 86%, var(--tool-accent) 14%);
}

@media (max-width: 700px) {
  .tool-modal-control-row {
    align-items: stretch;
    flex-direction: column;
    margin: 10px;
    gap: 9px;
  }

  .tool-modal-footer {
    padding: 9px 10px;
  }

  .tool-modal-footer-status {
    font-size: 9px;
  }

  #role-alerts-modal .role-alerts-toggle {
    width: 100%;
  }

  #role-alerts-modal .role-alerts-toggle .scope-btn {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 8px;
  }

  #role-alerts-modal .role-alerts-list {
    padding: 0 10px 10px !important;
  }

  #role-alerts-modal .role-alert-card-top {
    flex-wrap: wrap;
  }

  #role-alerts-modal .role-alert-card-chip-state {
    margin-left: 0;
  }

  #add-modal-frame,
  #press-wiki-frame,
  #notes-phone-frame,
  #todos-frame,
  #messaging-frame,
  #role-alerts-frame {
    touch-action: pan-y;
  }

  body.tool-modal-horizontal-swipe {
    overscroll-behavior: none;
  }
}

/* TODOS TOOL */
#todos-modal .app-container {
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.notes-create-row {
  margin: 10px 12px 8px;
  padding: 9px 10px 9px 12px;
  border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 82%, var(--tool-accent) 18%);
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 84%, var(--tool-accent-soft) 16%);
}
.todo-create-row {
  margin: 10px 12px 8px;
  padding: 9px 10px 9px 12px;
  border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 82%, var(--tool-accent) 18%);
  border-radius: 10px;
  background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 84%, var(--tool-accent-soft) 16%);
}
.todo-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 0 12px 10px;
}
.todo-compose:not(.open) {
  display: none;
}
.todo-compose .input {
  margin: 0;
}
#todos-modal .search-wrap,
#todos-modal .todo-filter-row {
  margin-left: 12px;
  margin-right: 12px;
}
#todos-modal .search-wrap {
  flex: 0 0 auto;
  min-width: 0;
  margin-bottom: 14px;
}
#todos-modal .todo-search-icon {
  display: block;
  top: 50%;
}
#todos-modal .todo-filter-row {
  margin-bottom: 8px;
}
.todos-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px 12px 88px;
}
.todo-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 10px;
}
.todo-item.active {
  border-color: color-mix(in srgb, var(--color-accent, var(--accent)) 60%, var(--color-border, var(--border)));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-accent, var(--accent)) 25%, transparent);
}
.todo-item.completed {
  opacity: 0.68;
}
.todo-item.completed .note-title span,
.todo-item.completed .note-preview {
  text-decoration: line-through;
}
.todo-check {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid var(--color-border, var(--border));
  background: var(--color-surface-raised, var(--bg3));
  color: var(--color-success, var(--green));
  font-family: 'Nunito', sans-serif;
  font-size: 16px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}
.todo-item-main {
  min-width: 0;
  cursor: pointer;
}
.notes-list-badge.priority-high {
  border-color: color-mix(in srgb, var(--color-danger, var(--red)) 52%, var(--color-border, var(--border)));
  color: var(--color-danger, var(--red));
}
.notes-list-badge.priority-medium {
  border-color: color-mix(in srgb, var(--color-warning, var(--yellow)) 52%, var(--color-border, var(--border)));
  color: var(--color-warning, var(--yellow));
}
.notes-list-badge.priority-low {
  border-color: color-mix(in srgb, var(--color-teal, var(--teal)) 52%, var(--color-border, var(--border)));
  color: var(--color-teal, var(--teal));
}
.notes-list-badge.overdue {
  border-color: color-mix(in srgb, var(--color-danger, var(--red)) 52%, var(--color-border, var(--border)));
  color: var(--color-danger, var(--red));
}
.todo-viewer {
  margin: 8px 12px 10px;
  flex-shrink: 0;
  max-height: 46vh;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  border-left: 3px solid var(--tool-accent, var(--color-success, var(--green)));
}
.todo-viewer-title-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}
.todo-viewer-check {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--tool-accent, var(--color-success, var(--green))) 45%, var(--color-border, var(--border)));
  background: color-mix(in srgb, var(--tool-accent, var(--color-success, var(--green))) 12%, var(--color-surface, var(--bg2)));
  color: var(--tool-accent, var(--color-success, var(--green)));
  font-weight: 900;
}
.todo-viewer-title {
  min-width: 0;
  font-family: 'Nunito', sans-serif;
  font-size: 18px;
  font-weight: 850;
  line-height: 1.2;
  color: var(--color-text, var(--text));
  overflow-wrap: anywhere;
}
.todo-viewer-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.todo-viewer-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--color-border, var(--border));
  background: color-mix(in srgb, var(--color-surface, var(--bg2)) 76%, transparent);
  color: var(--color-text-muted, var(--text2));
  font-family: 'Share Tech Mono', monospace;
  font-size: 9px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.todo-viewer-notes {
  padding: 10px 11px;
  border-radius: 8px;
  border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 80%, transparent);
  background: color-mix(in srgb, var(--color-bg, var(--bg)) 42%, transparent);
  color: var(--color-text-muted, var(--text2));
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.todo-viewer-empty {
  color: var(--color-text-subtle, var(--text3));
  font-style: italic;
}
.todo-viewer-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}
.todo-editor {
  margin: 8px 12px 10px;
  flex-shrink: 0;
  max-height: 54vh;
  overflow: auto;
}
.todo-editor label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 8px;
  color: var(--color-text-muted, var(--text2));
  font-family: 'Share Tech Mono', monospace;
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.todo-editor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.todo-link-box {
  margin: 10px 0;
}
.todo-editor-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 10px;
}

@media (max-width: 700px) {
  .todo-viewer,
  .todo-editor {
    max-height: none;
    margin: 8px 10px 10px;
  }

  .todo-viewer-actions,
  .todo-editor-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .todo-viewer-actions .btn,
  .todo-editor-actions .btn {
    min-width: 0;
  }
}

/* Editor Modal (AP-Tracker modal style) */
#editorModal.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(4px);
  z-index: 1000;
  align-items: flex-end;
  justify-content: center;
}
#editorModal .modal {
  background: var(--color-surface, var(--bg2));
  border: 1px solid var(--color-border, var(--border));
  border-radius: 22px 22px 0 0;
  width: 100%;
  max-width: 375px; /* match phone width */
  max-height: 90vh;
  overflow-y: auto;
  padding: 20px 18px 30px;
  opacity: 0;
  transform: translateY(18px) scale(0.985);
  transition: transform 0.24s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.22s ease;
}
#editorModal.modal-overlay.visible > .modal { opacity: 1; transform: translateY(0) scale(1); }
#editorModal .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-border, var(--border));
}
#editorModal .modal-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--color-text, var(--text));
}
#editorModal .modal-close {
  background: var(--color-surface-raised, var(--bg3));
  border: 1px solid var(--color-border, var(--border));
  border-radius: 30px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--color-text-muted, var(--text2));
  font-size: 18px;
  transition: all 0.15s;
}
#editorModal .modal-close:active {
  transform: scale(0.94);
}
#editorModal label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-muted, var(--text2));
  margin-bottom: 6px;
  font-family: 'Share Tech Mono', monospace;
}
#editorModal input, #editorModal textarea {
  width: 100%;
  background: var(--color-surface-raised, var(--bg3));
  border: 1px solid var(--color-border, var(--border));
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--color-text, var(--text));
  font-family: 'Nunito', sans-serif;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  margin-bottom: 16px;
}
#editorModal input:focus, #editorModal textarea:focus {
  border-color: var(--color-accent, var(--accent));
}
#editorModal textarea {
  resize: vertical;
  min-height: 100px;
}
#editorModal .modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 8px;
}
#editorModal .btn {
  font-family: 'Rajdhani', sans-serif;
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.5px;
  padding: 10px 18px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
}
#editorModal .btn-primary {
  background: var(--color-accent, var(--accent));
  color: white;
}
#editorModal .btn-primary:active {
  transform: scale(0.96);
  background: var(--color-accent-strong, var(--accent2));
}
#editorModal .btn-ghost {
  background: transparent;
  border: 1px solid var(--color-border, var(--border));
  color: var(--color-text-muted, var(--text2));
}
#editorModal .btn-ghost:active {
  border-color: var(--color-text-muted, var(--text2));
  color: var(--color-text, var(--text));
}

/* Tag input helper */
.tag-hint {
  font-size: 10px;
  color: var(--color-text-subtle, var(--text3));
  margin-top: -12px;
  margin-bottom: 12px;
  font-family: 'Share Tech Mono', monospace;
}

/* Toolbar (editor) */
.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.tool-btn {
  background: var(--color-surface-raised, var(--bg3));
  border: 1px solid var(--color-border, var(--border));
  border-radius: 10px;
  padding: 8px 14px;
  cursor: pointer;
  color: var(--color-text-muted, var(--text2));
  font-family: 'Nunito', sans-serif;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.15s;
}
.tool-btn:active {
  transform: scale(0.94);
  border-color: var(--color-accent, var(--accent));
  color: var(--color-accent, var(--accent));
}

/* Checklist styles */
.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-surface-raised, var(--bg3));
  border: 1px solid var(--color-border, var(--border));
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.checklist-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--color-accent, var(--accent));
}
.checklist-item span {
  flex: 1;
  font-size: 13px;
  color: var(--color-text, var(--text));
}
.checklist-item.done span {
  text-decoration: line-through;
  color: var(--color-text-subtle, var(--text3));
}
.delete-checklist {
  background: none;
  border: none;
  color: var(--color-text-subtle, var(--text3));
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
}

/* Checklist add row */
.add-checklist-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.add-checklist-row input {
  flex: 1;
  margin: 0;
}
.add-checklist-row button {
  white-space: nowrap;
  padding: 10px 16px;
}

/* Checklist section header */
.checklist-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0 10px;
}
.checklist-header label {
  margin: 0;
}

/* Toast notification */
.game-toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-surface, var(--bg2));
  border: 1px solid var(--color-accent, var(--accent));
  border-radius: 12px;
  padding: 10px 18px;
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text, var(--text));
  box-shadow: 0 10px 32px rgba(0,0,0,0.35);
  opacity: 0;
  pointer-events: none;
  transition: all 0.22s;
  white-space: nowrap;
  z-index: 1100;
  font-family: 'Nunito', sans-serif;
}
.game-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── THEME APPEARANCE STUDIO DUAL-PANE LAYOUT ── */
@media (min-width: 900px) {
  .theme-editor-modal:has(.te-preview-col) {
    width: 960px !important;
    max-width: 95vw !important;
    max-height: 90vh !important;
    display: grid !important;
    grid-template-columns: 320px 1fr !important;
    gap: 24px !important;
    padding: 24px !important;
    height: min(720px, 90vh) !important;
    overflow: hidden !important; /* grid container must NOT scroll */
  }
  /* Neutralise the base .modal scroll — the editor manages its own */
  .modal.theme-editor-modal:has(.te-preview-col) {
    overflow: hidden !important;
  }
  .te-preview-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    border-right: 1px solid var(--color-border, var(--border));
    padding-right: 20px;
    height: 100%;
    overflow: hidden; /* phone casing clips here */
    justify-content: space-between;
  }
  .te-control-col {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-width: 0;
    overflow: hidden; /* column clips; only .te-tab-panels scrolls */
  }
  /* Title row pinned — never shrink */
  .te-control-col > .modal-title {
    flex-shrink: 0;
  }
  /* Tabs row pinned — never shrink */
  .te-control-col > .te-tabs {
    flex-shrink: 0;
  }
  /* Scrollable panels area */
  .te-tab-panels {
    flex: 1 1 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    touch-action: pan-y;
    padding-right: 8px;
    margin-top: 14px;
    min-height: 0; /* critical: allows flex child to shrink below content size */
  }
  /* Footer / close button pinned at bottom — never shrink */
  .te-control-col > .modal-actions {
    flex-shrink: 0;
    margin-top: 0;
    padding-top: 12px;
    border-top: 1px solid var(--color-border, var(--border));
  }
}

@media (min-width: 900px) and (max-height: 780px) {
  .te-phone-casing {
    transform: scale(0.85);
    transform-origin: top center;
    margin-bottom: -60px;
  }
}
@media (min-width: 900px) and (max-height: 680px) {
  .te-phone-casing {
    transform: scale(0.72);
    transform-origin: top center;
    margin-bottom: -120px;
  }
}
@media (min-width: 900px) and (max-height: 600px) {
  .te-phone-casing {
    transform: scale(0.6);
    transform-origin: top center;
    margin-bottom: -180px;
  }
}

@media (max-width: 899px) {
  .te-preview-col {
    display: none !important; /* Hide phone preview on smaller screens */
  }
  .te-control-col {
    display: flex;
    flex-direction: column;
    width: 100%;
  }
}

/* Phone Simulator Casing */
.te-phone-casing {
  position: relative;
  width: 280px;
  height: 560px;
  border-radius: 36px;
  background: #090b0e;
  padding: 8px;
  border: 4px solid #2d3139;
  box-shadow: 0 16px 40px rgba(0,0,0,0.6), inset 0 0 8px rgba(255,255,255,0.05);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.te-phone-island {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 14px;
  background: black;
  border-radius: 999px;
  z-index: 100;
}
.te-phone-home-indicator {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 90px;
  height: 4px;
  background: #475569;
  border-radius: 999px;
  z-index: 100;
}
.te-phone-screen {
  flex: 1;
  width: 100%;
  height: 100%;
  background: var(--bg);
  border-radius: 28px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  font-family: var(--font-body, 'Nunito', sans-serif);
  color: var(--text);
  box-shadow: inset 0 0 20px rgba(0,0,0,0.8);
  isolation: isolate;
}
.te-phone-screen::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: var(--bg-svg-image, var(--theme-bg-pattern, none));
  background-size: var(--bg-svg-size, var(--theme-bg-pattern-size, auto));
  background-repeat: repeat;
  opacity: var(--theme-bg-pattern-opacity, 1);
  z-index: -1;
}

/* Simulated UI Elements */
.te-phone-status-bar {
  height: 28px;
  padding: 8px 16px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  font-weight: 600;
  font-family: 'Share Tech Mono', monospace;
  opacity: 0.8;
  z-index: 10;
}
.te-phone-status-icons {
  display: flex;
  gap: 3px;
}
.te-phone-app-header {
  padding: 8px 12px 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
  z-index: 10;
  background: var(--bg);
}
.te-phone-kicker {
  font-size: 8px;
  font-family: 'Share Tech Mono', monospace;
  color: var(--text2);
  text-transform: uppercase;
}
.te-phone-title {
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-headings, 'Rajdhani', sans-serif);
  color: var(--text);
}
.te-phone-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
}

.te-phone-screen-content {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}
.te-phone-screen-content::-webkit-scrollbar {
  width: 0px;
}

/* Preview Card Style */
.te-phone-card {
  padding: 10px;
  border-radius: var(--radius-card, 14px);
  background: var(--glass-bg, var(--bg2));
  backdrop-filter: blur(var(--glass-blur, 0px));
  -webkit-backdrop-filter: blur(var(--glass-blur, 0px));
  border: 1px solid var(--glass-border, var(--border));
  box-shadow: var(--shadow-card, 0 2px 12px rgba(0,0,0,0.2));
  transition: all 0.2s;
}
.te-phone-card-title {
  font-size: 10px;
  font-family: 'Share Tech Mono', monospace;
  color: var(--text2);
  margin-bottom: 6px;
  text-transform: uppercase;
}

/* Simulated Mascot XP Widget */
.te-phone-xp-header {
  display: flex;
  align-items: center;
  gap: 6px;
}
.te-phone-mascot-emoji {
  font-size: 18px;
}
.te-phone-mascot-name {
  font-size: 10px;
  font-weight: 700;
  font-family: var(--font-headings, 'Rajdhani', sans-serif);
}
.te-phone-xp-bar-wrap {
  height: 5px;
  border-radius: 99px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
  margin: 2px 0;
}
.te-phone-xp-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2, var(--accent)));
  border-radius: 99px;
}
.te-phone-xp-label {
  font-size: 8px;
  font-family: 'Share Tech Mono', monospace;
  color: var(--text2);
}
.te-phone-streak {
  font-size: 8px;
  font-family: 'Share Tech Mono', monospace;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 15%, transparent);
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 700;
}

/* Simulated Press Deck grid */
.te-phone-press-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.te-phone-press-btn {
  padding: 6px 2px;
  border-radius: var(--radius-btn, 8px);
  font-size: 9px;
  font-weight: 700;
  text-align: center;
  font-family: var(--font-headings, 'Rajdhani', sans-serif);
}
.te-phone-press-btn.te-success {
  background: var(--green-dim, rgba(34,197,94,0.15));
  color: var(--green, #22c55e);
  border: 1px solid color-mix(in srgb, var(--green) 30%, transparent);
}
.te-phone-press-btn.te-danger {
  background: var(--red-dim, rgba(239,68,68,0.12));
  color: var(--red, #ef4444);
  border: 1px solid color-mix(in srgb, var(--red) 30%, transparent);
}
.te-phone-press-btn.te-info {
  background: var(--blue-dim, rgba(59,130,246,0.12));
  color: var(--blue, #3b82f6);
  border: 1px solid color-mix(in srgb, var(--blue) 30%, transparent);
}

/* Simulated Issue Card */
.te-phone-issue-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 5px;
}
.te-phone-issue-route {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 7px;
  line-height: 1.2;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.te-phone-issue-category {
  color: var(--text);
  font-weight: 700;
}
.te-phone-issue-subcategory {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.te-phone-issue-route-sep {
  color: var(--text3);
}
.te-phone-issue-time {
  flex-shrink: 0;
  font-size: 7px;
  line-height: 1.2;
  color: var(--text2);
  font-weight: 700;
}
.te-phone-issue-title {
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
}
.te-phone-issue-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 3px;
  min-width: 0;
  font-size: 8px;
  color: var(--text2);
}
.te-phone-issue-status {
  color: var(--yellow, #eab308);
  font-weight: 700;
}
.te-phone-issue-meta-dot {
  color: var(--text3);
}
.te-phone-issue-reporter {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.te-phone-issue-attachment {
  margin-top: 6px;
  border: 1px dashed var(--border);
  border-radius: 6px;
  background: rgba(0,0,0,0.1);
  padding: 8px;
  text-align: center;
}
.te-phone-attachment-placeholder {
  font-size: 8px;
  color: var(--text2);
  font-family: 'Share Tech Mono', monospace;
}

/* Bottom Nav Bar mockup */
.te-phone-bottom-nav {
  height: 44px;
  border-top: 1px solid var(--border);
  background: var(--glass-bg, var(--bg2));
  backdrop-filter: blur(var(--glass-blur, 0px));
  -webkit-backdrop-filter: blur(var(--glass-blur, 0px));
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 2px 8px;
  z-index: 10;
  transition: all 0.2s;
}
.te-phone-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  opacity: 0.5;
  cursor: pointer;
}
.te-phone-nav-item.active {
  opacity: 1;
  color: var(--accent);
}
.te-phone-nav-item span:first-child {
  font-size: 12px;
}
.te-phone-nav-item span:last-child {
  font-size: 7px;
  font-weight: 700;
}
.te-preview-info {
  margin-top: 6px;
  font-size: 10px;
  font-family: 'Share Tech Mono', monospace;
  color: var(--color-text-subtle, var(--text3));
  text-align: center;
}

/* Nav styles configurations */
.te-phone-screen.nav-top .te-phone-bottom-nav { display: none !important; }
.te-phone-screen.nav-floating .te-phone-bottom-nav {
  position: absolute;
  bottom: 12px;
  left: 10px;
  right: 10px;
  border-radius: 12px;
  border: 1px solid var(--glass-border, var(--border));
  height: 40px;
  box-shadow: 0 6px 16px rgba(0,0,0,0.3);
}

/* Tabs & Customizer styling */
.te-tabs {
  display: flex;
  border-bottom: 1px solid var(--color-border, var(--border));
  margin-bottom: 12px;
}
.te-tab {
  flex: 1;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--color-text-subtle, var(--text3));
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'Nunito', sans-serif;
  text-align: center;
}
.te-tab:hover {
  color: var(--color-text-muted, var(--text2));
}
.te-tab.active {
  color: var(--color-accent, var(--accent));
  border-bottom-color: var(--color-accent, var(--accent));
}

.te-tab-panel {
  display: none;
}
.te-tab-panel.active {
  display: block;
}

.te-panel-section {
  background: var(--color-surface, var(--bg2));
  border: 1px solid var(--color-border, var(--border));
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}
.te-panel-section-title {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--color-text-subtle, var(--text3));
  margin-bottom: 10px;
  font-family: 'Share Tech Mono', monospace;
}

/* Design Tab Grid */
.te-design-color-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}
.te-color-picker-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.te-color-picker-box label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted, var(--text2));
}
.te-color-picker-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-surface-raised, var(--bg3));
  border: 1px solid var(--color-border, var(--border));
  border-radius: 8px;
  padding: 4px 6px;
}
.te-color-picker-row input[type="color"] {
  width: 24px;
  height: 24px;
  border: 1px solid var(--color-border, var(--border));
  border-radius: 4px;
  padding: 0;
  background: none;
  cursor: pointer;
}
.te-color-hex-label {
  font-size: 10px;
  font-family: 'Share Tech Mono', monospace;
  color: var(--color-text-subtle, var(--text3));
}

/* Font Pairing grid */
.te-font-pairing-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.te-font-btn {
  background: var(--color-surface-raised, var(--bg3));
  border: 1px solid var(--color-border, var(--border));
  border-radius: 10px;
  padding: 10px;
  text-align: left;
  cursor: pointer;
  color: var(--color-text, var(--text));
  transition: all 0.15s;
}
.te-font-btn:hover {
  border-color: var(--color-text-muted, var(--text2));
}
.te-font-btn.active {
  border-color: var(--color-accent, var(--accent));
  box-shadow: 0 0 0 1px var(--color-accent, var(--accent));
  background: color-mix(in srgb, var(--color-accent, var(--accent)) 8%, var(--color-surface-raised, var(--bg3)));
}
.te-font-preview {
  font-size: 20px;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 4px;
}
.te-font-label {
  font-size: 11px;
  font-weight: 700;
}
.te-font-desc {
  font-size: 9px;
  color: var(--color-text-subtle, var(--text3));
}

/* Radius / Shadow Buttons Groups */
.te-slider-row {
  margin-bottom: 12px;
}
.te-slider-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted, var(--text2));
  margin-bottom: 6px;
}
.te-btn-group {
  display: flex;
  border: 1px solid var(--color-border, var(--border));
  border-radius: 8px;
  overflow: hidden;
  background: var(--color-surface-raised, var(--bg3));
}
.te-btn-grp-opt {
  flex: 1;
  padding: 6px 4px;
  font-size: 10px;
  font-weight: 700;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-text-muted, var(--text2));
  text-align: center;
  transition: all 0.12s;
  border-right: 1px solid var(--color-border, var(--border));
  font-family: 'Nunito', sans-serif;
}
.te-btn-grp-opt:last-child {
  border-right: none;
}
.te-btn-grp-opt:hover {
  background: var(--color-surface, var(--bg2));
  color: var(--color-text, var(--text));
}
.te-btn-grp-opt.active {
  background: var(--color-accent, var(--accent));
  color: var(--color-bg, var(--bg));
  font-weight: 800;
}

/* Glassmorphism switch */
.te-glass-toggle-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 8px;
  border-top: 1px solid var(--color-border, var(--border));
  margin-bottom: 10px;
}
.te-glass-info {
  display: flex;
  flex-direction: column;
}
.te-glass-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-text-muted, var(--text2));
}
.te-glass-desc {
  font-size: 9px;
  color: var(--color-text-subtle, var(--text3));
}
.te-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
}
.te-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.te-switch-slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: var(--color-border, var(--border));
  transition: .2s;
  border-radius: 20px;
}
.te-switch-slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .2s;
  border-radius: 50%;
}
.te-switch input:checked + .te-switch-slider {
  background-color: var(--color-accent, var(--accent));
}
.te-switch input:checked + .te-switch-slider:before {
  transform: translateX(16px);
}

.te-range-slider {
  width: 100%;
  accent-color: var(--color-accent, var(--accent));
  height: 4px;
  border-radius: 2px;
  outline: none;
  background: var(--color-border, var(--border));
  cursor: pointer;
}

.te-reset-link {
  font-size: 11px;
  color: var(--color-accent, var(--accent));
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  margin-left: auto;
  padding: 0;
}
.te-reset-link:hover {
  text-decoration: underline;
}

/* Font styles definitions */
.font-sans { font-family: 'Nunito', sans-serif !important; }
.font-grotesk { font-family: 'Space Grotesk', sans-serif !important; }
.font-serif { font-family: 'Playfair Display', serif !important; }
.font-mono { font-family: 'Share Tech Mono', monospace !important; }

/* ── THEME APPEARANCE STUDIO AP TRACKER OVERRIDES ── */
body {
  font-family: var(--font-body, 'Nunito', sans-serif) !important;
}

.modal-title, .logo-text, .game-drawer-title, .game-levelup-title, .game-mission-complete-name {
  font-family: var(--font-headings, 'Rajdhani', sans-serif) !important;
}

/* Rounded corners overrides */
.modal, .store-modal, .game-levelup-card, .game-mission-complete-card, .game-badge-complete-card, .admin-panel-inner, .embedded-admin-shell {
  border-radius: var(--radius-card, 14px) !important;
  box-shadow: var(--shadow-card, 0 24px 80px rgba(0,0,0,0.6)) !important;
}

.game-card, .row-panel, .hist-panel, .press-minicard, .issue-card, .notes-editor-card, .mc-schedule, .todo-editor, .te-phone-card {
  border-radius: var(--radius-card, 14px) !important;
  box-shadow: var(--shadow-card, 0 2px 12px rgba(0,0,0,0.2)) !important;
}

.btn, .google-btn, .plant-switcher-btn, .theme-choice, .te-saved-apply, .mc-issue-item, .row-tab, .log-compose-btn, .press-btn {
  border-radius: var(--radius-btn, 8px) !important;
}

/* Glassmorphism filters overrides */
.modal, .store-modal, .admin-panel-inner, .embedded-admin-shell, 
.game-card, .row-panel, .hist-panel, .press-minicard, .issue-card, .notes-editor-card, .todo-editor {
  background: var(--glass-bg, inherit) !important;
  backdrop-filter: blur(var(--glass-blur, 0px)) !important;
  -webkit-backdrop-filter: blur(var(--glass-blur, 0px)) !important;
  border-color: var(--glass-border, var(--color-border, var(--border))) !important;
}

/* ── FLOATING PRESS ACTION HUB ── */
.press-hub-pill {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) scale(1);
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--glass-bg, var(--color-surface, var(--bg2))) !important;
  backdrop-filter: blur(var(--glass-blur, 16px)) saturate(180%) !important;
  -webkit-backdrop-filter: blur(var(--glass-blur, 16px)) saturate(180%) !important;
  border: 1px solid color-mix(in srgb, var(--color-accent, var(--accent)) 25%, var(--glass-border, var(--color-border, var(--border)))) !important;
  border-radius: 9999px !important;
  padding: 10px 20px;
  box-shadow: 0 24px 48px -12px rgba(0, 0, 0, 0.5), 
              0 0 20px -2px var(--te-active-shadow, rgba(249, 115, 22, 0.25));
  z-index: 1000;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease;
  pointer-events: auto;
}

.press-hub-pill.hidden {
  transform: translateX(-50%) translateY(40px) scale(0.85);
  opacity: 0;
  pointer-events: none;
}

/* Selected Machine Badge */
.press-hub-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  font-size: 13px;
  color: #ffffff !important;
  background: var(--color-accent, var(--accent)) !important;
  padding: 6px 14px;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.15) !important;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.1), 0 2px 4px rgba(0, 0, 0, 0.3);
}

.press-hub-select-wrapper {
  position: relative;
  cursor: pointer;
}

.press-hub-select-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
}

.press-hub-divider {
  width: 1px;
  height: 24px;
  background: var(--color-border, var(--border));
  opacity: 0.4;
}

/* Action Buttons */
.press-hub-actions {
  display: flex;
  gap: 8px;
}

.press-hub-btn {
  background: transparent;
  border: none;
  color: var(--color-text, var(--text));
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Nunito', sans-serif;
}

.press-hub-btn:hover {
  transform: scale(1.08) translateY(-1px);
}

.press-hub-btn:active {
  transform: scale(0.92) !important;
  filter: brightness(1.3);
  transition: transform 0.05s ease;
}

.press-hub-btn.btn-log {
  color: var(--color-danger, var(--red));
}
.press-hub-btn.btn-log:hover {
  background: rgba(239, 68, 68, 0.12);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.15);
}

.press-hub-btn.btn-notes {
  color: var(--color-warning, var(--yellow));
}
.press-hub-btn.btn-notes:hover {
  background: rgba(234, 179, 8, 0.12);
  box-shadow: 0 0 12px rgba(234, 179, 8, 0.15);
}

.press-hub-btn.btn-wiki {
  color: var(--color-teal, var(--teal));
}
.press-hub-btn.btn-wiki:hover {
  background: rgba(20, 184, 166, 0.12);
  box-shadow: 0 0 12px rgba(20, 184, 166, 0.15);
}

.press-hub-btn.btn-hist {
  color: var(--color-info, var(--blue));
}
.press-hub-btn.btn-hist:hover {
  background: rgba(59, 130, 246, 0.12);
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.15);
}

.hub-btn-svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

/* Compact layout for mobile viewports to keep text labels visible alongside icons */
@media (max-width: 580px) {
  .press-hub-pill {
    padding: 8px 12px;
    gap: 6px;
    bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .press-hub-badge {
    padding: 5px 10px;
    font-size: 11px;
  }
  .press-hub-btn {
    padding: 5px 8px;
    font-size: 11px;
    gap: 4px;
  }
  .hub-btn-svg {
    width: 12px;
    height: 12px;
  }
}

/* Inline mini-card toolbar is now shown on mobile */

/* Hide floating action pill on desktop since the inline minicard toolbar handles it */
@media (min-width: 900px) {
  .press-hub-pill {
    display: none !important;
  }
}

/* ── UTILITY CLASSES (consolidate inline-style sprawl) ── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.shrink-0 { flex-shrink: 0; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-10 { gap: 10px; }
.gap-12 { gap: 12px; }
.hidden { display: none !important; }
.pointer { cursor: pointer; }
.outline-none { outline: none; }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.text-2xs { font-size: 10px; }
.text-subtle { color: var(--color-text-subtle, var(--text3)); }
.text-muted { color: var(--color-text-muted, var(--text2)); }
.text-base { font-size: 13px; font-family: 'Nunito', sans-serif; color: var(--color-text, var(--text)); }
.fw-700 { font-weight: 700; }
.px-10 { padding: 7px 10px; }
.mt-6 { margin-top: 6px; }
.mt-8 { margin-top: 8px; }
.mb-5 { margin-bottom: 5px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-14 { margin-bottom: 14px; }
.overflow-hidden { overflow: hidden; }
.input-surface {
  background: var(--color-surface-raised, var(--bg3));
  border: 1px solid var(--color-border, var(--border));
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--color-text, var(--text));
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  outline: none;
}
.input-surface.w-full { width: 100%; }
.input-surface.w-120 { width: 120px; }

/* ── KEYBOARD SHORTCUTS OVERLAY ── */
.shortcuts-panel {
  background: var(--color-surface, var(--bg2));
  border: 1px solid var(--color-border, var(--border));
  border-radius: 16px;
  width: min(420px, 92vw);
  max-height: min(80vh, 600px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.shortcuts-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--color-border, var(--border));
}
.shortcuts-title {
  font-family: 'Rajdhani', sans-serif;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.shortcuts-close {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--color-border, var(--border));
  background: var(--color-surface-raised, var(--bg3));
  color: var(--color-text-muted, var(--text2));
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.shortcuts-body {
  overflow-y: auto;
  padding: 12px 16px 16px;
}
.shortcuts-group {
  margin-bottom: 16px;
}
.shortcuts-group:last-child {
  margin-bottom: 0;
}
.shortcuts-group-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--color-text-subtle, var(--text3));
  margin-bottom: 8px;
}
.shortcuts-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}
.shortcuts-key {
  font-family: 'Share Tech Mono', monospace;
  font-size: 12px;
  font-weight: 700;
  min-width: 56px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--color-surface-raised, var(--bg3));
  border: 1px solid var(--color-border, var(--border));
  text-align: center;
  color: var(--color-text, var(--text));
}
.shortcuts-label {
  font-size: 13px;
  color: var(--color-text-muted, var(--text2));
  font-family: 'Nunito', sans-serif;
}

/* Late Notes override: keep the logbook layout ahead of shared phone modal sizing. */
@media (min-width: 701px) {
  #notes-phone-frame.phone {
    --notes-chip-border: color-mix(in srgb, var(--color-border, var(--border)) 76%, var(--color-accent, var(--accent)) 24%);
    --notes-chip-bg: color-mix(in srgb, var(--color-surface, var(--bg2)) 84%, transparent);
    --notes-chip-hover-bg: color-mix(in srgb, var(--color-surface, var(--bg2)) 76%, var(--color-accent, var(--accent)) 10%);
    width: min(94vw, 1180px);
    height: min(88vh, 860px);
    border-radius: 12px;
    background: var(--notes-panel-bg);
    border-color: color-mix(in srgb, var(--color-border, var(--border)) 82%, var(--color-accent, var(--accent)) 18%);
    box-shadow: 0 24px 72px rgba(0,0,0,0.58);
  }
}

/* Final tool-shell layer: keep every tool aligned after legacy modal sizing rules. */
@media (min-width: 701px) {
  #press-wiki-frame.phone,
  #todos-frame.phone,
  #messaging-frame.phone,
  #add-modal-frame.phone,
  #role-alerts-frame.phone {
    width: min(94vw, 1180px);
    height: min(88vh, 860px);
    border-radius: 12px;
    background: var(--tool-panel-bg);
    border-color: color-mix(in srgb, var(--color-border, var(--border)) 82%, var(--tool-accent) 18%);
    box-shadow: 0 24px 72px rgba(0,0,0,0.58);
  }
}

  @media (max-width: 860px) {
    #notes-modal .notes-viewer {
      padding-bottom: 18px;
    }
    #notes-modal.notes-mobile-editor .notes-editor-actions {
      display: flex;
      position: static;
      z-index: 8;
      width: auto;
      flex: 0 0 auto;
      gap: 6px;
      padding: 3px;
      border-radius: 8px;
      border-color: color-mix(in srgb, var(--tool-accent, var(--color-accent, var(--accent))) 34%, var(--color-border, var(--border)));
      background: color-mix(in srgb, var(--color-surface, var(--bg2)) 88%, var(--tool-accent, var(--color-accent, var(--accent))) 12%);
      box-shadow: none;
    }
    #notes-modal.notes-mobile-editor .notes-editor-head {
      display: flex;
      order: -1;
      position: sticky;
      top: 0;
      z-index: 9;
      align-items: center;
      justify-content: space-between;
      gap: 8px;
      margin: -2px -2px 0;
      padding: 6px;
      border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 78%, var(--tool-accent, var(--color-accent, var(--accent))) 22%);
      border-radius: 10px;
      background: color-mix(in srgb, var(--color-bg, var(--bg)) 82%, var(--color-surface, var(--bg2)) 18%);
      box-shadow: 0 8px 18px rgba(0,0,0,0.16);
    }
    #notes-modal.notes-mobile-editor .notes-back-btn {
      display: inline-flex;
      min-height: 34px;
      flex: 0 0 auto;
      border-radius: 8px;
    }
    #notes-modal.notes-mobile-editor .notes-editor-actions .btn,
    #notes-modal.notes-mobile-editor .notes-menu-trigger {
      flex: 0 0 auto;
      min-height: 34px;
      padding: 0 11px;
      border-radius: 7px;
      font-size: 12px;
      white-space: nowrap;
    }
    #notes-modal.notes-mobile-editor .notes-mobile-actions-wrap {
      display: inline-flex;
      position: relative;
    }
    #notes-modal.notes-mobile-editor .notes-menu-trigger {
      min-width: 42px;
      color: transparent;
      font-size: 0;
    }
    #notes-modal.notes-mobile-editor .notes-menu-trigger::before {
      content: '...';
      color: var(--color-text-muted, var(--text2));
      font-size: 16px;
      line-height: 1;
      letter-spacing: 1px;
    }
    #notes-modal.notes-mobile-editor .notes-menu.visible {
      right: 0;
      left: auto;
    }
    #notes-modal.notes-mobile-editor #notes-pin-btn,
    #notes-modal.notes-mobile-editor #notes-archive-btn,
    #notes-modal.notes-mobile-editor #notes-delete-btn {
      display: none;
    }
    #notes-modal.notes-mobile-editor .notes-modal-header-actions,
    #notes-modal.notes-mobile-editor #notes-new-btn {
      display: none;
    }
    #notes-modal.notes-mobile-list #notes-new-btn {
      display: none;
    }
    #notes-modal.notes-viewer-mode #notes-edit-btn,
    #notes-modal.notes-editor-mode #notes-done-btn {
      min-height: 34px;
      font-size: 12px;
    }
    #notes-modal.notes-viewer-mode #notes-done-btn,
    #notes-modal.notes-editor-mode #notes-edit-btn {
      display: none;
    }
    #notes-modal.notes-viewer-mode #notes-pin-btn,
    #notes-modal.notes-viewer-mode #notes-archive-btn,
    #notes-modal.notes-viewer-mode #notes-delete-btn {
      display: none;
    }
    #notes-modal .notes-viewer-title {
      font-size: 24px;
    }
  #notes-modal .notes-viewer-body {
    min-height: 260px;
    font-size: 15px;
  }
}

/* Analytics Modal Choices.js overrides */
.analytics-part-picker {
  position: relative;
  z-index: 40;
  overflow: visible;
}
#analytics-modal .modal {
  overflow: visible;
}
.analytics-tabs {
  display: inline-flex;
  align-self: flex-start;
  gap: 4px;
  padding: 3px;
  margin: 8px 0 12px;
  border: 1px solid var(--color-border, var(--border));
  border-radius: 8px;
  background: var(--color-surface, var(--bg2));
}
.analytics-tab {
  min-width: 74px;
  border: 0;
  border-radius: 6px;
  padding: 7px 12px;
  background: transparent;
  color: var(--color-text-muted, var(--text2));
  cursor: pointer;
  font-family: 'Rajdhani', sans-serif;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.analytics-tab.active {
  background: var(--color-accent, var(--accent));
  color: #fff;
  box-shadow: 0 6px 14px var(--focus-ring, var(--accent-glow));
}
.analytics-panel {
  flex: 1;
  min-height: 0;
  display: none;
  flex-direction: column;
}
.analytics-panel.active {
  display: flex;
}
.analytics-chart-panel {
  flex: 1;
  position: relative;
  min-height: 0;
  width: 100%;
  border-radius: 12px;
  background: var(--color-surface, var(--bg2));
  padding: 12px;
  border: 1px solid var(--color-border, var(--border));
}
.runs-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}
.runs-controls .input {
  flex: 1;
  min-width: 0;
}
#runs-time-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.runs-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(170px, 230px) minmax(0, 1fr);
  gap: 12px;
}
.runs-picker-shell,
.runs-detail-shell {
  min-height: 0;
  border: 1px solid var(--color-border, var(--border));
  border-radius: 12px;
  background: var(--color-surface, var(--bg2));
}
.runs-picker-shell {
  display: flex;
  flex-direction: column;
  padding: 10px;
}
.runs-detail-shell {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px;
  overflow: hidden;
}
.runs-section-label {
  margin-bottom: 7px;
  color: var(--color-text-subtle, var(--text3));
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.runs-picker-list {
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.runs-picker-item {
  width: 100%;
  border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 84%, transparent);
  border-radius: 8px;
  padding: 8px;
  background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 72%, transparent);
  color: var(--color-text, var(--text));
  text-align: left;
  cursor: pointer;
}
.runs-picker-item.active {
  border-color: var(--color-accent, var(--accent));
  background: color-mix(in srgb, var(--color-accent, var(--accent)) 16%, var(--color-surface-raised, var(--bg3)));
}
.runs-picker-main,
.runs-picker-sub,
.runs-picker-meta {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.runs-picker-main {
  font-family: 'Share Tech Mono', monospace;
  font-size: 13px;
  font-weight: 800;
}
.runs-picker-sub {
  margin-top: 2px;
  color: var(--color-text-muted, var(--text2));
  font-size: 12px;
}
.runs-picker-meta {
  margin-top: 5px;
  color: var(--color-text-subtle, var(--text3));
  font-size: 11px;
}
.runs-selected-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  border-radius: 10px;
  padding: 10px;
  background: color-mix(in srgb, var(--color-surface-raised, var(--bg3)) 80%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 78%, transparent);
}
.runs-selected-kicker {
  color: var(--color-text-subtle, var(--text3));
  font-family: 'Rajdhani', sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.runs-selected-title {
  margin-top: 2px;
  color: var(--color-text, var(--text));
  font-weight: 800;
  line-height: 1.25;
}
.runs-selected-meta {
  margin-top: 4px;
  color: var(--color-text-muted, var(--text2));
  font-size: 12px;
}
.runs-selected-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}
.runs-selected-stats span {
  border: 1px solid var(--color-border, var(--border));
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--color-text-muted, var(--text2));
  font-size: 11px;
  white-space: nowrap;
}
.runs-chart-panel {
  flex: 0 0 190px;
}
.runs-table-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(260px, 1.2fr);
  gap: 10px;
}
.runs-table-grid > div {
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.runs-table-wrap {
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--color-border, var(--border));
  border-radius: 10px;
}
.runs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.runs-table th,
.runs-table td {
  padding: 7px 8px;
  border-bottom: 1px solid color-mix(in srgb, var(--color-border, var(--border)) 72%, transparent);
  text-align: left;
  white-space: nowrap;
}
.runs-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--color-surface-raised, var(--bg3));
  color: var(--color-text-subtle, var(--text3));
  font-family: 'Rajdhani', sans-serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.runs-empty,
.runs-empty-inline {
  color: var(--color-text-muted, var(--text2));
  padding: 14px;
  border: 1px dashed var(--color-border, var(--border));
  border-radius: 10px;
  text-align: center;
}
@media (max-width: 720px) {
  .runs-controls {
    align-items: stretch;
    flex-direction: column;
  }
  #runs-time-filters {
    justify-content: flex-start;
  }
  .runs-layout {
    grid-template-columns: 1fr;
    overflow: auto;
  }
  .runs-picker-shell {
    max-height: 190px;
  }
  .runs-detail-shell {
    overflow: visible;
  }
  .runs-selected-card {
    flex-direction: column;
  }
  .runs-selected-stats {
    justify-content: flex-start;
  }
  .runs-chart-panel {
    flex-basis: 180px;
  }
  .runs-table-grid {
    grid-template-columns: 1fr;
    overflow: visible;
  }
  .runs-table-wrap {
    max-height: 240px;
  }
}
#analytics-modal .choices { margin-bottom: 0; position: relative; z-index: 45; }
#analytics-modal .choices.is-open { z-index: 2200; }
.choices__inner, .choices[data-type*="select-multiple"] .choices__inner {
  background-color: var(--color-surface-raised, var(--bg3)) !important; border: 1px solid var(--color-border, var(--border)) !important; border-radius: 8px !important; min-height: 44px; padding: 4px 8px;
}
.choices.is-focused .choices__inner { border-color: var(--color-accent, var(--accent)) !important; }
.choices__input { background-color: transparent !important; color: var(--color-text, var(--text)) !important; font-size: 14px; }
#analytics-modal .choices__list--dropdown,
#analytics-modal .choices__list[aria-expanded] {
  background-color: var(--color-surface-raised, var(--bg3)) !important;
  border: 1px solid var(--color-border, var(--border)) !important;
  color: var(--color-text, var(--text)) !important;
  border-radius: 8px !important;
  box-shadow: 0 12px 32px rgba(0,0,0,0.58) !important;
  z-index: 2300 !important;
  margin-top: 4px;
  word-break: break-word;
}
#analytics-modal .choices__list--dropdown.is-active,
#analytics-modal .choices__list[aria-expanded="true"] {
  display: block !important;
  visibility: visible !important;
}
.choices__list--dropdown .choices__item { color: var(--color-text, var(--text)) !important; padding: 10px 14px; font-size: 14px; border-bottom: 1px solid var(--color-border, var(--border)); }
.choices__list--dropdown .choices__item--selectable.is-highlighted { background-color: var(--color-bg, var(--bg)) !important; color: var(--color-text, var(--text)) !important; }
.choices__list--multiple .choices__item, .choices[data-type*="select-multiple"] .choices__list--multiple .choices__item {
  background-color: var(--color-bg, var(--bg)) !important; border: 1px solid var(--color-border, var(--border)) !important; color: var(--color-text, var(--text)) !important; border-radius: 6px !important; padding: 4px 8px; font-size: 13px; word-break: break-all;
}
.choices__button, .choices[data-type*="select-multiple"] .choices__button { filter: invert(1) !important; border-left: 1px solid rgba(255,255,255,0.2) !important; margin-left: 6px; }
#doh-part-select.analytics-native-select {
  width: 100%;
  min-height: 128px;
  border-radius: 8px;
  border: 1px solid var(--color-border, var(--border));
  background: var(--color-surface-raised, var(--bg3));
  color: var(--color-text, var(--text));
  padding: 8px;
  font-family: 'Nunito', sans-serif;
  font-size: 13px;
  outline: none;
}
