/* ═══════════════════════════════════════════════════
   LEMMINGS DASHBOARD — Minimal
   ═══════════════════════════════════════════════════ */

:root {
    --bg: #0a0a0a;
    --surface: #111111;
    --surface-2: #171717;
    --surface-3: #1c1c1c;
    --border: #1e1e1e;
    --border-focus: #333;
    --text: #e5e5e5;
    --text-2: #a3a3a3;
    --text-3: #737373;
    --text-4: #525252;
    --accent: #8b5cf6;
    --accent-dim: rgba(139,92,246,0.08);
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #eab308;
    --sidebar-w: 260px;
    --topbar-h: 56px;
    --radius: 8px;
    --radius-sm: 6px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

img, svg, video, canvas {
    max-width: 100%;
    height: auto;
}

button, input, select, textarea {
    max-width: 100%;
}

h1, h2, h3, h4, h5, h6 { font-weight: 600; letter-spacing: -0.02em; }
a { color: inherit; text-decoration: none; }
code { background: var(--surface-2); padding: 2px 6px; border-radius: 4px; font-size: 0.88em; color: var(--text-2); }

.dashboard-background { display: none; }

/* ═══════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════ */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 100;
    transition: transform 0.25s ease;
}
.sidebar.collapsed { transform: translateX(-100%); }
.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    border: 0;
    z-index: 90;
}
body.sidebar-open .sidebar-backdrop { display: block; }

.sidebar-header {
    padding: 20px;
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid var(--border);
    height: var(--topbar-h);
}
.sidebar-logo {
    width: 24px; height: 24px;
    background: #fff;
    border-radius: 6px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 0;
}
.sidebar-logo::before { content: "\2726"; color: #0a0a0a; font-size: 13px; line-height: 1; }
.sidebar-brand { display: flex; flex-direction: column; }
.sidebar-title {
    font-size: 15px; font-weight: 600; color: #fff;
    letter-spacing: -0.01em; line-height: 1.2;
    background: none; -webkit-background-clip: initial; -webkit-text-fill-color: currentColor;
}
.sidebar-subtitle { display: none; }

.nav-section { flex: 1; padding: 12px 8px; overflow-y: auto; }
.nav-label {
    font-size: 10px; font-weight: 600; color: var(--text-4);
    text-transform: uppercase; letter-spacing: 0.1em; padding: 12px 12px 8px;
}

.nav-item {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 8px 12px; border-radius: var(--radius-sm);
    border: none; background: transparent;
    color: var(--text-3); cursor: pointer; transition: all 0.12s;
    text-decoration: none; font-size: 13px; font-weight: 500;
    margin-bottom: 1px;
}
.nav-item:hover { background: var(--surface); color: var(--text); }
.nav-item.active { background: var(--surface-2); color: #fff; }
.nav-item-label { flex: 1; min-width: 0; }
.nav-item-parent { margin-bottom: 1px; }
.nav-item-arrow { font-size: 10px; color: var(--text-4); flex-shrink: 0; transition: transform 0.15s; }
.nav-item.expanded .nav-item-arrow { transform: rotate(180deg); }
.nav-item.expanded .nav-item-arrow, .nav-item.active .nav-item-arrow { color: var(--text-2); }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }

.nav-submenu { display: none; flex-direction: column; gap: 1px; padding: 2px 0 6px 12px; }
.nav-submenu.open { display: flex; }
.nav-subitem {
    display: block; padding: 7px 12px;
    border-radius: var(--radius-sm); border: none;
    color: var(--text-3); text-decoration: none;
    font-size: 13px; font-weight: 500; cursor: pointer;
    transition: all 0.12s;
}
.nav-subitem:hover { background: var(--surface); color: var(--text); }
.nav-subitem.active { background: var(--surface-2); color: #fff; }
.nav-subitem.nav-item { display: block; justify-content: initial; gap: 0; padding-left: 12px; }

.sidebar-footer {
    border-top: 1px solid var(--border); padding: 12px 8px;
    display: flex; flex-direction: column; gap: 4px;
}
.sidebar-admin-entry { width: 100%; justify-content: flex-start; }
.user-info {
    display: flex; align-items: center; gap: 8px;
    border: 1px solid var(--border); background: var(--surface);
    border-radius: var(--radius-sm); padding: 8px 10px;
}
.user-avatar { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border); object-fit: cover; background: var(--surface-2); }
#userName { font-size: 12px; font-weight: 600; color: var(--text); min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.logout { color: var(--danger) !important; }
.logout:hover { background: rgba(239,68,68,0.08); }

/* ═══════════════════════════════════════════════════
   MAIN CONTENT & TOPBAR
   ═══════════════════════════════════════════════════ */
.main-content { flex: 1; margin-left: var(--sidebar-w); display: flex; flex-direction: column; min-height: 100vh; min-width: 0; overflow-x: hidden; }

.topbar {
    height: var(--topbar-h); padding: 0 24px;
    display: flex; align-items: center; justify-content: space-between;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky; top: 0; z-index: 50;
}
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 auto; }
.topbar-right { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; font-weight: 500; flex-shrink: 0; }
.menu-toggle { display: none; border: 1px solid var(--border); border-radius: var(--radius-sm); width: 36px; height: 36px; background: var(--surface); color: var(--text); font-size: 18px; cursor: pointer; transition: background 0.12s; }
.menu-toggle:hover { background: var(--surface-2); }

/* Server trigger */
.server-trigger {
    border: 1px solid var(--border); border-radius: var(--radius);
    background: var(--surface); color: var(--text);
    min-width: 240px; max-width: min(360px,50vw);
    display: inline-flex; align-items: center; gap: 10px;
    padding: 8px 12px; cursor: pointer;
    transition: border-color 0.15s;
}
.server-trigger:hover { border-color: var(--border-focus); }
.server-trigger-avatar { width: 32px; height: 32px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-4); display: inline-flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; overflow: hidden; flex-shrink: 0; }
.server-trigger-avatar img { width: 100%; height: 100%; object-fit: cover; }
.server-trigger-copy { display: flex; flex-direction: column; text-align: left; overflow: hidden; }
.server-trigger-label { font-size: 10px; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.server-trigger-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-trigger-caret { margin-left: auto; color: var(--text-4); font-size: 11px; }

/* User menu */
.user-menu { position: relative; }
.user-menu-trigger { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 5px 10px 5px 5px; display: inline-flex; align-items: center; gap: 8px; color: var(--text); cursor: pointer; transition: border-color 0.12s; }
.user-menu-trigger:hover { border-color: var(--border-focus); }
.topbar-user-avatar { width: 28px; height: 28px; }
.user-menu-name { font-size: 12px; font-weight: 600; max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-menu-caret { font-size: 10px; color: var(--text-4); }
.user-menu-dropdown { position: absolute; top: calc(100% + 6px); right: 0; min-width: 150px; border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,0.4); padding: 4px; display: none; flex-direction: column; z-index: 120; }
.user-menu.open .user-menu-dropdown { display: flex; }
.user-menu-item { border: none; background: transparent; color: var(--text); border-radius: var(--radius-sm); padding: 8px 10px; font-size: 13px; font-weight: 500; text-align: left; cursor: pointer; transition: background 0.1s; }
.user-menu-item:hover { background: var(--surface-2); }
.user-menu-item.danger { color: #fca5a5; }
.guild-select-native { display: none !important; }

/* Selects */
.guild-select, select {
    appearance: none; -webkit-appearance: none; -moz-appearance: none;
    background-color: var(--surface);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23525252' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 14px 14px;
    color: var(--text); border: 1px solid var(--border);
    border-radius: var(--radius-sm); font-size: 13px; font-family: inherit;
    line-height: 1.35; min-height: 38px; padding: 8px 36px 8px 12px;
    transition: border-color 0.12s;
}
.guild-select { min-width: 200px; }
.guild-select:hover, select:hover { border-color: var(--border-focus); }
.guild-select:focus, select:focus { outline: none; border-color: #444; }
.guild-select:disabled, select:disabled { cursor: not-allowed; opacity: 0.5; }
.guild-select option, select option { background: var(--surface); color: var(--text); }

/* ═══════════════════════════════════════════════════
   PAGES, CARDS, STATS
   ═══════════════════════════════════════════════════ */
.page-container { width: 100%; max-width: 1600px; margin: 0 auto; padding: 24px; flex: 1; }
.page { display: none; gap: 16px; align-content: start; animation: fadeIn 0.2s ease; }
.page.active { display: grid; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.page-title { font-size: 20px; font-weight: 600; margin: 0; letter-spacing: -0.02em; color: #fff; }

.card,
.card-header,
.form-grid,
.form-group,
.table-container,
.ticket-subcard,
.ticket-entity-editor,
.ticket-entity-list,
.custom-select,
.server-grid,
.server-card,
.server-card-head,
.server-card-copy,
.server-card-copy h4,
.server-card-copy p,
.dashboard-module-row,
.dashboard-action-head,
.workflow-components-header,
.component-item-header,
.form-section-header {
    min-width: 0;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    overflow: hidden;
}
.page > .card { margin: 0; }
.page > .card > * + * { margin-top: 12px; }
.card > h3 { font-size: 14px; font-weight: 600; margin: 0 0 12px; color: var(--text); }
.card-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 12px; margin: 0; padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}
.card-header > div { min-width: 0; }
.card-header h3 { margin: 0; line-height: 1.25; font-size: 14px; }
.card-header + .stats-grid, .card-header + .form-grid, .card-header + .table-container, .card-header + .ticket-inline-note, .card-header + .ticket-entity-grid, .card-header + .workflow-scope-header, .card-header + .workflow-scope-subtitle { margin-top: 14px; }
.section-subtext { display: block; margin-top: 4px; color: var(--text-3); font-size: 12px; line-height: 1.5; }
.field-validation { display: none; margin-top: 4px; font-size: 12px; line-height: 1.4; }
.field-validation.error { display: block; color: #fca5a5; }
.field-validation.success { display: block; color: var(--success); }
.required-asterisk { color: #fca5a5; }

/* Stat Cards */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    transition: border-color 0.12s;
}
.stat-card:hover { border-color: var(--border-focus); }
.stat-value { font-size: 24px; font-weight: 700; margin-bottom: 4px; letter-spacing: -0.02em; color: #fff; }
.stat-card.accent .stat-value { color: var(--accent); }
.stat-label { font-size: 11px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }

/* Dashboard hero & panels */
.dashboard-hero-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dashboard-hero-copy { min-width: 0; }
.dashboard-hero-copy h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.dashboard-hero-copy p { color: var(--text-3); font-size: 13px; line-height: 1.5; }
.dashboard-chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.dashboard-chip { display: inline-flex; align-items: center; padding: 4px 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-2); color: var(--text-4); font-size: 11px; font-weight: 500; letter-spacing: 0.01em; }
.dashboard-panels-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 12px; }
.dashboard-action-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.dashboard-action-item { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--surface); transition: border-color 0.12s; }
.dashboard-action-item.high { border-left: 2px solid var(--danger); }
.dashboard-action-item.medium { border-left: 2px solid var(--warning); }
.dashboard-action-item.low { border-left: 2px solid var(--accent); }
.dashboard-action-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.dashboard-action-title { font-size: 13px; font-weight: 600; }
.dashboard-action-detail { color: var(--text-3); font-size: 12px; line-height: 1.4; }
.dashboard-action-empty { border: 1px dashed var(--border); border-radius: var(--radius); padding: 14px; color: var(--text-4); font-size: 13px; text-align: center; }
.dashboard-module-health { display: flex; flex-direction: column; gap: 8px; }
.dashboard-module-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; background: var(--surface); }
.dashboard-module-copy { display: flex; flex-direction: column; gap: 2px; }
.dashboard-module-copy strong { font-size: 13px; font-weight: 600; }
.dashboard-module-copy small { font-size: 12px; color: var(--text-3); }

/* Timeline */
.dashboard-timeline-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.dashboard-timeline-item { display: grid; grid-template-columns: 8px 1fr auto; align-items: start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color 0.12s; }
.dashboard-timeline-item:hover { border-color: var(--border-focus); }
.dashboard-timeline-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 6px; background: var(--text-4); }
.dashboard-timeline-item.high .dashboard-timeline-dot { background: var(--danger); }
.dashboard-timeline-item.medium .dashboard-timeline-dot { background: var(--warning); }
.dashboard-timeline-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.dashboard-timeline-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.dashboard-timeline-source { font-size: 10px; text-transform: uppercase; color: var(--text-4); letter-spacing: 0.06em; font-weight: 600; }
.dashboard-timeline-time { font-size: 11px; color: var(--text-4); }
.dashboard-timeline-title { font-size: 13px; font-weight: 500; color: var(--text); overflow-wrap: anywhere; }
.dashboard-timeline-detail { color: var(--text-3); font-size: 12px; line-height: 1.4; overflow-wrap: anywhere; }
.dashboard-timeline-empty { border: 1px dashed var(--border); border-radius: var(--radius); padding: 14px; color: var(--text-4); font-size: 13px; text-align: center; }
.dashboard-timeline-action { align-self: center; }

/* Shop server */
.shop-server-grid { display: grid; gap: 14px; }
.prefixed-input { display: flex; align-items: stretch; min-height: 38px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); overflow: hidden; transition: border-color 0.12s; }
.prefixed-input:focus-within { border-color: #444; }
.prefixed-input-label { display: inline-flex; align-items: center; padding: 0 12px; background: var(--surface-2); border-right: 1px solid var(--border); color: var(--text-3); font-size: 13px; font-weight: 500; white-space: nowrap; }
.prefixed-input input { border: 0; border-radius: 0; background: transparent; min-height: 36px; box-shadow: none; }
.prefixed-input input:focus { border: 0; box-shadow: none; }
.alias-chip-editor { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-height: 38px; padding: 6px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); cursor: text; transition: border-color 0.12s; }
.alias-chip-editor:focus-within { border-color: #444; }
.alias-chip-list { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.alias-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-size: 12px; line-height: 1; }
.alias-chip-remove { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border: 0; border-radius: 50%; background: transparent; color: var(--text-3); cursor: pointer; font-size: 11px; transition: color 0.1s; }
.alias-chip-remove:hover { color: var(--danger); }
.alias-chip-editor input { flex: 1 1 160px; min-width: 160px; min-height: 28px; padding: 0; border: 0; background: transparent; box-shadow: none; }
.alias-chip-editor input:focus { border: 0; box-shadow: none; }

/* Modules */
.modules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.module-card {
    position: relative; background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 8px;
    min-height: 180px; transition: border-color 0.12s;
}
.module-card:hover { border-color: var(--border-focus); }
.module-card.disabled { opacity: 0.6; }
.module-card.locked .switch { cursor: not-allowed; }
.module-card.locked .switch .slider { opacity: 0.7; }
.module-card.locked .module-config-btn { pointer-events: none; opacity: 0.5; }
.module-card-lock-overlay { position: absolute; inset: 0; border: 0; border-radius: var(--radius); background: rgba(10,10,10,0.7); display: flex; align-items: center; justify-content: center; text-align: center; padding: 12px; cursor: pointer; z-index: 2; }
.module-card-lock-overlay:hover { background: rgba(10,10,10,0.8); }
.module-card-lock-copy { display: inline-flex; flex-direction: column; gap: 4px; align-items: center; font-size: 12px; font-weight: 600; color: var(--text); }
.module-card-lock-copy small { font-size: 11px; font-weight: 500; color: var(--text-3); }
.module-card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.module-card-title { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--text); }
.module-card-icon { width: 20px; text-align: center; font-size: 16px; }
.module-card-desc { color: var(--text-3); font-size: 12px; line-height: 1.5; min-height: 50px; }
.module-card-note { color: var(--text-4); font-size: 11px; }
.module-config-btn { margin-top: auto; }

/* ═══════════════════════════════════════════════════
   FORMS
   ═══════════════════════════════════════════════════ */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(240px, 1fr)); gap: 14px 16px; margin-bottom: 14px; align-items: start; }
.form-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.form-group.full-width { grid-column: 1 / -1; }
.form-group > div[style*="display:flex"] { flex-wrap: wrap; }
.form-group label { font-size: 11px; font-weight: 600; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.06em; }
.form-group input, .form-group select, .form-group textarea {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 8px 12px;
    color: var(--text); font-family: inherit;
    font-size: 13px; min-height: 38px;
    transition: border-color 0.12s;
}
.form-group select { width: 100%; min-width: 0; }
.form-group textarea { resize: none; overflow-y: hidden; min-height: 90px; line-height: 1.5; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { outline: none; border-color: #444; }
input[type="text"], input[type="number"], input[type="password"], input[type="url"], input[type="email"], textarea { background: var(--surface); border-color: var(--border); color: var(--text); }
input[type="text"]:focus, input[type="number"]:focus, input[type="password"]:focus, input[type="url"]:focus, input[type="email"]:focus, textarea:focus { border-color: #444; }
.form-section-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.form-group > * { min-width: 0; }

/* Custom select */
select.custom-select-native { display: none; }
.custom-select { position: relative; width: 100%; min-width: 0; }
.custom-select.disabled { opacity: 0.6; }
.custom-select-trigger { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); padding: 8px 12px; min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font: inherit; cursor: pointer; transition: border-color 0.12s; text-align: left; }
.custom-select-trigger:hover { border-color: var(--border-focus); }
.custom-select.open .custom-select-trigger { border-color: #444; }
.custom-select-trigger:disabled { cursor: not-allowed; }
.custom-select-trigger-label { min-width: 0; font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.custom-select-trigger-arrow { flex: 0 0 auto; font-size: 11px; color: var(--text-4); transition: transform 0.12s; }
.custom-select.open .custom-select-trigger-arrow { transform: rotate(180deg); }
.custom-select-menu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; max-width: 100%; z-index: 40; display: none; padding: 4px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: 0 8px 30px rgba(0,0,0,0.4); }
.custom-select.open .custom-select-menu { display: block; }
.custom-select.open-up .custom-select-menu { top: auto; bottom: calc(100% + 4px); }
.custom-select-search-wrap { padding: 4px 4px 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.custom-select-search { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text); padding: 8px 10px; font: inherit; font-size: 13px; }
.custom-select-search:focus { outline: none; border-color: #444; }
.custom-select-options { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.custom-select-option { width: 100%; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--text); padding: 8px 10px; display: grid; grid-template-columns: minmax(0,1fr) 16px; gap: 8px; align-items: center; text-align: left; font: inherit; cursor: pointer; transition: background 0.08s; }
.custom-select-option:hover { background: var(--surface-2); }
.custom-select-option.active { background: var(--surface-2); }
.custom-select-option:disabled { opacity: 0.4; cursor: not-allowed; }
.custom-select-option-label { min-width: 0; font-size: 13px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.custom-select-option-check { text-align: right; color: var(--text-2); font-size: 13px; font-weight: 600; }

/* Emoji input */
.emoji-input-row { display: flex; gap: 6px; align-items: center; }
.emoji-input-row input, .emoji-input-row textarea { flex: 1; min-width: 0; }
.emoji-field-wrapper { width: 100%; }
.emoji-textarea-row { align-items: flex-start; }
.emoji-textarea-row .emoji-picker-btn { margin-top: 6px; }
.emoji-picker-btn { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-family: inherit; font-size: 16px; width: 34px; height: 34px; min-width: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0; cursor: pointer; transition: border-color 0.12s; }
.emoji-picker-btn:hover { border-color: var(--border-focus); }
.emoji-picker-btn:focus { outline: none; border-color: #444; }
.checkbox-row { display: flex; align-items: center; gap: 8px; min-height: 38px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-weight: 500; font-size: 13px; }
.checkbox-row input[type="checkbox"] { width: 14px; height: 14px; accent-color: var(--accent); }

/* ═══════════════════════════════════════════════════
   TABLES
   ═══════════════════════════════════════════════════ */
.table-container { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); overflow: auto; background: var(--surface); }
.table-container table { min-width: 700px; }
.table-container thead th { position: sticky; top: 0; z-index: 1; }
.table-container td, .table-container th { vertical-align: middle; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--surface-2); color: var(--text-4); font-weight: 600; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--border); }
td { padding: 10px 14px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 13px; }
tr:hover td { background: var(--surface-2); }
tr.timeline-focus td { background: rgba(139,92,246,0.08) !important; }
.table-actions-inline { display: inline-flex; align-items: center; gap: 6px; }
.table-expand-col { width: 40px; }
.table-expand-btn { width: 26px; height: 26px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text-3); cursor: pointer; font-size: 12px; }
.table-expand-btn:hover { color: var(--text); border-color: var(--border-focus); }
.table-detail-row td { background: var(--surface-2); padding-top: 0; }
.table-detail-wrap { padding: 12px 0 4px; }
.admin-workspace-row { cursor: pointer; }
.admin-workspace-row-active td { background: var(--surface-2) !important; }

/* Product variants */
.product-variant-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px; }
.product-variant-summary-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 12px; }
.product-variant-summary-title { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.product-variant-summary-line { font-size: 12px; color: var(--text-3); line-height: 1.5; }
.product-variant-list { display: grid; gap: 10px; }
.product-variant-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 12px; }
.product-variant-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.product-variant-title { font-size: 13px; font-weight: 600; color: var(--text); }
.product-variant-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.product-variant-grid .full-width { grid-column: 1 / -1; }
.product-variant-preview { margin-top: 6px; color: var(--text-3); font-size: 12px; }
.product-variant-alias-editor { min-height: 38px; }
.product-variant-alias-editor input { min-width: 120px; }

/* ═══════════════════════════════════════════════════
   BADGES, BUTTONS, MODALS
   ═══════════════════════════════════════════════════ */

/* Badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.03em; }
.badge-pending { background: rgba(234,179,8,0.1); color: #eab308; }
.badge-confirmed, .badge-done { background: rgba(34,197,94,0.1); color: var(--success); }
.badge-denied, .badge-removed { background: rgba(239,68,68,0.1); color: var(--danger); }
.badge-processing, .badge-priced, .badge-paid, .badge-verified { background: var(--accent-dim); color: var(--accent); }
.status-badge { display: inline-flex; align-items: center; justify-content: center; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; }
.status-badge.success { background: rgba(34,197,94,0.1); color: var(--success); }
.status-badge.danger { background: rgba(239,68,68,0.1); color: var(--danger); }
.order-action-row { display: flex; align-items: center; gap: 6px; min-width: 200px; }
.order-status-select { min-width: 120px; max-width: 150px; min-height: 34px; padding: 6px 32px 6px 10px; font-size: 12px; }
.order-status-apply { min-width: 68px; justify-content: center; }

/* Buttons */
.btn {
    border: 1px solid var(--border); border-radius: var(--radius-sm);
    padding: 8px 16px; font-family: inherit; font-size: 13px; font-weight: 600;
    cursor: pointer; transition: all 0.12s;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-align: center;
    background: var(--surface); color: var(--text);
}
.btn:hover { border-color: var(--border-focus); background: var(--surface-2); }
.btn.primary { background: #fff; color: #0a0a0a; border-color: transparent; }
.btn.primary:hover { background: #d4d4d4; }
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { border-color: var(--border-focus); background: var(--surface-2); }
.btn.success { background: var(--success); color: #fff; border-color: transparent; }
.btn.success:hover { background: #16a34a; }
.btn.danger { background: var(--danger); color: #fff; border-color: transparent; }
.btn.danger:hover { background: #dc2626; }
.btn:disabled { cursor: not-allowed; opacity: 0.5; }
.btn.small { padding: 6px 12px; font-size: 12px; }
.btn-icon { background: none; border: none; color: var(--text-4); cursor: pointer; padding: 4px 6px; border-radius: var(--radius-sm); font-size: 14px; transition: color 0.1s; }
.btn-icon:hover { color: var(--text); }
.btn-icon.danger:hover { color: var(--danger); }

/* Modals */
.modal { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 200; justify-content: center; align-items: center; }
.modal.active { display: flex; }
.modal-content { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; max-width: 440px; width: 90%; animation: modalIn 0.2s ease; box-shadow: 0 16px 48px rgba(0,0,0,0.5); }
.modal-content.modal-large { max-width: 720px; }
.modal-content.modal-scroll { max-height: min(88vh, 960px); overflow-y: auto; padding-right: 18px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(8px); } }
.modal-content h3 { margin-bottom: 14px; }
.modal-content .form-group { margin-bottom: 12px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 6px; margin-top: 16px; }
.modal-content.modal-scroll .modal-actions { position: sticky; bottom: 0; padding-top: 12px; padding-bottom: 2px; background: linear-gradient(180deg, transparent, var(--surface) 30%); }
.shared-confirm-content { max-width: 600px; }
.shared-confirm-title { margin-bottom: 10px; }
.shared-confirm-message { color: var(--text-3); font-size: 14px; line-height: 1.6; margin-bottom: 16px; white-space: pre-line; }
.shared-confirm-message.html { white-space: normal; }
.shared-confirm-warning { border: 1px solid rgba(234,179,8,0.2); background: rgba(234,179,8,0.05); border-radius: var(--radius); padding: 10px 12px; color: #fde047; }
.shared-confirm-warning.critical { border-color: rgba(239,68,68,0.25); background: rgba(239,68,68,0.05); color: #fca5a5; }
.shared-confirm-warning strong { display: block; margin-bottom: 4px; }
.shared-confirm-warning ul { margin: 0 0 4px 16px; padding: 0; }
.shared-confirm-warning p { margin: 0; }
.modal-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 200; justify-content: center; align-items: center; }
.modal-overlay.active { display: flex; }
.modal-overlay > .modal { display: block; position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); max-width: 480px; width: 92%; max-height: 85vh; overflow-y: auto; animation: modalIn 0.2s ease; box-shadow: 0 16px 48px rgba(0,0,0,0.5); }
.modal-header { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border); }
.modal-header h3 { margin: 0; }
.modal-close { background: none; border: none; color: var(--text-4); font-size: 20px; cursor: pointer; padding: 0; transition: color 0.1s; }
.modal-close:hover { color: var(--text); }
.modal-body { padding: 18px 20px; }
.modal-body .form-group { margin-bottom: 12px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 6px; padding: 14px 20px; border-top: 1px solid var(--border); }

/* Recovery preflight */
.recovery-preflight-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin-bottom: 10px; }
.recovery-preflight-item { border: 1px solid var(--border); background: var(--surface); border-radius: var(--radius); padding: 10px 12px; }
.recovery-preflight-item label { display: block; margin: 0 0 3px; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-4); font-weight: 600; }
.recovery-preflight-item strong { display: block; color: var(--text); font-size: 14px; line-height: 1.3; }
.recovery-preflight-item span { color: var(--text-3); font-size: 12px; }
.recovery-preflight-counts { display: flex; flex-wrap: wrap; gap: 4px; }
.recovery-preflight-counts span { font-size: 11px; color: var(--text-2); border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; background: var(--surface-2); }

/* Unsaved dock */
.ticket-unsaved-dock { position: fixed; left: calc(var(--sidebar-w) + 24px); right: 24px; bottom: 20px; z-index: 180; display: none; pointer-events: none; }
.ticket-unsaved-dock.active { display: block; }
.ticket-unsaved-dock-inner { max-width: 960px; margin: 0 auto; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); box-shadow: 0 8px 30px rgba(0,0,0,0.4); display: flex; align-items: center; justify-content: space-between; gap: 14px; pointer-events: auto; }
.ticket-unsaved-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ticket-unsaved-copy strong { font-size: 13px; color: var(--text); }
.ticket-unsaved-copy span { font-size: 12px; color: var(--text-3); }
.ticket-unsaved-actions { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
body.sidebar-collapsed .ticket-unsaved-dock, .sidebar.collapsed ~ .main-content .ticket-unsaved-dock { left: 24px; }

/* Emoji picker */
.emoji-picker-popover { position: fixed; z-index: 260; width: 340px; max-width: calc(100vw - 16px); height: 420px; max-height: calc(100vh - 16px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,0.4); display: none; flex-direction: column; overflow: hidden; }
.emoji-picker-popover.open { display: flex; }
.emoji-picker-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.emoji-picker-tabs { display: flex; gap: 2px; }
.emoji-picker-tab { width: 28px; height: 28px; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent; color: var(--text-4); font-size: 15px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.08s; }
.emoji-picker-tab:hover { background: var(--surface-3); color: var(--text); }
.emoji-picker-tab.active { background: var(--surface-3); color: #fff; }
.emoji-picker-tab.server-tab.has-icon { padding: 0; overflow: hidden; }
.emoji-picker-tab.server-tab.has-icon img { width: 100%; height: 100%; object-fit: cover; border-radius: 5px; }
.emoji-picker-close { border: none; width: 26px; height: 26px; border-radius: var(--radius-sm); background: transparent; color: var(--text-4); cursor: pointer; font-size: 13px; transition: color 0.1s; }
.emoji-picker-close:hover { color: var(--danger); }
.emoji-picker-controls { padding: 8px; border-bottom: 1px solid var(--border); }
.emoji-picker-search { width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 10px; color: var(--text); font-family: inherit; font-size: 13px; }
.emoji-picker-search:focus { outline: none; border-color: #444; }
.emoji-picker-grid { flex: 1; overflow: auto; padding: 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(32px, 1fr)); gap: 4px; align-content: start; }
.emoji-item { border: none; border-radius: var(--radius-sm); background: transparent; color: var(--text); width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; font-size: 20px; transition: background 0.06s; }
.emoji-item:hover { background: var(--surface-2); }
.emoji-item.server { width: 32px; height: 32px; padding: 0; }
.emoji-item.server img { width: 22px; height: 22px; object-fit: contain; }
.emoji-empty { grid-column: 1 / -1; color: var(--text-4); font-size: 13px; text-align: center; padding: 10px; }
.emoji-picker-preview { height: 30px; display: flex; align-items: center; padding: 0 8px; border-top: 1px solid var(--border); color: var(--text-4); font-size: 11px; background: var(--surface-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Transcripts */
.transcript-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.transcript-search { width: min(300px, 100%); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; color: var(--text); font-family: inherit; font-size: 13px; }
.transcript-search:focus { outline: none; border-color: #444; }
.transcript-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 6px; transition: border-color 0.12s; }
.transcript-item.transcript-open-btn { width: 100%; text-align: left; font-family: inherit; color: inherit; cursor: pointer; outline: none; }
.transcript-item:hover { border-color: var(--border-focus); }
.transcript-item .transcript-id { font-family: monospace; font-size: 11px; color: var(--text-4); }
.transcript-item .transcript-owner { color: var(--text); font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.transcript-item .transcript-date { font-size: 12px; color: var(--text-3); }
.empty-state { color: var(--text-4); text-align: center; padding: 32px; font-size: 13px; }

/* Admin */
.admin-license-feedback { margin-top: 8px; margin-bottom: 6px; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text-3); font-size: 13px; }
.admin-license-feedback.is-success { border-left: 2px solid var(--success); color: #bbf7d0; }
.admin-license-feedback.is-error { border-left: 2px solid var(--danger); color: #fecaca; }
.admin-license-feedback.is-info { border-left: 2px solid var(--accent); color: #c4b5fd; }
.admin-license-loading-wrap { padding: 6px 0; display: flex; flex-direction: column; gap: 6px; }
.admin-license-loading-line { height: 10px; border-radius: 4px; background: linear-gradient(90deg, var(--surface-2) 0%, var(--surface-3) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; }
.admin-license-loading-line.wide { width: 92%; }
.admin-license-loading-line.medium { width: 74%; }
.admin-license-loading-line.narrow { width: 56%; }
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: -120% 0; } }

/* Pagination */
.pagination { display: flex; justify-content: center; gap: 4px; margin-top: 14px; }
.pagination button { background: var(--surface); border: 1px solid var(--border); color: var(--text-4); padding: 5px 12px; border-radius: var(--radius-sm); cursor: pointer; font-size: 12px; font-weight: 600; transition: all 0.1s; }
.pagination button:hover { border-color: var(--border-focus); color: var(--text); }
.pagination button.active { background: #fff; color: #0a0a0a; border-color: transparent; }

/* Toast */
.toast-container { position: fixed; bottom: 20px; right: 20px; z-index: 300; display: flex; flex-direction: column; gap: 6px; }
.toast { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; font-size: 13px; font-weight: 500; animation: toastIn 0.25s; box-shadow: 0 8px 30px rgba(0,0,0,0.4); }
.toast.success { border-left: 2px solid var(--success); }
.toast.error { border-left: 2px solid var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(80px); } }

/* File Upload */
.file-upload-area { position: relative; border: 1px dashed var(--border); border-radius: var(--radius); overflow: hidden; transition: border-color 0.15s; background: var(--surface); }
.file-upload-area:hover { border-color: var(--border-focus); }
.file-upload-area.disabled { opacity: 0.5; }
.file-upload-area.disabled .upload-placeholder, .file-upload-area.disabled .qr-preview { pointer-events: none; }
.upload-placeholder { padding: 20px; text-align: center; color: var(--text-4); cursor: pointer; font-size: 13px; transition: color 0.15s; }
.upload-placeholder:hover { color: var(--text-2); }
.qr-preview { position: relative; display: flex; justify-content: center; padding: 10px; background: var(--surface-2); }
.qr-preview img { max-width: 160px; max-height: 160px; border-radius: 6px; object-fit: contain; }

/* Payment QR */
.payment-qr-summary { margin-top: 8px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.payment-qr-summary-header { font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-4); margin-bottom: 8px; }
.payment-qr-summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; }
.payment-qr-summary-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.payment-qr-summary-label { font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-4); }
.payment-qr-summary-value { font-size: 13px; color: var(--text); word-break: break-word; }
.payment-qr-guidance { margin-top: 8px; padding: 10px 12px; border: 1px solid rgba(239,68,68,0.15); border-radius: var(--radius); background: rgba(239,68,68,0.04); }
.payment-qr-guidance-header, .payment-qr-guidance-title { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #fca5a5; margin-bottom: 6px; }
.payment-qr-guidance-copy, .payment-qr-guidance-body { font-size: 13px; color: var(--text); line-height: 1.5; }

/* Staff roles */
.role-tag { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); color: var(--text); padding: 4px 10px; border-radius: 4px; font-size: 12px; font-weight: 500; border: 1px solid var(--border); }
.role-tag .remove-role { background: none; border: none; color: var(--text-4); cursor: pointer; font-size: 13px; padding: 0; transition: color 0.1s; }
.role-tag .remove-role:hover { color: var(--danger); }
.staff-role-picker { display: flex; gap: 6px; align-items: center; justify-content: flex-start; }
.staff-role-picker select, .staff-role-picker .custom-select { flex: 0 1 400px; width: min(100%, 400px); max-width: 400px; min-width: 0; }
.staff-role-picker .btn { flex: 0 0 auto; }
.staff-role-picker select, .staff-role-picker .btn { min-height: 50px; }

/* ═══════════════════════════════════════════════════
   WORKFLOWS, STEPS, EMBED, TOGGLES
   ═══════════════════════════════════════════════════ */
.workflow-list { display: flex; flex-direction: column; gap: 8px; }
.workflow-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; align-items: center; gap: 12px; transition: border-color 0.12s; cursor: pointer; }
.workflow-card:hover { border-color: var(--border-focus); }
.workflow-card .wf-icon { font-size: 22px; }
.workflow-card .wf-info { flex: 1; }
.workflow-card .wf-name { font-weight: 600; font-size: 13px; }
.workflow-card .wf-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.workflow-card .wf-actions { display: flex; gap: 4px; align-items: center; }
.trigger-badge { display: inline-block; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; background: var(--surface-2); color: var(--text-3); }
.workflow-scope-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.workflow-scope-subtitle { margin: 0; font-size: 13px; color: var(--text-3); line-height: 1.5; }
.workflow-scope-note { font-size: 13px; color: var(--text-3); line-height: 1.5; margin: 4px 0 12px; }
.workflow-help-copy { display: block; margin-top: 6px; color: var(--text-4); line-height: 1.5; }
.workflow-qr-quick-actions { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.workflow-template-save-row { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }
.workflow-template-style-mount { margin-bottom: 10px; }
.workflow-template-style-controls { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 10px; margin-bottom: 10px; }
.workflow-template-style-controls input[type="color"] { width: 100%; height: 38px; padding: 0; border-radius: var(--radius-sm); border: 1px solid var(--border); background: transparent; cursor: pointer; }
.workflow-template-style-controls input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.workflow-template-style-controls input[type="color"]::-webkit-color-swatch { border: none; border-radius: 5px; }
.workflow-template-style-controls input[type="color"]::-moz-color-swatch { border: none; border-radius: 5px; }
.workflow-template-library-card { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 10px; }
.workflow-template-library-card h4 { margin: 0 0 6px; font-size: 13px; }
.workflow-template-library-create { margin-top: 8px; display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.workflow-template-library-list { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; padding-right: 4px; }
.workflow-template-library-empty { margin: 0; color: var(--text-4); font-size: 13px; }
.workflow-template-item { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface-2); padding: 6px; display: grid; gap: 6px; }
.workflow-template-item-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.workflow-template-item-name { margin: 0; font-weight: 600; color: var(--text); font-size: 13px; }
.workflow-template-item-meta { margin: 0; color: var(--text-4); font-size: 11px; }
.workflow-template-item-actions { display: flex; gap: 6px; justify-content: flex-end; }
.workflow-template-item-actions .btn.small { min-width: 80px; }
.workflow-qr-advanced { margin-top: 10px; border: 1px dashed var(--border); border-radius: var(--radius); padding: 8px 10px 10px; background: var(--surface); }
.workflow-qr-advanced > summary { cursor: pointer; user-select: none; font-weight: 600; font-size: 13px; color: var(--text); outline: none; }
.workflow-qr-advanced > summary::-webkit-details-marker { margin-right: 6px; }
.workflow-qr-advanced .form-grid { margin-top: 8px; }
.workflow-qr-template-preview { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); padding: 6px; min-height: 120px; display: flex; align-items: center; justify-content: center; }
.workflow-qr-template-preview img { display: block; width: 100%; height: auto; object-fit: contain; pointer-events: none; user-select: none; }
.workflow-qr-editor-stage { position: relative; width: min(100%, 540px); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); border: 1px solid var(--border); }
.workflow-qr-test-card { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 10px; }
.workflow-qr-test-card h4 { margin: 0 0 6px; font-size: 13px; }
.workflow-qr-test-action { display: flex; align-items: flex-end; }
.workflow-qr-test-preview { margin-top: 8px; border: 1px solid var(--border); border-radius: var(--radius); padding: 6px; background: var(--surface-2); }
.workflow-qr-test-preview img { display: block; width: min(100%, 340px); height: auto; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.workflow-qr-editor-box { position: absolute; border: 2px solid var(--success); border-radius: var(--radius-sm); background: rgba(34,197,94,0.06); cursor: move; min-width: 24px; min-height: 24px; transform-origin: center center; }
.workflow-qr-editor-box.qr { border-color: var(--success); }
.workflow-qr-editor-box.caption { border-color: var(--accent); background: rgba(139,92,246,0.06); }
.workflow-qr-editor-label { position: absolute; top: 4px; left: 6px; font-size: 9px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.5); pointer-events: none; }
.workflow-qr-editor-caption-sample { position: absolute; left: 0; right: 0; top: 0; bottom: 0; display: flex; align-items: center; justify-content: center; padding: 0 2px; font-size: 13px; font-weight: 500; line-height: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.5); pointer-events: none; }
.workflow-qr-editor-handle { position: absolute; width: 12px; height: 12px; right: -6px; bottom: -6px; border-radius: 50%; border: 2px solid rgba(10,10,10,0.8); background: #fff; cursor: nwse-resize; }
.workflow-qr-editor-handle.horizontal { width: 10px; height: 20px; right: -5px; top: 50%; bottom: auto; transform: translateY(-50%); border-radius: 6px; cursor: ew-resize; }
.workflow-qr-editor-rotate-handle { position: absolute; width: 14px; height: 14px; left: 50%; top: -20px; transform: translateX(-50%); border-radius: 50%; border: 2px solid rgba(10,10,10,0.8); background: #fbbf24; cursor: grab; }
.workflow-qr-editor-rotate-handle::after { content: "\21BB"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 9px; font-weight: 700; color: #1a1a1a; }
.workflow-qr-editor-box.dragging { filter: brightness(1.05); }

/* Tooltips */
.info-tip { position: relative; display: inline-flex; align-items: center; justify-content: center; margin-left: 4px; vertical-align: middle; cursor: help; }
.info-tip-icon { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-4); font-size: 9px; font-weight: 600; line-height: 1; }
.info-tip-bubble { position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%) translateY(4px); min-width: 220px; max-width: 300px; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-size: 12px; font-weight: 400; line-height: 1.5; box-shadow: 0 8px 30px rgba(0,0,0,0.4); opacity: 0; pointer-events: none; visibility: hidden; transition: opacity 0.12s, transform 0.12s, visibility 0.12s; z-index: 100; }
.info-tip:hover .info-tip-bubble, .info-tip:focus-within .info-tip-bubble { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }

/* Workflow trigger rules */
.workflow-trigger-rules { display: flex; flex-direction: column; gap: 8px; }
.workflow-trigger-rule { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr) auto; gap: 10px; align-items: end; padding: 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.workflow-trigger-rule .btn-icon { align-self: center; }

/* Toggle */
.wf-toggle { position: relative; width: 34px; height: 18px; background: var(--surface-3); border-radius: 9px; cursor: pointer; border: none; transition: background 0.15s; }
.wf-toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-4); transition: all 0.15s; }
.wf-toggle.on { background: var(--success); }
.wf-toggle.on::after { left: 18px; background: #fff; }
.switch { position: relative; display: inline-block; width: 38px; height: 20px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; cursor: pointer; inset: 0; background: var(--surface-3); border-radius: 20px; transition: background 0.15s; }
.switch .slider::before { content: ''; position: absolute; width: 14px; height: 14px; left: 3px; bottom: 3px; background: var(--text-4); border-radius: 50%; transition: transform 0.15s, background 0.15s; }
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider::before { transform: translateX(18px); background: #fff; }
.comp-enabled-fields { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--border); }

/* Step cards */
.step-list { display: flex; flex-direction: column; gap: 6px; }
.step-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: visible; transition: border-color 0.12s; }
.step-card.dragging { opacity: 0.5; }
.step-card.drag-over-before { box-shadow: inset 0 2px 0 var(--accent); }
.step-card.drag-over-after { box-shadow: inset 0 -2px 0 var(--accent); }
.step-card:hover { border-color: var(--border-focus); }
.step-card-header { display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; }
.step-card-header .step-num { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-3); color: var(--text-3); display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700; flex-shrink: 0; }
.step-card-header .step-icon { font-size: 16px; }
.step-card-header .step-title { flex: 1; font-weight: 500; font-size: 13px; }
.step-card-header .step-actions { display: flex; gap: 2px; margin-left: auto; }
.workflow-drag-handle { cursor: grab; }
.workflow-drag-handle:active { cursor: grabbing; }
.step-card-body { display: none; padding: 0 14px 14px; border-top: 1px solid var(--border); position: relative; z-index: 1; }
.step-card-body.open { display: block; padding-top: 12px; }
.step-type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.step-type-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer; transition: border-color 0.12s; text-align: center; }
.step-type-card:hover { border-color: var(--border-focus); }
.step-type-icon { font-size: 24px; }
.step-type-card strong { font-size: 12px; }
.step-type-card small { font-size: 11px; color: var(--text-4); }

/* Embed builder */
.embed-preview { background: #2f3136; border-left: 3px solid var(--accent); border-radius: 4px; padding: 14px; margin-top: 8px; font-size: 13px; }
.embed-toggle { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.embed-toggle label { font-size: 12px; color: var(--text-3); font-weight: 500; }
.embed-toggle input[type="checkbox"] { accent-color: var(--accent); }
.embed-fields-list { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; }
.embed-field-item { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; align-items: start; }
.embed-field-item input { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; color: var(--text); font-size: 13px; font-family: inherit; }
.embed-builder { display: flex; flex-direction: column; gap: 6px; }
.eb-section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.eb-section-header { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; font-size: 12px; font-weight: 600; color: var(--text); }
.eb-section-body { padding: 0 12px 10px; }
.eb-section-body input[type="text"], .eb-section-body textarea { width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 10px; color: var(--text); font-family: inherit; font-size: 13px; }
.eb-section-body textarea { resize: none; overflow-y: hidden; min-height: 56px; }
.eb-field-item { display: grid; grid-template-columns: minmax(120px, 1fr) minmax(160px, 1.4fr) auto auto; gap: 6px; padding: 6px 12px; border-top: 1px solid var(--border); align-items: start; }
.eb-field-item input[type="text"] { width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; color: var(--text); font-family: inherit; font-size: 13px; min-height: 38px; }
.eb-field-item textarea { width: 100%; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; color: var(--text); font-family: inherit; font-size: 12px; resize: none; overflow-y: hidden; min-height: 54px; }
.eb-field-inline-toggle { display: inline-flex; align-items: center; gap: 4px; color: var(--text-4); font-size: 11px; white-space: nowrap; padding: 5px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: transparent; cursor: pointer; transition: all 0.1s; user-select: none; }
.eb-field-inline-toggle input[type="checkbox"] { display: none; }
.eb-field-inline-toggle:hover { border-color: var(--border-focus); color: var(--text-3); }
.eb-field-inline-toggle.active { border-color: var(--border-focus); background: var(--surface-2); color: var(--text-2); }
.eb-field-item .remove-field { background: none; border: none; color: var(--text-4); cursor: pointer; font-size: 14px; padding: 4px; border-radius: 4px; transition: color 0.1s; }
.eb-field-item .remove-field:hover { color: var(--danger); }

/* ═══════════════════════════════════════════════════
   TICKET SYSTEM, COMPONENTS
   ═══════════════════════════════════════════════════ */
.ticket-system-tabs { display: inline-flex; gap: 2px; margin-bottom: 14px; padding: 3px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.ticket-system-tab { border: none; border-radius: var(--radius-sm); background: transparent; color: var(--text-4); padding: 8px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.1s; }
.ticket-system-tab:hover { color: var(--text); }
.ticket-system-tab.active { background: #fff; color: #0a0a0a; }
.ticket-system-section { display: none; }
.ticket-system-section.active { display: block; }
.ticket-card-copy { margin-top: 4px; font-size: 12px; color: var(--text-3); }
.ticket-card-actions { display: flex; gap: 6px; align-items: center; }
.ticket-entity-grid { display: grid; grid-template-columns: minmax(240px, 320px) minmax(0, 1fr); gap: 16px; align-items: stretch; }
.ticket-entity-list { display: flex; flex-direction: column; gap: 6px; min-height: 400px; }
.ticket-blueprint-version-list { max-height: 500px; overflow-y: auto; padding-right: 4px; }
.ticket-blueprint-version-list::-webkit-scrollbar { width: 4px; }
.ticket-blueprint-version-list::-webkit-scrollbar-track { background: transparent; }
.ticket-blueprint-version-list::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 4px; }
.ticket-entity-item { width: 100%; text-align: left; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 12px 14px; cursor: pointer; transition: border-color 0.1s; display: flex; flex-direction: column; gap: 4px; }
.ticket-entity-item:hover { border-color: var(--border-focus); }
.ticket-entity-item.active { border-color: #444; background: var(--surface-2); }
.ticket-entity-item strong { font-size: 13px; }
.ticket-entity-item span { color: var(--text-3); font-size: 11px; }
.ticket-entity-editor { min-width: 0; width: 100%; min-height: 400px; }
.ticket-entity-empty { border: 1px dashed var(--border); border-radius: var(--radius); padding: 16px; color: var(--text-4); font-size: 13px; text-align: center; }
.ticket-inline-note { margin-top: 14px; margin-bottom: 16px; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-3); font-size: 13px; }
.roblox-manual-action-banner { margin-top: -4px; margin-bottom: 12px; padding: 12px; border-radius: var(--radius); border: 1px solid rgba(234,179,8,0.15); background: rgba(234,179,8,0.04); }
.roblox-manual-action-title { font-size: 13px; font-weight: 600; color: #fde047; margin-bottom: 4px; }
.roblox-manual-action-text { font-size: 12px; color: #fef9c3; line-height: 1.5; }
.roblox-manual-action-detail { margin-top: 4px; font-size: 12px; color: var(--text-3); line-height: 1.4; }
.ticket-subcard { margin-top: 10px; margin-bottom: 10px; padding: 12px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.ticket-subcard h4 { margin: 0 0 8px; font-size: 13px; color: var(--text); }
.ticket-subcard small { display: block; line-height: 1.5; }
.ticket-subcard-accent { border-color: var(--border); background: var(--surface-2); }
.ticket-subcard-danger { border-color: rgba(239,68,68,0.15); background: rgba(239,68,68,0.03); }
.ticket-option-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.ticket-option-header h4 { margin-bottom: 4px; }
.ticket-option-header small { color: var(--text-3); font-size: 12px; }
.ticket-option-header .btn { flex: 0 0 auto; min-width: 140px; min-height: 38px; padding-inline: 16px; white-space: nowrap; }
.panel-option-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--surface); }
.panel-option-card + .panel-option-card { margin-top: 8px; }
.ticket-panel-actions { display: flex; gap: 8px; margin-top: 12px; }
.feature-disabled .form-grid, .feature-disabled .ticket-inline-note { opacity: 0.5; }
.ticket-binding-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; margin-top: 14px; }
.ticket-binding-row { display: grid; grid-template-columns: minmax(160px, 220px) minmax(220px, 1fr) auto; gap: 12px; align-items: start; padding: 12px 0; border-top: 1px solid var(--border); }
.ticket-binding-row:first-child { border-top: none; padding-top: 10px; }
.ticket-binding-row-type { grid-template-columns: minmax(0,1fr) minmax(200px, 300px); }
.ticket-binding-row-type .ticket-binding-copy, .ticket-binding-row-type .ticket-binding-control { margin-top: 6px; }
.ticket-binding-row-panel { display: grid; grid-template-columns: minmax(100px, 1fr) minmax(200px, 280px) 96px; justify-content: stretch; column-gap: 14px; row-gap: 0; align-items: start; }
.ticket-binding-copy { display: flex; flex-direction: column; gap: 4px; }
.ticket-binding-copy strong { font-size: 13px; color: var(--text); }
.ticket-binding-copy span { font-size: 12px; color: var(--text-3); }
.ticket-binding-control { min-width: 0; position: relative; width: 100%; }
.ticket-binding-control label { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-4); }
.ticket-binding-control-center { justify-self: auto; flex: 0 1 280px; width: 100%; max-width: 280px; }
.ticket-binding-actions { display: flex; align-items: center; justify-content: flex-end; align-self: center; min-width: 0; width: 100%; max-width: 96px; flex: 0 0 auto; justify-self: end; }
.ticket-binding-actions .btn { width: 100%; min-width: 0; min-height: 38px; padding: 6px 14px; }
.ticket-binding-row-panel .ticket-binding-copy { min-width: 120px; margin-top: 6px; }
.ticket-binding-row-panel .ticket-binding-control { margin-top: 6px; width: 100%; max-width: 300px; }
.ticket-binding-row-panel .ticket-binding-actions { align-self: end; margin-top: 24px; }

/* Workflow components */
.workflow-components-editor { margin-top: 12px; border-top: 1px solid var(--border); padding-top: 12px; }
.workflow-components-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; }
.workflow-components-label { font-size: 10px; font-weight: 600; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.06em; }
.workflow-components-toolbar { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.workflow-components-copy { display: block; margin-bottom: 8px; color: var(--text-4); line-height: 1.5; font-size: 12px; }
.component-item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; margin-bottom: 6px; }
.component-item-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.component-item-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.component-type-select { display: flex; align-items: center; gap: 6px; }
.component-type-select span { font-size: 10px; font-weight: 600; color: var(--text-4); text-transform: uppercase; letter-spacing: 0.06em; }
.component-type-select select { min-width: 140px; }
.component-type-chip { display: inline-flex; align-items: center; justify-content: center; min-height: 24px; padding: 3px 8px; border-radius: 4px; background: var(--surface-2); color: var(--text-3); font-size: 10px; font-weight: 600; }
.component-item .embed-toggle { display: flex; align-items: center; gap: 6px; }
.component-status-label { font-size: 13px; font-weight: 500; }
.component-empty-state { font-size: 12px; color: var(--text-4); border: 1px dashed var(--border); border-radius: var(--radius); padding: 12px; text-align: center; }
.workflow-component-subsection { margin-top: 10px; padding: 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.workflow-component-subheader, .workflow-component-row-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.workflow-component-subsection small { display: block; margin-top: 4px; margin-bottom: 8px; color: var(--text-4); line-height: 1.5; font-size: 12px; }
.workflow-component-option-list, .workflow-component-field-list { display: flex; flex-direction: column; gap: 8px; }
.workflow-component-row { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; background: var(--surface-2); }

/* ═══════════════════════════════════════════════════
   RECOVERY, SERVER SWITCHER, FOOTER, RESPONSIVE
   ═══════════════════════════════════════════════════ */
.recovery-json-block { margin: 0; min-height: 100px; max-height: 300px; overflow: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 10px; font-size: 12px; line-height: 1.4; white-space: pre-wrap; word-break: break-word; }
.recovery-summary-block { padding: 0; white-space: normal; }
.recovery-summary-shell { display: flex; flex-direction: column; gap: 10px; padding: 10px; }
.recovery-summary-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.recovery-summary-title-wrap h4 { margin: 0; font-size: 15px; color: var(--text); }
.recovery-summary-meta { margin-top: 3px; font-size: 12px; color: var(--text-3); }
.recovery-summary-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.recovery-summary-tag { display: inline-flex; padding: 3px 8px; border-radius: 4px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-3); font-size: 10px; font-weight: 600; }
.recovery-summary-kv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 8px; }
.recovery-summary-kv { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 8px; }
.recovery-summary-kv label { display: block; font-size: 10px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-4); margin-bottom: 3px; font-weight: 600; }
.recovery-summary-kv strong { font-size: 13px; color: var(--text); }
.recovery-summary-section { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 8px; }
.recovery-summary-section-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.recovery-summary-section-head h5 { margin: 0; font-size: 13px; color: var(--text); }
.recovery-summary-pill-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 6px; }
.recovery-summary-pill { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 8px; background: var(--surface-2); }
.recovery-summary-pill strong { display: block; font-size: 15px; line-height: 1.1; color: var(--text); }
.recovery-summary-pill span { display: block; margin-top: 2px; font-size: 11px; color: var(--text-3); }
.recovery-summary-footnote { font-size: 12px; color: var(--text-3); }
.recovery-summary-empty { border: 1px dashed var(--border); border-radius: var(--radius); color: var(--text-4); font-size: 13px; text-align: center; padding: 14px 10px; }
.recovery-stage-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.recovery-stage-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 10px; }
.recovery-stage-card.success { border-left: 2px solid var(--success); }
.recovery-stage-card.danger { border-left: 2px solid var(--danger); }
.recovery-stage-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 4px; }
.recovery-stage-head h6 { margin: 0; font-size: 13px; color: var(--text); }
.recovery-stage-note { margin: 0; font-size: 12px; line-height: 1.4; color: var(--text-3); }
.recovery-stage-list { margin: 6px 0 0; padding-left: 16px; color: var(--text-3); font-size: 12px; line-height: 1.4; }
#recoveryPlanStatusWrap { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.recovery-live-indicator { display: inline-flex; align-items: center; justify-content: center; padding: 2px 8px; border-radius: 4px; font-size: 10px; font-weight: 600; color: var(--text-4); border: 1px solid var(--border); }
.recovery-live-indicator.active { color: var(--success); border-color: rgba(34,197,94,0.2); }

/* Server Switcher Modal */
.modal-overlay > .server-switcher-modal { display: block !important; position: relative !important; width: min(980px, 95vw); max-width: min(980px, 95vw); max-height: min(88vh, 780px); overflow: auto; padding: 0; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 16px 48px rgba(0,0,0,0.5); }
.server-switcher-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 24px 24px 14px; border-bottom: 1px solid var(--border); }
.server-switcher-head h3 { margin: 0; font-size: 20px; line-height: 1.1; }
.server-switcher-head p { margin-top: 6px; color: var(--text-3); font-size: 13px; }
.server-switcher-tools { display: flex; align-items: center; gap: 10px; padding: 14px 24px 0; }
.server-refresh-btn { white-space: nowrap; }
.server-search { flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; color: var(--text); font-family: inherit; font-size: 13px; }
.server-search:focus { outline: none; border-color: #444; }
.server-count { padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text-4); font-size: 12px; font-weight: 500; white-space: nowrap; }
.server-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; padding: 14px 24px 24px; }
.server-card { border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 14px; display: flex; flex-direction: column; gap: 10px; animation: cardIn 0.2s ease both; transition: border-color 0.12s; }
.server-card:hover { border-color: var(--border-focus); }
.server-card.active { border-color: #444; }
.server-card.requires-binding { border-left: 2px solid var(--warning); }
.server-card-head { display: flex; gap: 10px; align-items: center; min-width: 0; }
.server-card-avatar { width: 40px; height: 40px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); color: var(--text-4); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 11px; overflow: hidden; flex-shrink: 0; }
.server-card-avatar img { width: 100%; height: 100%; object-fit: cover; }
.server-card-copy { min-width: 0; flex: 1 1 auto; overflow: hidden; }
.server-card-copy h4 { display: block; width: 100%; margin: 0 0 3px; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.server-card-copy p {
    display: -webkit-box;
    width: 100%;
    margin: 0;
    font-size: 12px;
    color: var(--text-3);
    white-space: normal;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.server-card-copy p.invite-needed { color: #eab308; }
.server-card-copy p.bind-needed { color: #fbbf24; }
.server-card-btn { width: 100%; justify-content: center; }
.server-card-actions { display: flex; flex-direction: column; gap: 8px; }
.server-card-ghost { border-style: dashed; justify-content: center; align-items: center; text-align: center; min-height: 160px; background: transparent; }
.server-card-plus { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--border); font-size: 24px; color: var(--text-4); }
.server-card-ghost h4 { margin: 4px 0 2px; font-size: 18px; }
.server-card-ghost p { color: var(--text-3); max-width: 220px; font-size: 12px; line-height: 1.5; margin-bottom: 8px; }
@keyframes cardIn { from { opacity: 0; } to { opacity: 1; } }

/* Workspace dashboard */
.workspace-dashboard-card { display: flex; flex-direction: column; gap: 12px; }
.workspace-stats-grid { margin-bottom: 2px; }
.workspace-flow-grid { margin-top: 2px; }
.workspace-server-tools { padding: 0; }
.workspace-server-grid { padding: 6px 0 0; }
.workspace-dashboard-card .form-grid { align-items: end; }
.workspace-dashboard-card .form-group.full-width { align-items: flex-start; }
.workspace-provided-bot-panel { position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.workspace-provided-bot-grid { margin-top: 2px; }
.workspace-provided-bot-grid > .full-width { grid-column: 1 / -1; }
.workspace-provided-bot-actions { display: flex !important; flex-direction: row !important; align-items: center; justify-content: center; width: 100%; gap: 8px; flex-wrap: nowrap !important; overflow-x: auto; }
.workspace-provided-bot-actions .btn { min-width: 0; width: auto !important; white-space: nowrap; }
.workspace-provided-bot-panel .module-card-lock-overlay { border-radius: inherit; }
.workspace-provided-bot-chips { margin-top: 2px; }
.workspace-provided-bot-status-entry { display: flex; gap: 8px; align-items: center; }
.workspace-provided-bot-status-emoji { width: 120px; flex: 0 0 120px; }
.workspace-provided-bot-status-emoji input { text-align: center; }
.workspace-provided-bot-status-entry input { flex: 1 1 auto; }
.workspace-provided-bot-status-list { margin-top: 8px; border: 1px solid var(--border); background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px; display: flex; flex-direction: column; gap: 6px; max-height: 210px; overflow-y: auto; }
.workspace-provided-bot-status-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); padding: 6px 8px; }
.workspace-provided-bot-status-text { color: var(--text-2); font-size: 12px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.workspace-provided-bot-customize-modal { max-width: min(760px, 94vw); max-height: min(86vh, 860px); }
#workspaceProvidedBotCustomizeModal { align-items: flex-start; padding: 16px 0; overflow-y: auto; }
#workspaceProvidedBotCustomizeModal .workspace-provided-bot-customize-modal { margin: 0 auto; }
#page-dashboard .dashboard-hero-card { align-items: center; }
#page-dashboard .dashboard-hero-copy { min-width: 0; }

/* Admin links */
.admin-group-link { color: var(--text-2); text-decoration: none; border-bottom: 1px dashed var(--border); transition: color 0.12s; }
.admin-group-link:hover { color: var(--text); }
.admin-cookie-actions { display: flex; flex-direction: column; gap: 4px; min-width: 160px; }
.admin-cookie-actions .btn { width: 100%; justify-content: center; }
.admin-cookie-watch-note { display: inline-block; margin-top: 4px; font-size: 11px; color: var(--text-4); }

/* Footer */
.app-footer { margin: 0 24px 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; align-items: center; gap: 8px; color: var(--text-4); font-size: 12px; }
.app-footer-brand { color: var(--text-2); font-weight: 600; }
.app-footer-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--text-4); flex-shrink: 0; }

/* Page overrides */
#page-config .card, #page-ticket-system .card, #page-shop-server .card, #page-workflows .card, #page-vouch-system .card, #page-recovery .card, #page-admin .card, #page-transcripts .card { overflow: hidden; }

/* ═══════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════ */
@media (max-width: 1320px) { .page-container { max-width: 100%; padding: 20px 18px 28px; } }
@media (max-width: 1200px) { .modules-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 1080px) {
    .dashboard-panels-grid, .ticket-entity-grid { grid-template-columns: 1fr; }
    .ticket-entity-list, .ticket-entity-editor { min-height: 0; }
    .dashboard-hero-card { flex-direction: column; align-items: flex-start; }
    .dashboard-hero-card .btn { width: 100%; }
}
@media (max-width: 1024px) {
    .topbar { padding: 0 16px; }
    .server-trigger { min-width: 200px; }
    .server-switcher-head h3 { font-size: 18px; }
    .app-footer { margin-inline: 16px; }
}
@media (max-width: 980px) {
    .form-grid { grid-template-columns: 1fr; gap: 10px; }
    .workflow-trigger-rule { grid-template-columns: 1fr; }
    .ticket-unsaved-dock { left: 16px; right: 16px; bottom: 14px; }
    .ticket-unsaved-dock-inner { flex-direction: column; align-items: stretch; }
    .ticket-unsaved-actions { justify-content: stretch; }
    .ticket-unsaved-actions .btn { flex: 1 1 0; }
    .ticket-entity-grid { grid-template-columns: 1fr; }
    .ticket-binding-grid { grid-template-columns: 1fr; }
    .ticket-binding-row { grid-template-columns: 1fr; }
    .ticket-binding-row-type, .ticket-binding-row-panel { justify-content: stretch; }
    .ticket-binding-row-panel { display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
    .ticket-binding-control-center { justify-self: stretch; flex: 1 1 auto; width: 100%; max-width: none; }
    .ticket-binding-actions { justify-content: flex-start; width: 100%; flex: 0 0 auto; }
    .ticket-option-header .btn { min-width: 0; white-space: normal; }
    .staff-role-picker { flex-direction: column; align-items: stretch; }
    .staff-role-picker select, .staff-role-picker .custom-select { width: 100%; max-width: none; flex: 1 1 auto; }
    .recovery-preflight-grid { grid-template-columns: 1fr; }
    .table-container table { min-width: 620px; }
    .dashboard-action-head,
    .dashboard-module-row,
    .workflow-components-header,
    .component-item-header,
    .workflow-component-subheader,
    .workflow-component-row-header,
    .form-section-header {
        flex-direction: column;
        align-items: stretch;
    }
    .dashboard-action-head .btn,
    .dashboard-module-row .btn,
    .workflow-components-header .btn,
    .component-item-header .btn,
    .form-section-header .btn {
        width: 100%;
    }
    .order-action-row {
        min-width: 0;
        width: 100%;
        flex-wrap: wrap;
    }
    .order-status-select,
    .order-status-apply {
        width: 100%;
        max-width: none;
    }
}
@media (max-width: 920px) {
    .card-header { flex-direction: column; align-items: flex-start; }
    .card-header > div:last-child { width: 100%; justify-content: flex-start; }
}
@media (max-width: 860px) {
    .page-container { padding: 14px; }
    .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .modules-grid { grid-template-columns: 1fr; }
    .card { padding: 14px; }
    .workspace-provided-bot-actions { flex-direction: row !important; justify-content: center; flex-wrap: nowrap !important; }
    .workspace-provided-bot-actions .btn { width: auto; min-width: 0; }
    .workspace-provided-bot-status-entry { flex-direction: column; align-items: stretch; }
    .workspace-provided-bot-status-emoji { width: 100%; flex: 1 1 auto; }
}
@media (max-width: 768px) {
    .main-content { margin-left: 0; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .menu-toggle { display: block; }
    body.sidebar-open { overflow: hidden; }
    .topbar { height: auto; min-height: var(--topbar-h); padding: 8px 12px; gap: 8px; }
    .topbar-left { gap: 8px; min-width: 0; }
    .topbar-right { gap: 6px; }
    .page-container { padding: 14px; }
    .app-footer { margin: 0 14px 14px; flex-wrap: wrap; }
    .step-type-grid { grid-template-columns: 1fr 1fr; }
    .eb-field-item { grid-template-columns: 1fr; }
    .eb-field-item .remove-field { justify-self: end; }
    .server-trigger { min-width: 0; width: auto; flex: 1 1 auto; max-width: none; }
    .server-trigger-label { display: none; }
    .server-trigger.server-only { width: 100%; max-width: none; }
    .user-menu-name { max-width: 80px; }
    .server-switcher-head { padding: 18px 14px 12px; }
    .server-switcher-head h3 { font-size: 18px; }
    .server-switcher-tools { padding: 10px 14px 0; flex-direction: column; align-items: stretch; }
    .workspace-server-tools { padding: 0; }
    .server-refresh-btn { width: 100%; }
    .server-grid { grid-template-columns: 1fr; padding: 10px 14px 14px; }
    .workspace-server-grid { padding: 6px 0 0; }
    #workspaceProvidedBotCustomizeModal { padding: 8px 0; }
    #workspaceProvidedBotCustomizeModal .workspace-provided-bot-customize-modal {
        width: 95%;
        max-height: calc(100vh - 16px);
        padding: 16px;
    }
    .dashboard-timeline-item { grid-template-columns: 8px minmax(0, 1fr); }
    .dashboard-timeline-action { grid-column: 2 / -1; justify-self: start; }
    .ticket-system-tabs { max-width: 100%; overflow-x: auto; }
    .ticket-system-tab { white-space: nowrap; }
    .table-container { -webkit-overflow-scrolling: touch; }
    .table-container table { min-width: 560px; }
    .ticket-panel-actions { flex-wrap: wrap; }
    .ticket-panel-actions .btn { flex: 1 1 100%; }
    .payment-qr-summary-grid,
    .product-variant-grid,
    .workflow-template-library-create { grid-template-columns: 1fr; }
    .modal { align-items: flex-end; padding: 0; }
    .modal-overlay { align-items: flex-end; padding: 0; }
    .modal-content,
    .modal-content.modal-large,
    .modal-overlay > .modal {
        width: 100%;
        max-width: none !important;
        max-height: 90vh;
        border-radius: 12px 12px 0 0;
    }
    .modal-content { padding: 16px; overflow-y: auto; }
    .modal-content.modal-scroll { max-height: 90vh; padding-right: 16px; }
    .modal-header, .modal-body, .modal-footer { padding: 14px; }
    .modal-actions { justify-content: stretch; flex-wrap: wrap; }
    .modal-actions .btn { flex: 1 1 calc(50% - 6px); min-width: 140px; }
    .card-header > div:last-child { display: flex; flex-wrap: wrap; gap: 8px; }
    .card-header > div:last-child .btn { min-width: 0; }
}
@media (max-width: 560px) {
    .topbar { flex-wrap: wrap; align-items: stretch; }
    .topbar-left { width: 100%; }
    .topbar-right { width: 100%; justify-content: flex-end; }
    .user-menu-name { display: none; }
    .user-menu-trigger { padding-right: 8px; }
    .server-trigger { width: 100%; }
    .server-count { width: 100%; text-align: center; }
    .table-container table { min-width: 500px; }
    .toast-container { right: 10px; left: 10px; bottom: 10px; align-items: stretch; }
    .toast-container .toast { width: 100%; max-width: none; }
}
@media (max-width: 520px) {
    .step-type-grid { grid-template-columns: 1fr; }
    .modal-actions .btn { flex: 1 1 100%; }
    .table-container table { min-width: 460px; }
}
@media (max-width: 640px) {
    .stats-grid { grid-template-columns: 1fr; }
    .page-title { font-size: clamp(18px, 6vw, 20px); }
    .app-footer { margin-inline: 12px; }
    .card { padding: 12px; }
    .page-container { padding: 12px; }
}
