/* ==========================================================================
   Evalia BOT Dashboard — Visual System v3 (Atelier)
   --------------------------------------------------------------------------
   Design principles
   - Monochromatic base with a single mint accent
   - Hairline borders, solid surfaces (no gradients on panels, no blur)
   - Precise motion, generous spacing, editorial typography
   - True dark & warm cream light modes
   - All class names preserved for JS backward compatibility
   ========================================================================== */

/* ==========================================================================
   1 · Design Tokens
   ========================================================================== */
:root {
    /* Surfaces — Evalia Crimson Console: pure black gradient into charcoal */
    --bg:         #050506;
    --bg-2:       #0b0b0c;
    --bg-3:       #111114;
    --surface:    #16171a;
    --surface-2:  #1e1f22;
    --surface-3:  #26272c;
    --surface-hi: #35363c;
    --panel:        var(--surface);
    --panel-soft:   var(--surface-2);
    --panel-strong: var(--surface-3);
    --bg-elev:      var(--surface);

    /* Borders — subtle warm greys with a crimson blush */
    --line:       #2a1a1e;
    --line-soft:  #1e1416;
    --line-2:     #3a2126;
    --line-hi:    #5a2b32;

    /* Text — high contrast neutral whites */
    --text:       #f5f5f6;
    --text-2:     #d8d8db;
    --muted:      #a7a7ac;
    --muted-soft: #78787e;
    --text-faint: #4c4c52;

    /* Primary palette — Crimson Blood */
    --accent:        #ff2a3a;   /* Evalia crimson */
    --accent-strong: #ff4353;
    --accent-dim:    #d61828;
    --accent-deep:   #a30f1c;
    --accent-glow:   rgba(255, 42, 58, 0.50);
    --accent-bg:     rgba(255, 42, 58, 0.14);
    --accent-soft:   #ff8b95;

    /* Secondary accents — kept for module color roles */
    --cyan:       #ff6b6b;              /* re-tuned to warm rose for community */
    --cyan-glow:  rgba(255, 107, 107, 0.42);
    --magenta:    #ff5490;              /* pink-red */
    --magenta-glow: rgba(255, 84, 144, 0.42);

    --gold:       #ffb347;              /* warm amber for economy */
    --gold-glow:  rgba(255, 179, 71, 0.42);
    --gold-dim:   #d97706;
    --violet:     #ff8a8f;              /* rose for XP */
    --rose:       #ff7d8a;

    --success:    #4ade80;              /* keep semantic green */
    --warning:    #ffb347;
    --danger:     #ff2a3a;              /* danger uses the same crimson */
    --info:       #ff9ba3;

    /* Radii */
    --r-xs: 4px;
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 18px;
    --r-2xl: 24px;
    --r-pill: 999px;

    /* Spacing scale (4-based) */
    --s-1: 4px;
    --s-2: 8px;
    --s-3: 12px;
    --s-4: 16px;
    --s-5: 20px;
    --s-6: 24px;
    --s-7: 32px;
    --s-8: 40px;
    --s-9: 48px;
    --s-10: 64px;

    /* Shadow — pitch black base with crimson bleed */
    --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.7);
    --shadow-2: 0 8px 22px rgba(0, 0, 0, 0.7), 0 1px 2px rgba(0, 0, 0, 0.55);
    --shadow-3: 0 18px 40px rgba(0, 0, 0, 0.78), 0 2px 6px rgba(0, 0, 0, 0.55);
    --shadow-pop: 0 28px 70px rgba(0, 0, 0, 0.85), 0 4px 14px rgba(0, 0, 0, 0.6);
    --shadow-neon: 0 0 0 1px color-mix(in srgb, var(--accent) 36%, transparent), 0 0 18px var(--accent-glow);
    --shadow: var(--shadow-2);

    /* Focus ring */
    --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);

    /* Typography */
    --font-sans:    "Inter", "Hiragino Sans", "Noto Sans JP", system-ui, sans-serif;
    --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
    --font-mono:    "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, monospace;

    /* Motion */
    --ease:        cubic-bezier(0.22, 0.61, 0.36, 1);
    --ease-out:    cubic-bezier(0.16, 1, 0.30, 1);
    --ease-spring: cubic-bezier(0.34, 1.34, 0.64, 1);
    --d-1: 120ms;
    --d-2: 180ms;
    --d-3: 240ms;
    --d-4: 320ms;
}

html[data-theme="light"] {
    --bg:         #fdf6f6;              /* very faint pink-white */
    --bg-2:       #ffffff;
    --bg-3:       #ffffff;
    --surface:    #ffffff;
    --surface-2:  #faf1f1;
    --surface-3:  #f2e5e6;
    --surface-hi: #e5d3d5;
    --panel:        var(--surface);
    --panel-soft:   var(--surface-2);
    --panel-strong: var(--surface-3);
    --bg-elev:      var(--surface);

    --line:       #ecd7d9;
    --line-soft:  #f5e6e8;
    --line-2:     #d9b7ba;
    --line-hi:    #b57a80;

    --text:       #1a0a0d;
    --text-2:     #4a2a30;
    --muted:      #6e4e54;
    --muted-soft: #907177;
    --text-faint: #b09399;

    --accent:        #d61828;
    --accent-strong: #b0121e;
    --accent-dim:    #ff4353;
    --accent-deep:   #7a0812;
    --accent-glow:   rgba(214, 24, 40, 0.22);
    --accent-bg:     rgba(214, 24, 40, 0.08);
    --accent-soft:   #ff8892;

    --gold:       #b8781e;
    --gold-dim:   #8c5910;
    --success:    #16a34a;
    --warning:    #d97706;
    --danger:     #d61828;
    --info:       #d61828;

    --shadow-1: 0 1px 2px rgba(90,10,20,0.08);
    --shadow-2: 0 4px 14px rgba(90,10,20,0.10), 0 1px 2px rgba(90,10,20,0.06);
    --shadow-3: 0 14px 36px rgba(90,10,20,0.14), 0 2px 8px rgba(90,10,20,0.08);
    --shadow-pop: 0 22px 56px rgba(90,10,20,0.20);

    --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--accent);
}

/* ==========================================================================
   2 · Reset & Globals
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; background: var(--bg); }

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11", "ss01";
}

/* Neon ambience — crimson bleed in corners on pitch black */
body::before {
    /* 旧: 深紅の radial-gradient 3枚を mix-blend-mode:screen で全面に敷いていた。
       「静か」に反し、密度の高い画面では文字の背後が不均一になるため撤去。
       奥行きは面の明度差と境界線だけで表す。 */
    content: none;
}

body.probot-layout { overflow: clip; }

@media (max-width: 920px) {
    html, body { overflow-x: hidden; max-width: 100vw; }
}

a { color: inherit; text-decoration: none; }

::selection {
    background: color-mix(in srgb, var(--accent) 35%, transparent);
    color: var(--text);
}

::placeholder { color: var(--muted-soft); opacity: .85; }

/* Scrollbars */
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--muted) 28%, transparent);
    border-radius: var(--r-pill);
    border: 2px solid transparent;
    background-clip: padding-box;
    transition: background var(--d-2) var(--ease);
}
*::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--accent) 55%, transparent);
    background-clip: padding-box;
    border: 2px solid transparent;
}
*::-webkit-scrollbar-track { background: transparent; }

/* Focus visibility */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 2px;
}

/* ==========================================================================
   3 · Top Bar
   ========================================================================== */
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    height: 56px;
    padding: 0 var(--s-5);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    border-bottom: 1px solid var(--line);
}

.topbar-left, .topbar-center, .topbar-actions {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    min-width: 0;
}
.topbar-left    { justify-content: flex-start; gap: var(--s-3); }
.topbar-center  { justify-content: center; }
.topbar-actions { justify-content: flex-end; gap: var(--s-2); }

.topbar-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 14px;
    letter-spacing: -0.01em;
    color: var(--text);
}

.brand-icon {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: 7px;
    /* 旧: accent→cyan のグラデーション。cyan は旧テーマの遺物で、
       トークン統一後は青が混ざり配色が破綻するため単色ブランドに変更。
       文字色も #06121a のハードコードをやめ、対比検証済みのトークンを使う。 */
    background: var(--brand-default);
    color: var(--fg-onbrand);
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 13px;
    box-shadow: 0 0 0 1px var(--accent-strong) inset, 0 0 16px var(--accent-glow), 0 4px 12px rgba(2, 4, 18, 0.5);
}

.topbar-link {
    color: var(--muted);
    font-size: 13px;
    padding: 6px 10px;
    border-radius: var(--r-sm);
    transition: color var(--d-1) var(--ease), background var(--d-1) var(--ease);
}
.topbar-link:hover { color: var(--text); background: var(--surface-2); }

.back-button,
.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text-2);
    border-radius: var(--r-sm);
    font: 600 12.5px/1 var(--font-sans);
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: color var(--d-1) var(--ease), background var(--d-1) var(--ease), border-color var(--d-1) var(--ease), transform var(--d-1) var(--ease);
}
.back-button:hover,
.theme-toggle:hover {
    color: var(--text);
    background: var(--surface-2);
    border-color: var(--line-2);
}
.back-button:active,
.theme-toggle:active { transform: scale(0.98); }

/* ==========================================================================
   4 · Shell (icon-rail + module-sidebar + main)
   ========================================================================== */
.shell-grid {
    display: grid;
    grid-template-columns: 68px 280px minmax(0, 1fr);
    height: calc(100vh - 56px);
    min-height: 0;
}

.icon-rail {
    border-right: 1px solid var(--line);
    padding: var(--s-3) 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    background: var(--bg-2);
}

.rail-avatar {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    border: 1px solid transparent;
    background: var(--surface);
    overflow: hidden;
    color: var(--text);
    font-weight: 700;
    font-size: 14px;
    transition: transform var(--d-2) var(--ease), border-color var(--d-2) var(--ease), border-radius var(--d-2) var(--ease);
    position: relative;
}
.rail-avatar img { width: 100%; height: 100%; object-fit: cover; }
.rail-avatar:hover { transform: translateY(-1px); border-radius: 10px; }
.rail-avatar.active {
    border-color: var(--accent);
    border-radius: 10px;
    box-shadow: 0 0 0 1px var(--accent) inset, 0 0 18px var(--accent-glow), 0 6px 16px rgba(2, 4, 18, 0.5);
}
.rail-avatar.active::before {
    content: "";
    position: absolute;
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 22px;
    background: var(--accent);
    border-radius: 0 3px 3px 0;
    box-shadow: 0 0 12px var(--accent-glow);
}

.module-sidebar {
    border-right: 1px solid var(--line);
    padding: var(--s-4) var(--s-3) var(--s-6);
    background: var(--bg-2);
    overflow-y: auto;
}

.guild-summary {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: var(--s-4) var(--s-3);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-1);
}
.guild-summary h1 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 14.5px;
    font-weight: 600;
    text-align: center;
    letter-spacing: -0.01em;
    line-height: 1.3;
}
.guild-summary-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
    box-shadow: 0 4px 14px rgba(0,0,0,0.4);
}
.guild-summary-icon.fallback {
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-weight: 700;
    background: var(--surface-3);
    color: var(--accent);
    font-size: 22px;
}

.module-nav-group { margin-top: var(--s-4); display: grid; gap: 2px; }
.module-title {
    margin: 4px 8px 6px;
    font-family: var(--font-display);
    font-size: 10.5px;
    color: var(--text-faint);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.14em;
}

.module-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    border-radius: var(--r-sm);
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    transition: color var(--d-1) var(--ease), background var(--d-1) var(--ease);
    position: relative;
}
.module-link:hover {
    color: var(--text);
    background: var(--surface-2);
}
.module-link.active {
    color: var(--text);
    background: var(--surface-2);
    font-weight: 600;
}
.module-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 2px;
    height: 16px;
    background: var(--accent);
    border-radius: 0 2px 2px 0;
    box-shadow: 0 0 10px var(--accent-glow);
}

.dashboard-main {
    padding: var(--s-6) var(--s-7);
    height: calc(100vh - 56px);
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    background: var(--bg);
    position: relative;
    z-index: 1;
}

/* ==========================================================================
   5 · Section panel
   ========================================================================== */
.section-panel {
    margin-top: var(--s-5);
    padding: var(--s-6);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-2);
    transition: border-color var(--d-2) var(--ease), box-shadow var(--d-2) var(--ease);
    position: relative;
    overflow: visible;
}
.section-panel:hover {
    border-color: color-mix(in srgb, var(--accent) 28%, var(--line-2));
    box-shadow: var(--shadow-2), 0 0 28px color-mix(in srgb, var(--accent) 12%, transparent);
}
.section-panel.compact { margin-top: 0; }

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--s-4);
    margin-bottom: var(--s-5);
    padding-bottom: var(--s-4);
    border-bottom: 1px solid var(--line);
}
.panel-kicker {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-size: 10.5px;
    letter-spacing: 0.16em;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
}
.panel-header h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    color: var(--text);
    line-height: 1.2;
    text-shadow: 0 0 24px color-mix(in srgb, var(--accent) 18%, transparent);
}

.panel-lead {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.7;
    margin: 0 0 var(--s-4);
}

/* ==========================================================================
   6 · Buttons
   ========================================================================== */
.save-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 36px;
    padding: 0 18px;
    border: 1px solid var(--accent);
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
    color: var(--fg-onbrand);
    font: 600 13px/1 var(--font-sans);
    letter-spacing: 0.005em;
    border-radius: var(--r-sm);
    cursor: pointer;
    transition: transform var(--d-1) var(--ease), filter var(--d-1) var(--ease), box-shadow var(--d-1) var(--ease);
    white-space: nowrap;
    box-shadow: 0 0 0 1px var(--accent-strong) inset, 0 0 22px var(--accent-glow), 0 4px 12px rgba(2,4,18,0.4);
    text-shadow: 0 1px 0 rgba(255,255,255,0.25);
}
.save-button:hover {
    filter: brightness(1.1);
    box-shadow: 0 0 0 1px var(--accent-strong) inset, 0 0 28px var(--accent-glow), 0 4px 14px rgba(2,4,18,0.45);
}
.save-button:active { transform: scale(0.98); }

.save-button.ghost {
    background: var(--surface);
    border-color: var(--line);
    color: var(--text);
    box-shadow: none;
}
.save-button.ghost:hover {
    background: var(--surface-2);
    border-color: var(--line-2);
}

.save-button.subtle {
    background: var(--surface-2);
    border-color: var(--line);
    color: var(--text);
    box-shadow: none;
}
.save-button.subtle:hover {
    background: var(--surface-3);
    border-color: var(--accent);
    color: var(--text);
}

.btn-primary,
.btn-ghost {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 38px;
    padding: 0 18px;
    font: 600 13px/1 var(--font-sans);
    border-radius: var(--r-sm);
    cursor: pointer;
    text-decoration: none;
    transition: transform var(--d-1) var(--ease), background var(--d-1) var(--ease), border-color var(--d-1) var(--ease), color var(--d-1) var(--ease);
    border: 1px solid;
}
.btn-primary {
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
    border-color: var(--accent);
    color: var(--fg-onbrand);
    box-shadow: 0 0 0 1px var(--accent-strong) inset, 0 0 26px var(--accent-glow), 0 4px 14px rgba(2,4,18,0.4);
    text-shadow: 0 1px 0 rgba(255,255,255,0.22);
}
.btn-primary:hover {
    filter: brightness(1.1);
    box-shadow: 0 0 0 1px var(--accent-strong) inset, 0 0 32px var(--accent-glow), 0 4px 18px rgba(2,4,18,0.5);
}
.btn-primary:active { transform: scale(0.98); }

.btn-ghost {
    background: var(--surface);
    border-color: var(--line);
    color: var(--text);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line-2); }
.btn-ghost:active { transform: scale(0.98); }

/* ==========================================================================
   7 · Form layouts
   ========================================================================== */
.base-form-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--s-4);
}
.base-layout-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-5);
    align-items: start;
}

.base-card {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface-2);
    padding: var(--s-5);
    display: grid;
    gap: 12px;
    align-self: start;
    transition: border-color var(--d-2) var(--ease);
}
.base-card:hover { border-color: var(--line-2); }

.base-card h3 {
    margin: 0 0 4px;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    letter-spacing: -0.005em;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 8px;
}
.base-card h3::before {
    content: "";
    width: 4px;
    height: 14px;
    border-radius: 2px;
    background: var(--accent);
}

.base-card .base-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.base-card .base-note { grid-column: span 2; }
.base-card-wide { grid-column: 1 / -1; }

.base-role-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.base-actions {
    display: flex;
    gap: 10px;
    margin-top: var(--s-3);
    flex-wrap: wrap;
}
.base-note { grid-column: span 2; }

/* ==========================================================================
   8 · Form controls
   ========================================================================== */
label {
    display: grid;
    gap: 6px;
    overflow: visible;
}
label span {
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
    letter-spacing: 0.005em;
}

input[type="text"],
input[type="password"],
input[type="number"],
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
    padding: 10px 12px;
    font: inherit;
    font-size: 13px;
    line-height: 1.5;
    transition: border-color var(--d-1) var(--ease), background var(--d-1) var(--ease), box-shadow var(--d-1) var(--ease);
}
html[data-theme="light"] input[type="text"],
html[data-theme="light"] input[type="password"],
html[data-theme="light"] input[type="number"],
html[data-theme="light"] select,
html[data-theme="light"] textarea { background: var(--surface); }

input[type="text"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
select:hover,
textarea:hover { border-color: var(--line-2); }

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="search"]:focus,
input[type="url"]:focus,
input[type="email"]:focus,
select:focus,
textarea:focus {
    /* 旧実装は outline:none + accent-glow の box-shadow だった。
       グロー撤去でリングが不可視になったため、実体のある2pxの輪郭に置き換える。
       type="search" は旧セレクタから漏れていたので追加。 */
    outline: 2px solid var(--border-focus);
    outline-offset: 2px;
    border-color: var(--brand-default);
}

textarea { resize: vertical; min-height: 72px; }

/* ==========================================================================
   9 · Switch (toggle)
   ========================================================================== */
.switch-row {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 12px 14px;
    align-content: center;
    background: var(--surface-2);
    transition: border-color var(--d-2) var(--ease);
}
.switch-row:hover { border-color: var(--line-2); }

.switch { position: relative; display: inline-block; }
.switch-input { width: 0; height: 0; opacity: 0; position: absolute; }
.switch-ui {
    width: 44px;
    height: 26px;
    border-radius: var(--r-pill);
    background: var(--surface-3);
    display: inline-block;
    position: relative;
    transition: background var(--d-2) var(--ease), box-shadow var(--d-2) var(--ease);
    border: 1px solid var(--line-2);
}
.switch-ui::after {
    content: "";
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--text-2);
    position: absolute;
    left: 2px;
    top: 2px;
    transition: transform var(--d-3) var(--ease-spring), background var(--d-2) var(--ease);
    box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.switch-input:checked + .switch-ui {
    background: linear-gradient(180deg, var(--accent), var(--accent-strong));
    border-color: var(--accent-strong);
    box-shadow: 0 0 0 4px var(--accent-glow), 0 0 18px var(--accent-glow);
}
.switch-input:checked + .switch-ui::after {
    transform: translateX(18px);
    background: var(--fg-onbrand);
}

/* ==========================================================================
   10 · Floating save bar & unsaved modal
   ========================================================================== */
.floating-savebar {
    position: fixed;
    left: calc(68px + 280px + 24px);
    right: 24px;
    bottom: 16px;
    z-index: 70;
}

.floating-savebar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
    padding: 10px 14px;
    border: 1px solid var(--gold);
    border-radius: var(--r-md);
    background: var(--surface);
    box-shadow: 0 24px 48px rgba(2,4,18,0.6), 0 0 0 4px color-mix(in srgb, var(--gold) 18%, transparent), 0 0 28px var(--gold-glow);
}

.floating-savebar-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    color: var(--text);
    font-weight: 600;
}
.floating-savebar-label::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gold);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 28%, transparent), 0 0 14px var(--gold-glow);
    animation: pulse 1.5s var(--ease) infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.floating-savebar-actions { display: flex; gap: 8px; align-items: center; }

.unsaved-modal[hidden],
.floating-savebar[hidden] { display: none !important; }

.unsaved-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    background: rgba(4, 6, 12, 0.7);
    animation: fade-in var(--d-2) var(--ease);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.unsaved-modal-card {
    width: min(92vw, 520px);
    padding: var(--s-5);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow-pop);
    display: grid;
    gap: var(--s-4);
    animation: pop var(--d-3) var(--ease-spring);
}
@keyframes pop {
    from { transform: translateY(12px) scale(0.96); opacity: 0; }
    to { transform: none; opacity: 1; }
}

.unsaved-modal-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.005em;
}
.unsaved-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.floating-savebar .save-button.subtle,
.unsaved-modal .save-button.subtle { width: auto; margin-top: 0; }

/* ==========================================================================
   11 · Log grid
   ========================================================================== */
.log-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--s-3);
}

.log-card {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: var(--s-4);
    display: grid;
    gap: 10px;
    transition: border-color var(--d-2) var(--ease), background var(--d-2) var(--ease);
}
.log-card:hover {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 6%, var(--surface-2));
    box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 18%, transparent);
}
.log-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.log-card h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 14.5px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.005em;
}

.color-input { text-transform: uppercase; font-family: var(--font-mono); font-size: 12px; }
.color-control {
    display: grid;
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
}
.color-picker-label {
    width: 40px;
    height: 40px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line-2);
    background: var(--swatch, var(--accent));
    cursor: pointer;
    flex-shrink: 0;
    display: block;
    overflow: hidden;
    transition: transform var(--d-1) var(--ease), box-shadow var(--d-1) var(--ease);
    box-shadow: inset 0 0 0 2px var(--surface);
}
.color-picker-label:hover {
    transform: scale(1.05);
    box-shadow: inset 0 0 0 2px var(--surface), 0 0 0 3px var(--accent-glow);
}
.color-picker-label .color-native-input { width: 100%; height: 100%; opacity: 0; cursor: pointer; padding: 0; border: none; display: block; }
.color-native-input { position: absolute; opacity: 0; width: 0; height: 0; pointer-events: none; }
.color-hex-input { letter-spacing: 0.05em; font-weight: 600; font-family: var(--font-mono); }

.swatch {
    height: 36px;
    border-radius: var(--r-sm);
    background: var(--swatch, var(--accent));
    border: 1px solid color-mix(in srgb, var(--swatch, var(--accent)) 40%, #000);
}

/* ==========================================================================
   12 · Ticket / Forum / Auto-VC panels
   ========================================================================== */
.ticket-header-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-3);
}

.ticket-toolbar {
    margin-top: var(--s-4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--s-3);
}
.ticket-toolbar h3,
.ticket-toolbar h4 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.005em;
}

.add-ticket-category {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px dashed var(--accent);
    background: var(--accent-bg);
    color: var(--accent);
    border-radius: var(--r-sm);
    padding: 7px 12px;
    cursor: pointer;
    font: 600 12.5px/1 var(--font-sans);
    transition: background var(--d-1) var(--ease), border-style var(--d-1) var(--ease);
}
.add-ticket-category:hover {
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    border-style: solid;
}

.ticket-category-list { margin-top: var(--s-3); display: grid; gap: 10px; }

.ticket-category-card {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface-2);
    padding: var(--s-4);
    display: grid;
    gap: 10px;
    transition: border-color var(--d-2) var(--ease);
}
.ticket-category-card:hover { border-color: var(--line-2); }

.ticket-role-picker { display: grid; gap: 8px; }
.ticket-role-list { display: grid; gap: 8px; }
.ticket-role-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
}

.ticket-panel-category-section { display: grid; gap: 6px; margin-top: 4px; }
.ticket-panel-category-header {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px;
}
.ticket-panel-category-label {
    font-family: var(--font-display);
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.ticket-panel-category-hint {
    font-size: 12px;
    color: var(--muted);
    margin: 0;
    line-height: 1.6;
}

.ticket-panel-category-list { display: grid; gap: 6px; margin-top: 2px; }

.add-ticket-role {
    justify-self: start;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--r-sm);
    padding: 6px 11px;
    cursor: pointer;
    font: 600 12px/1 var(--font-sans);
    transition: border-color var(--d-1) var(--ease), background var(--d-1) var(--ease), color var(--d-1) var(--ease);
}
.add-ticket-role:hover {
    border-color: var(--accent);
    background: var(--accent-bg);
    color: var(--accent);
}

.remove-ticket-role,
.remove-executor-row,
.remove-ticket-category {
    border: 1px solid color-mix(in srgb, var(--danger) 32%, transparent);
    background: color-mix(in srgb, var(--danger) 10%, transparent);
    color: color-mix(in srgb, var(--danger) 80%, var(--text) 20%);
    border-radius: var(--r-sm);
    padding: 6px 11px;
    cursor: pointer;
    font: 600 12px/1 var(--font-sans);
    transition: background var(--d-1) var(--ease), border-color var(--d-1) var(--ease);
}
.remove-ticket-role:hover,
.remove-executor-row:hover,
.remove-ticket-category:hover {
    background: color-mix(in srgb, var(--danger) 18%, transparent);
    border-color: var(--danger);
}

.ticket-card-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

/* ==========================================================================
   13 · Roles
   ========================================================================== */
.role-create-card,
.role-card:not(.role-accordion-card) {
    margin-top: var(--s-3);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface-2);
    padding: var(--s-4);
    transition: border-color var(--d-2) var(--ease);
}
.role-accordion-card.role-card {
    display: block !important;
    padding: 0 !important;
    margin-top: 0;
    overflow: hidden;
}
.role-create-card:hover,
.role-card:not(.role-accordion-card):hover { border-color: var(--line-2); }
.role-create-card h3,
.role-card:not(.role-accordion-card) h3 {
    margin: 0 0 10px;
    font-family: var(--font-display);
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.005em;
}

.role-create-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 60px auto;
    gap: 10px;
    align-items: center;
}
.role-form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 60px;
    gap: 10px;
    align-items: center;
}

input[type="color"] {
    width: 100%;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface);
    padding: 3px 5px;
    cursor: pointer;
}

.role-grid { display: grid; grid-template-columns: 1fr; gap: 8px; margin-top: 10px; }

.role-card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.role-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--role-color, var(--accent));
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--role-color, var(--accent)) 26%, transparent);
}
.role-badge {
    margin-left: auto;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--muted);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    padding: 3px 9px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-family: var(--font-display);
}

.permission-grid {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}
.perm-item {
    display: flex; align-items: center; gap: 8px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 8px 10px;
    background: var(--surface);
    transition: border-color var(--d-1) var(--ease), background var(--d-1) var(--ease);
}
.perm-item:hover { border-color: var(--accent); background: var(--accent-bg); }
.perm-item span { color: var(--text); font-size: 12.5px; }

/* ==========================================================================
   14 · Role accordion
   ========================================================================== */
.role-accordion-card {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface-2);
    overflow: hidden;
    transition: border-color var(--d-2) var(--ease);
}
.role-accordion-card.is-open {
    border-color: var(--accent);
    box-shadow: 0 0 22px color-mix(in srgb, var(--accent) 18%, transparent);
}

.role-editor-wrap { margin-top: var(--s-3); display: grid; gap: var(--s-3); }
.role-select-label { display: grid; gap: 6px; }
.role-editor-panel {
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface-2);
    padding: var(--s-4);
}
.role-editor-head { display: flex; align-items: center; gap: 8px; }

.role-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 14px;
    cursor: pointer;
    user-select: none;
    transition: background var(--d-1) var(--ease);
    border-radius: var(--r-md);
}
.role-accordion-card.is-open .role-accordion-header {
    border-radius: var(--r-md) var(--r-md) 0 0;
    background: var(--surface-3);
}
.role-accordion-header:hover { background: var(--surface-3); }

.role-accordion-meta { display: flex; align-items: center; gap: 8px; min-width: 0; }
.role-accordion-name {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.role-accordion-card .ticket-panel-body-inner {
    padding: var(--s-4);
    border-top: 1px solid var(--line);
}

/* ==========================================================================
   15 · Custom select & role picker
   ========================================================================== */
.cs-wrap, .role-picker-wrap { position: relative; }
.role-picker-label-text {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
    font-weight: 500;
}
.role-picker { position: relative; overflow: visible; }

.cs-trigger,
.role-picker-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--text);
    font: 13px/1.4 var(--font-sans);
    cursor: pointer;
    text-align: left;
    transition: border-color var(--d-1) var(--ease), background var(--d-1) var(--ease), box-shadow var(--d-1) var(--ease);
}
.cs-trigger:hover,
.role-picker-trigger:hover { border-color: var(--line-2); }
.cs-trigger[aria-expanded="true"],
.role-picker-trigger[aria-expanded="true"] {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow), 0 0 18px color-mix(in srgb, var(--accent) 30%, transparent);
}

.cs-trigger-icon { font-size: 13px; flex-shrink: 0; line-height: 1; }
.cs-trigger-dot,
.role-picker-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--role-color, var(--muted));
    flex-shrink: 0;
}
.cs-trigger-text,
.role-picker-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
}
.cs-trigger-text.placeholder { color: var(--muted-soft); }

.cs-chevron,
.role-picker-chevron {
    flex-shrink: 0;
    color: var(--muted);
    transition: transform var(--d-2) var(--ease);
    display: inline-flex;
}
.cs-trigger[aria-expanded="true"] .cs-chevron,
.role-picker-trigger[aria-expanded="true"] .role-picker-chevron { transform: rotate(180deg); }

.cs-dropdown,
.role-picker-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 200;
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    background: var(--surface);
    box-shadow: var(--shadow-3);
    overflow: hidden;
    animation: dropdown-in var(--d-2) var(--ease-out);
}
@keyframes dropdown-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}
html[data-theme="light"] .cs-dropdown,
html[data-theme="light"] .role-picker-dropdown {
    background: var(--surface);
}

.cs-search-wrap,
.role-picker-search-wrap {
    padding: 8px;
    border-bottom: 1px solid var(--line);
}
.cs-search,
.role-picker-search {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--text);
    padding: 7px 10px;
    font: 12.5px var(--font-sans);
    outline: none;
    transition: border-color var(--d-1) var(--ease), box-shadow var(--d-1) var(--ease);
}
.cs-search:focus,
.role-picker-search:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow), 0 0 12px color-mix(in srgb, var(--accent) 26%, transparent);
}

.cs-list,
.role-picker-list {
    max-height: 260px;
    overflow-y: auto;
    padding: 4px;
}
.cs-option,
.role-picker-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border-radius: var(--r-sm);
    cursor: pointer;
    font-size: 13px;
    color: var(--text);
    transition: background var(--d-1) var(--ease);
}
.cs-option:hover,
.role-picker-item:hover { background: var(--surface-2); }
.cs-option.selected {
    background: var(--accent-bg);
    color: var(--text);
    font-weight: 600;
}
.cs-option[hidden],
.role-picker-item[hidden] { display: none; }

.cs-option-dot,
.role-picker-item-dot {
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--role-color, var(--muted));
    flex-shrink: 0;
}
.cs-option-icon { font-size: 12.5px; flex-shrink: 0; line-height: 1; width: 16px; text-align: center; }
.cs-option-text,
.role-picker-item-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ==========================================================================
   16 · Flash / Notification
   ========================================================================== */
.flash-stack { display: grid; gap: 8px; margin-bottom: var(--s-4); }
.flash {
    border-radius: var(--r-md);
    padding: 12px 14px;
    font-size: 13px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    animation: flash-in var(--d-3) var(--ease-out);
}
@keyframes flash-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: none; }
}
.flash-success {
    background: color-mix(in srgb, var(--success) 12%, var(--surface-2));
    border-color: color-mix(in srgb, var(--success) 32%, transparent);
    color: color-mix(in srgb, var(--success) 85%, var(--text));
}
.flash-error {
    background: color-mix(in srgb, var(--danger) 12%, var(--surface-2));
    border-color: color-mix(in srgb, var(--danger) 32%, transparent);
    color: color-mix(in srgb, var(--danger) 85%, var(--text));
}

/* ==========================================================================
   17 · Home / Landing legacy shells
   ========================================================================== */
.home-layout .topbar { position: static; }

.home-main {
    max-width: 1180px;
    margin: 0 auto;
    padding: var(--s-7) var(--s-5) var(--s-9);
}

.home-hero h1 {
    margin: 8px 0;
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    letter-spacing: -0.025em;
    line-height: 1.1;
}
.home-hero p { margin: 0; color: var(--muted); }

.guild-grid-home {
    margin-top: var(--s-4);
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--s-3);
}
.guild-home-card {
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: var(--r-lg);
    padding: var(--s-4);
    display: grid;
    gap: 10px;
    box-shadow: var(--shadow-1);
    transition: border-color var(--d-2) var(--ease), transform var(--d-2) var(--ease), box-shadow var(--d-2) var(--ease);
}
.guild-home-card:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: var(--shadow-3);
}
.guild-home-card h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.guild-home-card p { margin: 0; color: var(--muted); }
.guild-home-head { display: flex; align-items: center; justify-content: space-between; }
.guild-home-head img,
.guild-home-head span {
    width: 40px; height: 40px;
    border-radius: 50%;
    object-fit: cover;
    display: grid; place-items: center;
    background: var(--surface-3);
    color: var(--text);
    font-weight: 700;
    font-family: var(--font-display);
}
.guild-home-head small { color: var(--muted); }

/* ==========================================================================
   18 · Mobile menu
   ========================================================================== */
.mobile-menu-btn {
    display: none;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--text);
    border-radius: var(--r-sm);
    width: 34px; height: 34px;
    padding: 0;
    font-size: 18px;
    cursor: pointer;
    line-height: 1;
    transition: background var(--d-1) var(--ease);
}
.mobile-menu-btn:hover { background: var(--surface-2); }

.mobile-nav-overlay {
    display: none;
    position: fixed;
    top: 56px; left: 0; right: 0; bottom: 0;
    z-index: 80;
    background: rgba(4, 6, 12, 0.55);
}
.mobile-nav-overlay.is-open { display: block; }

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

/* ==========================================================================
   19 · Ticket panel — accordion variant
   ========================================================================== */
.ticket-panel-card,
.forum-ticket-card,
.auto-vc-card {
    background: var(--surface-2);
    border-color: var(--line);
}
.ticket-panel-card.is-open,
.forum-ticket-card.is-open,
.auto-vc-card.is-open {
    border-color: var(--accent);
    box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 22%, transparent);
}

.ticket-panel-card-meta {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}

.ticket-panel-channel-badge,
.ticket-panel-type-badge,
.forum-ticket-forum-badge,
.auto-vc-trigger-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    white-space: nowrap;
}
.ticket-panel-type-badge {
    background: var(--accent-bg);
    color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 30%, transparent);
    font-family: var(--font-sans);
    font-weight: 600;
}

.ticket-panel-card .ticket-card-header,
.forum-ticket-card .forum-ticket-card-header,
.auto-vc-card .auto-vc-card-header {
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
}

.ticket-panel-accordion-arrow {
    font-size: 12px;
    color: var(--muted);
    transition: transform var(--d-2) var(--ease);
    flex-shrink: 0;
    display: inline-block;
}
.ticket-panel-card.is-open .ticket-panel-accordion-arrow,
.forum-ticket-card.is-open .ticket-panel-accordion-arrow,
.auto-vc-card.is-open .ticket-panel-accordion-arrow,
.role-accordion-card.is-open .ticket-panel-accordion-arrow {
    transform: rotate(180deg);
    color: var(--accent);
}

.ticket-panel-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows var(--d-4) var(--ease-out);
    overflow: hidden;
}
.ticket-panel-card.is-open .ticket-panel-body,
.forum-ticket-card.is-open .ticket-panel-body,
.auto-vc-card.is-open .ticket-panel-body,
.role-accordion-card.is-open .ticket-panel-body {
    grid-template-rows: 1fr;
    overflow: visible;
}
.ticket-panel-card.is-open .ticket-panel-body-inner,
.forum-ticket-card.is-open .ticket-panel-body-inner,
.auto-vc-card.is-open .ticket-panel-body-inner,
.role-accordion-card.is-open .ticket-panel-body-inner { overflow: visible; }

.ticket-panel-body-inner {
    overflow: hidden;
    display: grid;
    gap: var(--s-3);
    padding-top: 4px;
}

.ticket-panel-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s-3);
}

.ticket-panel-categories-section {
    border-top: 1px solid var(--line);
    padding-top: var(--s-3);
    margin-top: 4px;
}
.ticket-panel-categories-section .ticket-toolbar { margin-top: 0; }
.ticket-panel-categories-section .ticket-toolbar h4 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 12.5px;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.ticket-panel-category-list { display: grid; gap: 8px; margin-top: 8px; }

.ticket-category-inner-card {
    background: var(--bg-2);
    border-color: var(--line);
    margin-left: 12px;
    border-left: 2px solid var(--accent);
    border-radius: var(--r-sm);
}
.ticket-category-inner-card:hover {
    border-left-color: var(--accent-strong);
}

/* ==========================================================================
   20 · Utilities
   ========================================================================== */
.tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum" 1; }

.kbd {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--r-xs);
    border: 1px solid var(--line-2);
    background: var(--surface-2);
    color: var(--text-2);
    font: 500 11px var(--font-mono);
    box-shadow: 0 1px 0 var(--line-2);
}

hr {
    border: none;
    border-top: 1px solid var(--line);
    margin: var(--s-5) 0;
}

/* ==========================================================================
   21 · Responsive
   ========================================================================== */
@media (max-width: 1200px) {
    .shell-grid { grid-template-columns: 68px 240px minmax(0, 1fr); }
    .log-grid       { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .base-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .base-layout-grid { grid-template-columns: 1fr; }
    .base-card-wide { grid-column: auto; }

    .floating-savebar-inner { flex-direction: column; align-items: stretch; }
    .floating-savebar-actions { justify-content: flex-end; }
    .floating-savebar { left: calc(68px + 240px + 16px); right: 16px; }
}

@media (max-width: 920px) {
    body.probot-layout { overflow-x: hidden; overflow-y: auto; }

    .shell-grid {
        grid-template-columns: 1fr;
        height: auto;
        min-height: 100vh;
        width: 100%;
        overflow-x: hidden;
    }
    .icon-rail { display: none; }
    .module-sidebar {
        display: flex;
        flex-direction: column;
        position: fixed;
        top: 56px;
        left: 0;
        bottom: 0;
        width: 280px;
        z-index: 90;
        transform: translateX(-100%);
        transition: transform var(--d-3) var(--ease-out);
        overflow-y: auto;
        border-right: 1px solid var(--line);
        background: var(--bg-2);
    }
    .module-sidebar.is-open { transform: translateX(0); box-shadow: 12px 0 32px rgba(0,0,0,0.4); }

    .mobile-menu-btn { display: inline-flex; align-items: center; justify-content: center; }

    .dashboard-main {
        padding: var(--s-4);
        height: auto;
        overflow-x: hidden;
        overflow-y: visible;
        width: 100%;
        max-width: 100vw;
    }

    .topbar {
        padding: 0 12px;
        gap: 8px;
        position: fixed;
        top: 0; left: 0; right: 0;
        z-index: 100;
    }
    .shell-grid { padding-top: 56px; }

    .topbar-brand span:last-child { font-size: 13px; }
    .back-button, .theme-toggle { padding: 0 10px; font-size: 11.5px; height: 30px; }

    .log-grid, .base-form-grid { grid-template-columns: 1fr; }
    .log-card { padding: 12px; }
    .color-control { grid-template-columns: 44px minmax(0, 1fr); gap: 8px; }
    .color-picker-label { width: 44px; height: 44px; }
    .swatch { height: 32px; }

    .base-card .base-form-grid,
    .base-role-grid,
    .base-form-grid { grid-template-columns: 1fr; }

    .floating-savebar { left: 10px; right: 10px; bottom: 10px; }
    .floating-savebar-actions { width: 100%; }
    .floating-savebar-actions .save-button { width: 100%; }

    .ticket-header-grid,
    .role-grid,
    .permission-grid { grid-template-columns: 1fr; }
    .ticket-role-row { grid-template-columns: 1fr; }
    .role-create-form,
    .role-form-row { grid-template-columns: 1fr; }
    .base-note { grid-column: span 1; }

    .ticket-panel-fields { grid-template-columns: 1fr; }
}

@media (max-width: 540px) {
    .panel-header h2 { font-size: 18px; }
    .casino-role-limit-row {
        grid-template-columns: 1fr 1fr !important;
        flex-wrap: wrap;
    }
}

/* ==========================================================================
   22 · Comprehensive mobile layer
   --------------------------------------------------------------------------
   Catches dashboard_guild.html inline grid styles that don't naturally
   respond to viewport. Targets common patterns via attribute selectors so
   we don't have to touch 6800 lines of template markup.
   ========================================================================== */

@media (max-width: 720px) {
    /* Header gets tighter */
    .topbar { height: 52px; }
    .topbar-brand { font-size: 13px; }
    .topbar-brand .brand-icon { width: 24px; height: 24px; font-size: 12px; }

    /* Section panels are denser */
    .section-panel {
        margin-top: var(--s-4);
        padding: var(--s-4);
        border-radius: var(--r-md);
    }
    .panel-header {
        margin-bottom: var(--s-3);
        padding-bottom: var(--s-3);
        flex-wrap: wrap;
        gap: var(--s-2);
    }
    .panel-header h2 { font-size: 17px; line-height: 1.25; }
    .panel-kicker { font-size: 9.5px; }
    .panel-lead { font-size: 12.5px; line-height: 1.65; }

    /* All inline two-column grids in dashboard_guild collapse to single */
    .section-panel [style*="grid-template-columns:1fr 1fr"],
    .section-panel [style*="grid-template-columns: 1fr 1fr"],
    .section-panel [style*="grid-template-columns:1fr 1fr 1fr"],
    .section-panel [style*="grid-template-columns: 1fr 1fr 1fr"],
    .section-panel [style*="grid-template-columns:repeat(auto-fill"],
    .section-panel [style*="grid-template-columns: repeat(auto-fill"] {
        grid-template-columns: 1fr !important;
    }
    /* Toolbars wrap nicely */
    .ticket-toolbar {
        flex-wrap: wrap;
        gap: var(--s-2);
    }
    .ticket-toolbar h3, .ticket-toolbar h4 { font-size: 13px; }
    /* Inner cards get compact */
    .ticket-category-card,
    .base-card,
    .role-create-card,
    .role-card:not(.role-accordion-card),
    .role-editor-panel {
        padding: var(--s-3);
    }
    /* Smaller buttons */
    .save-button { height: 34px; padding: 0 14px; font-size: 12px; }
    .add-ticket-category,
    .add-ticket-role { font-size: 12px; padding: 6px 10px; }
    /* Form labels and inputs */
    label span { font-size: 11.5px; }
    input[type="text"],
    input[type="password"],
    input[type="number"],
    select,
    textarea { font-size: 13px; padding: 9px 11px; }
    /* Switch a touch smaller */
    .switch-ui { width: 40px; height: 24px; }
    .switch-ui::after { width: 18px; height: 18px; }
    .switch-input:checked + .switch-ui::after { transform: translateX(16px); }

    /* Custom picker triggers comfortable on touch */
    .cs-trigger,
    .role-picker-trigger {
        height: 38px;
        font-size: 13px;
    }
    .cs-list,
    .role-picker-list { max-height: 220px; }
    .cs-option,
    .role-picker-item { padding: 10px 11px; font-size: 13px; }

    /* Floating save bar — full width pill */
    .floating-savebar { left: 8px; right: 8px; bottom: 8px; }
    .floating-savebar-inner { padding: 9px 11px; border-radius: var(--r-md); }
    .floating-savebar-label { font-size: 12px; }
    .floating-savebar-label::before { width: 6px; height: 6px; }

    /* Ticket accordion compact */
    .ticket-card-header { gap: 8px; }
    .ticket-panel-card-meta { gap: 6px; }
    .ticket-panel-channel-badge,
    .ticket-panel-type-badge,
    .forum-ticket-forum-badge,
    .auto-vc-trigger-badge { font-size: 10.5px; padding: 3px 7px; }

    /* Unsaved modal full-width on mobile */
    .unsaved-modal-card {
        width: calc(100vw - 24px);
        padding: var(--s-4);
        border-radius: var(--r-md);
    }
    .unsaved-modal-actions { justify-content: stretch; }
    .unsaved-modal-actions .save-button {
        flex: 1;
        min-width: 0;
    }
}

@media (max-width: 480px) {
    /* Even tighter header + remove non-essential content */
    .topbar { padding: 0 10px; }
    .topbar-link { display: none; }

    .dashboard-main { padding: var(--s-3); }
    .section-panel {
        margin-top: var(--s-3);
        padding: var(--s-3);
    }
    .panel-header h2 { font-size: 16px; }

    /* All log/ticket/role/permission grids stay single column */
    .log-grid,
    .ticket-header-grid,
    .role-grid,
    .permission-grid,
    .base-form-grid,
    .base-role-grid,
    .base-layout-grid,
    .ticket-panel-fields {
        grid-template-columns: 1fr !important;
    }

    /* Save button + ghost/subtle stack vertically in floating bar */
    .floating-savebar-actions {
        flex-direction: column;
        align-items: stretch;
        width: 100%;
        gap: 6px;
    }
    .floating-savebar-actions .save-button { width: 100%; }

    /* Tighter typography */
    label span { font-size: 11px; letter-spacing: 0; }
    .panel-kicker { font-size: 9px; letter-spacing: 0.12em; }
    .panel-lead, label, p { font-size: 12.5px; }
    .add-ticket-role,
    .add-ticket-category {
        width: 100%;
        justify-content: center;
        text-align: center;
    }
}

/* Small-screen safe area for iPhone notches */
@supports (padding: env(safe-area-inset-bottom)) {
    .floating-savebar { bottom: max(8px, env(safe-area-inset-bottom)); }
    .dashboard-main { padding-bottom: max(var(--s-4), env(safe-area-inset-bottom)); }
}

/* Touch-friendly tap targets — ensure 36px+ min height for any interactive */
@media (hover: none) and (pointer: coarse) {
    .module-link,
    .d-nav-link,
    .add-ticket-role,
    .remove-ticket-role,
    .remove-executor-row,
    .remove-ticket-category,
    .perm-item {
        min-height: 36px;
    }
    .save-button,
    .back-button,
    .theme-toggle,
    .btn-primary,
    .btn-ghost {
        min-height: 38px;
    }
}


/* ==========================================================================
   v4 · Enhancement Layer — Command Console
   --------------------------------------------------------------------------
   Additions (layered on top, non-destructive):
   - Module accent color roles (economy/community/xp/moderation/danger)
   - Numerical monospace class (.num) for IDs, amounts, timestamps
   - KPI summary strip
   - Section accordion + status badges
   - Command palette (⌘K)
   - Custom confirm dialog
   - Skeleton loader + count-up
   - Mobile drawer nav + bottom sheet
   ========================================================================== */

/* --- Module accent color roles (all crimson-tinted) ---------------------- */
:root {
    --role-economy:   #ffb347;              /* 💰 warm amber        */
    --role-community: #ff6b6b;              /* 💬 rose red          */
    --role-xp:        #ff8a8f;              /* ⭐ soft rose          */
    --role-moderation:#ff5470;              /* 🛡 magenta red        */
    --role-danger:    var(--accent);        /* ⚠  Evalia crimson    */
}

/* apply module accent to any element with data-module attribute */
[data-module="economy"]    { --role: var(--role-economy);    --role-glow: rgba(255,179,71,0.42); }
[data-module="community"]  { --role: var(--role-community);  --role-glow: rgba(255,107,107,0.42); }
[data-module="xp"]         { --role: var(--role-xp);         --role-glow: rgba(255,138,143,0.42); }
[data-module="moderation"] { --role: var(--role-moderation); --role-glow: rgba(255,84,112,0.42); }
[data-module="danger"]     { --role: var(--role-danger);     --role-glow: var(--accent-glow); }

/* When a section has data-module, tint its border-left */
.section-panel[data-module] { border-left: 3px solid color-mix(in srgb, var(--role, var(--accent)) 65%, transparent); }
.section-panel[data-module] .panel-kicker { color: var(--role, var(--accent)); letter-spacing: 0.14em; }
.section-panel[data-module] .save-button:not(.subtle):not(.ghost) {
    background: color-mix(in srgb, var(--role, var(--accent)) 22%, transparent);
    border-color: color-mix(in srgb, var(--role, var(--accent)) 55%, transparent);
    color: var(--role, var(--accent));
}
.section-panel[data-module] .save-button:not(.subtle):not(.ghost):hover {
    background: color-mix(in srgb, var(--role, var(--accent)) 34%, transparent);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--role, var(--accent)) 45%, transparent),
                0 0 18px var(--role-glow, var(--accent-glow));
}
/* Nav link accent per group */
.module-nav-link[data-module="economy"]::before,
.module-nav-link[data-module="community"]::before,
.module-nav-link[data-module="xp"]::before,
.module-nav-link[data-module="moderation"]::before {
    content: ""; width: 3px; height: 14px; border-radius: 2px; margin-right: 8px;
    background: var(--role, var(--accent));
    box-shadow: 0 0 8px var(--role-glow, var(--accent-glow));
    display: inline-block; vertical-align: middle;
}

/* --- Numerical monospace class -------------------------------------------- */
.num, .num-mono, [data-num] {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.005em;
}

/* --- KPI summary strip ---------------------------------------------------- */
.kpi-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: var(--s-4);
    margin: 0 0 var(--s-6);
}
.kpi-card {
    position: relative;
    padding: var(--s-4) var(--s-5);
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    overflow: hidden;
    transition: border-color .18s ease, transform .18s ease;
}
.kpi-card:hover { border-color: color-mix(in srgb, var(--role, var(--accent)) 55%, var(--line)); transform: translateY(-1px); }
.kpi-card::after {
    content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .35;
    background: radial-gradient(160px 90px at 100% 0%, var(--role-glow, var(--accent-glow)), transparent 70%);
}
.kpi-card .kpi-label {
    display: flex; align-items: center; gap: 6px;
    font-size: 12px; font-weight: 600; letter-spacing: .08em;
    color: var(--muted); text-transform: uppercase;
}
.kpi-card .kpi-label .ic { font-size: 16px; opacity: .9; }
.kpi-card .kpi-value {
    margin-top: 6px;
    font-family: var(--font-mono); font-variant-numeric: tabular-nums;
    font-weight: 600; font-size: 26px; letter-spacing: -0.01em;
    color: var(--text);
}
.kpi-card .kpi-sub {
    margin-top: 2px; font-size: 12px; color: var(--muted-soft);
}

/* --- Section status badges (on nav links) --------------------------------- */
.module-nav-link { position: relative; }
.module-nav-link .nav-status {
    position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--muted-soft);
    box-shadow: 0 0 0 2px var(--panel);
}
.module-nav-link[data-status="active"]   .nav-status { background: var(--success); box-shadow: 0 0 0 2px var(--panel), 0 0 6px rgba(94,234,123,.7); }
.module-nav-link[data-status="warning"]  .nav-status { background: var(--warning); }
.module-nav-link[data-status="danger"]   .nav-status { background: var(--danger); }
.module-nav-link[data-status="inactive"] .nav-status { background: var(--text-faint); }

/* --- Nav group collapsible ------------------------------------------------ */
.module-nav-group.collapsible .module-title {
    cursor: pointer;
    display: flex; justify-content: space-between; align-items: center;
    user-select: none;
    padding-right: 4px;
}
.module-nav-group.collapsible .module-title::after {
    content: "▾";
    font-size: 10px; color: var(--muted-soft);
    transition: transform .18s ease;
}
.module-nav-group.collapsible.is-collapsed .module-title::after { transform: rotate(-90deg); }
.module-nav-group.collapsible .nav-group-items {
    display: flex; flex-direction: column; gap: 2px;
    max-height: 2000px; overflow: hidden;
    transition: max-height .3s ease;
}
.module-nav-group.collapsible.is-collapsed .nav-group-items {
    max-height: 0;
}

/* --- Section accordion (details/summary) ---------------------------------- */
.section-panel details.section-accordion { width: 100%; }
.section-panel details.section-accordion > summary {
    list-style: none; cursor: pointer;
    padding: 8px 0; user-select: none;
    display: flex; align-items: center; gap: 8px;
    color: var(--muted); font-size: 13px; font-weight: 600;
}
.section-panel details.section-accordion > summary::-webkit-details-marker { display: none; }
.section-panel details.section-accordion > summary::before {
    content: "▸"; transition: transform .18s ease;
    color: var(--muted-soft);
}
.section-panel details.section-accordion[open] > summary::before { transform: rotate(90deg); }

/* --- Command palette (⌘K) ------------------------------------------------- */
.cmd-palette-backdrop {
    position: fixed; inset: 0; z-index: 5000;
    background: rgba(2,4,18,0.66); backdrop-filter: blur(10px);
    display: none; align-items: flex-start; justify-content: center;
    padding-top: 12vh;
    animation: cmd-fade .18s ease;
}
.cmd-palette-backdrop.is-open { display: flex; }
html[data-theme="light"] .cmd-palette-backdrop { background: rgba(60,50,30,0.28); }
.cmd-palette {
    width: 100%; max-width: 640px;
    background: var(--panel);
    border: 1px solid var(--line-hi);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-pop);
    overflow: hidden;
    animation: cmd-pop .22s cubic-bezier(0.16,1,0.3,1);
}
.cmd-palette-input-wrap {
    display: flex; align-items: center; gap: 10px;
    padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.cmd-palette-input-wrap .cmd-search-ic { font-size: 16px; color: var(--muted); }
.cmd-palette-input {
    flex: 1; background: transparent; border: none; outline: none;
    color: var(--text); font-size: 15px; font-family: var(--font-sans);
}
.cmd-palette-input::placeholder { color: var(--muted-soft); }
.cmd-palette-kbd {
    font-family: var(--font-mono); font-size: 11px;
    padding: 2px 6px; border-radius: 4px;
    background: var(--surface-2); border: 1px solid var(--line);
    color: var(--muted);
}
.cmd-palette-results {
    max-height: 60vh; overflow-y: auto; padding: 6px;
}
.cmd-palette-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: var(--r-md); cursor: pointer;
    color: var(--text-2); font-size: 14px;
    transition: background .12s ease;
}
.cmd-palette-item .cmd-item-icon { font-size: 16px; width: 20px; text-align: center; }
.cmd-palette-item .cmd-item-label { flex: 1; }
.cmd-palette-item .cmd-item-hint {
    font-family: var(--font-mono); font-size: 11px;
    color: var(--muted-soft);
}
.cmd-palette-item.is-active,
.cmd-palette-item:hover {
    background: color-mix(in srgb, var(--accent) 15%, transparent);
    color: var(--text);
}
.cmd-palette-empty {
    padding: 30px 20px; text-align: center; color: var(--muted-soft); font-size: 13px;
}
.cmd-palette-hint-bar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 8px 14px; border-top: 1px solid var(--line);
    background: var(--surface-2); font-size: 11px; color: var(--muted-soft);
}
@keyframes cmd-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cmd-pop  { from { transform: translateY(-8px) scale(.98); opacity: 0; } to { transform: translateY(0) scale(1); opacity: 1; } }

/* --- Custom confirm dialog ------------------------------------------------ */
.confirm-backdrop {
    position: fixed; inset: 0; z-index: 6000;
    background: rgba(2,4,18,0.7); backdrop-filter: blur(6px);
    display: none; align-items: center; justify-content: center;
    padding: 20px;
}
.confirm-backdrop.is-open { display: flex; animation: cmd-fade .16s ease; }
.confirm-dialog {
    width: 100%; max-width: 420px;
    background: var(--panel);
    border: 1px solid var(--line-hi);
    border-radius: var(--r-xl);
    box-shadow: var(--shadow-pop);
    padding: 22px 24px;
    animation: cmd-pop .22s cubic-bezier(0.16,1,0.3,1);
}
.confirm-dialog h3 {
    margin: 0 0 8px; font-size: 17px; font-weight: 700; color: var(--text);
    display: flex; align-items: center; gap: 10px;
}
.confirm-dialog h3 .ic { font-size: 22px; }
.confirm-dialog p {
    margin: 0 0 18px; color: var(--text-2); font-size: 13.5px; line-height: 1.55;
}
.confirm-actions {
    display: flex; justify-content: flex-end; gap: 10px;
}
.confirm-actions .save-button { padding: 8px 16px; font-size: 13px; }
.confirm-dialog[data-severity="danger"] { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.confirm-dialog[data-severity="danger"] h3 { color: var(--danger); }

/* --- Skeleton loader ------------------------------------------------------ */
.skeleton {
    display: inline-block;
    background: linear-gradient(90deg,
        color-mix(in srgb, var(--line) 40%, var(--surface)) 0%,
        color-mix(in srgb, var(--line) 70%, var(--surface)) 50%,
        color-mix(in srgb, var(--line) 40%, var(--surface)) 100%);
    background-size: 200% 100%;
    border-radius: var(--r-sm);
    animation: sk-shimmer 1.4s infinite linear;
    color: transparent !important;
}
@keyframes sk-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-line { height: 10px; width: 100%; }
.skeleton-line.short { width: 40%; }
.skeleton-line.medium { width: 65%; }
.skeleton-block { display: block; height: 80px; border-radius: var(--r-md); }

/* --- Count-up shimmer on freshly-updated values --------------------------- */
.num-fresh {
    animation: num-fresh 1.2s ease;
}
@keyframes num-fresh {
    0%   { color: var(--role, var(--accent)); text-shadow: 0 0 10px var(--role-glow, var(--accent-glow)); }
    100% { color: var(--text); text-shadow: none; }
}

/* --- Toast (right-bottom slide-in) ---------------------------------------- */
.toast-stack {
    position: fixed; right: 20px; bottom: 20px; z-index: 5500;
    display: flex; flex-direction: column; gap: 10px; pointer-events: none;
}
.toast {
    pointer-events: auto;
    min-width: 260px; max-width: 380px;
    padding: 12px 16px 12px 18px;
    background: var(--panel);
    border: 1px solid var(--line-hi);
    border-left: 3px solid var(--accent);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-2);
    color: var(--text); font-size: 13.5px;
    display: flex; align-items: center; gap: 10px;
    animation: toast-in .28s cubic-bezier(0.16,1,0.3,1);
}
.toast[data-tone="success"] { border-left-color: var(--success); }
.toast[data-tone="warning"] { border-left-color: var(--warning); }
.toast[data-tone="danger"]  { border-left-color: var(--danger); }
.toast .toast-ic { font-size: 16px; }
.toast .toast-close {
    margin-left: auto; opacity: .5; cursor: pointer; padding: 2px 4px;
    background: transparent; border: none; color: var(--muted);
    font-size: 15px;
}
.toast .toast-close:hover { opacity: 1; }
.toast.is-leaving { animation: toast-out .2s ease forwards; }
@keyframes toast-in  { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
@keyframes toast-out { from { transform: translateX(0); opacity: 1; } to { transform: translateX(20px); opacity: 0; } }

/* --- Command palette trigger button in sidebar --------------------------- */
.cmd-open-btn {
    display: flex; align-items: center; gap: 10px;
    width: 100%; padding: 10px 12px; margin-bottom: 14px;
    background: var(--surface-2); border: 1px solid var(--line);
    border-radius: var(--r-md);
    color: var(--muted); font-size: 13px; font-family: var(--font-sans);
    cursor: pointer; transition: border-color .14s ease, background .14s ease;
}
.cmd-open-btn:hover { border-color: var(--accent); background: var(--surface); color: var(--text); }
.cmd-open-btn .cmd-open-label { flex: 1; text-align: left; }
.cmd-open-btn .cmd-palette-kbd { margin: 0; }

/* --- Nav count badge in group titles ------------------------------------- */
.module-title .nav-count {
    font-family: var(--font-mono); font-size: 10px;
    padding: 1px 6px; border-radius: 6px;
    background: var(--surface-2); color: var(--muted-soft);
    border: 1px solid var(--line);
}

/* Mobile: KPI grid + palette adaptation */
@media (max-width: 920px) {
    .kpi-strip { grid-template-columns: repeat(2, 1fr); }
    .cmd-open-btn { display: none; }  /* palette accessible via ⌘K only on desktop */
}
@media (max-width: 540px) {
    .kpi-strip { grid-template-columns: 1fr; }
    .cmd-palette { max-width: 92vw; }
    .toast-stack { right: 10px; bottom: 10px; left: 10px; }
    .toast { max-width: 100%; }
}

/* --- Enhanced flash → toast bridge (existing flash-* already styled) ---- */
.flash-stack.floating {
    position: fixed; right: 20px; bottom: 20px; z-index: 5500;
    max-width: 380px;
}

