/* Insight Quant Design System (RTL, Dark Mode, Zero-External-Dependency) */
@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@300;400;500;600;700;800&display=swap');

:root {
    --bg-page: #08080a;
    --bg-card: rgba(18, 18, 22, 0.75);
    --bg-card-hover: rgba(26, 26, 32, 0.85);
    --bg-surface: #111115;
    --bg-surface-elevated: #18181e;
    --border-color: rgba(255, 255, 255, 0.08);
    --border-highlight: rgba(255, 255, 255, 0.16);
    --text-primary: #f4f4f5;
    --text-muted: #a1a1aa;
    --text-dim: #71717a;
    --accent-emerald: #10b981;
    --accent-emerald-glow: rgba(16, 185, 129, 0.15);
    --accent-cyan: #06b6d4;
    --accent-cyan-glow: rgba(6, 182, 212, 0.15);
    --accent-rose: #f43f5e;
    --accent-rose-glow: rgba(244, 63, 94, 0.15);
    --accent-amber: #f59e0b;
    --accent-amber-glow: rgba(245, 158, 11, 0.15);
    --accent-violet: #8b5cf6;
    --font-sans: 'Vazirmatn', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Tahoma, sans-serif;
    --font-mono: 'Vazirmatn', 'JetBrains Mono', 'Cascadia Code', Consolas, Menlo, monospace;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;
    --transition-fast: 0.15s ease;
    --transition-smooth: 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
    direction: rtl;
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    font-variant-numeric: tabular-nums;
}

button, input, select, textarea, optgroup, option, table, th, td {
    font-family: var(--font-sans);
}

/* Typography & Monospace */
.mono {
    font-family: var(--font-mono);
    direction: ltr;
    display: inline-block;
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}

/* Responsive Tables & Generous Row Padding */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
    margin-top: 0.35rem;
}

.data-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: right;
    font-size: 0.85rem;
}

.data-table thead th {
    background: rgba(255, 255, 255, 0.035);
    color: var(--text-muted);
    font-weight: 600;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    user-select: none;
    font-size: 0.8rem;
}

.data-table tbody tr {
    transition: background-color var(--transition-fast);
}

.data-table tbody tr:hover {
    background-color: rgba(255, 255, 255, 0.025);
}

.data-table tbody td {
    padding: 0.85rem 1rem;
    vertical-align: middle;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-family: inherit;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

.data-table tbody td.mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* Order Book Level 2 Depth Styles */
.orderbook-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.orderbook-table th {
    padding: 0.5rem 0.65rem;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--text-muted);
    background: rgba(255, 255, 255, 0.02);
    border-bottom: 1px solid var(--border-color);
}

.orderbook-table td {
    padding: 0.6rem 0.65rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    position: relative;
}

.orderbook-row-idx {
    font-size: 0.72rem;
    color: var(--text-dim);
    text-align: center;
    background: rgba(255, 255, 255, 0.02);
    border-left: 1px solid var(--border-color);
    border-right: 1px solid var(--border-color);
    width: 38px;
}

.orderbook-depth-bar {
    position: absolute;
    top: 2px;
    bottom: 2px;
    opacity: 0.16;
    pointer-events: none;
    border-radius: 2px;
}

.orderbook-depth-bar.bid {
    right: 0;
    background-color: var(--accent-emerald);
}

.orderbook-depth-bar.ask {
    left: 0;
    background-color: var(--accent-rose);
}

#workbench-output {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    min-height: 380px !important;
    white-space: pre-wrap !important;
    word-break: break-all !important;
}

/* Glass Card */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    position: relative;
    transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.glass-card:hover {
    border-color: var(--border-highlight);
}

.glass-card-interactive:hover {
    background: var(--bg-card-hover);
    transform: translateY(-1px);
}

/* Header & Navigation */
.app-header {
    background: rgba(10, 10, 13, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 0.65rem 1.5rem;
}

.header-container {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.brand-section {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--text-primary);
}

.brand-logo {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, var(--accent-emerald), var(--accent-cyan));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 15px;
    color: #000;
    box-shadow: 0 0 16px var(--accent-emerald-glow);
}

.brand-title {
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
}

.brand-tag {
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    padding: 0.15rem 0.5rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

/* Nav Tabs */
.nav-tabs-wrapper {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(255, 255, 255, 0.03);
    padding: 0.25rem;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-color);
}

.nav-tab-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-full);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
}

.nav-tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.nav-tab-btn.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    font-weight: 600;
}

/* Header Status Pill */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-size: 0.8rem;
    text-decoration: none;
    transition: all var(--transition-fast);
}

.link-btn:hover {
    color: #fff;
    border-color: var(--border-highlight);
    background: rgba(255, 255, 255, 0.09);
}

.clock-badge {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text-muted);
    background: rgba(0, 0, 0, 0.3);
    padding: 0.3rem 0.65rem;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    direction: ltr;
}

/* Main Container */
.main-content {
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
    flex: 1;
}

/* Grid Layouts */
.grid-ribbon {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.25rem;
}

.grid-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.grid-3col {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
}

.grid-sidebar {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 1.25rem;
}

@media (max-width: 1024px) {
    .grid-2col, .grid-3col, .grid-sidebar {
        grid-template-columns: 1fr;
    }
}

/* Metric Display */
.metric-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.metric-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
    font-weight: 500;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    font-family: var(--font-mono);
}

.metric-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.4rem;
    font-size: 0.78rem;
    color: var(--text-dim);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.4;
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    white-space: nowrap;
    max-width: fit-content;
    vertical-align: middle;
}

.badge svg,
.badge .icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    vertical-align: middle;
}

.badge-emerald {
    background: var(--accent-emerald-glow);
    color: var(--accent-emerald);
    border-color: rgba(16, 185, 129, 0.25);
}

.badge-cyan {
    background: var(--accent-cyan-glow);
    color: var(--accent-cyan);
    border-color: rgba(6, 182, 212, 0.25);
}

.badge-amber {
    background: var(--accent-amber-glow);
    color: var(--accent-amber);
    border-color: rgba(245, 158, 11, 0.25);
}

.badge-rose {
    background: var(--accent-rose-glow);
    color: var(--accent-rose);
    border-color: rgba(244, 63, 94, 0.25);
}

.badge-neutral {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    border-color: var(--border-color);
}

/* Status Indicator Dot */
.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot-active {
    background: var(--accent-emerald);
    box-shadow: 0 0 8px var(--accent-emerald);
}

.status-dot-warn {
    background: var(--accent-amber);
    box-shadow: 0 0 8px var(--accent-amber);
}

.status-dot-inactive {
    background: var(--text-dim);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    text-decoration: none;
    outline: none;
}

.btn-primary {
    background: var(--text-primary);
    color: #000;
    font-weight: 600;
}

.btn-primary:hover {
    background: #fff;
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.2);
}

.btn-accent {
    background: linear-gradient(135deg, var(--accent-emerald), #059669);
    color: #fff;
    font-weight: 600;
}

.btn-accent:hover {
    filter: brightness(1.1);
    box-shadow: 0 0 16px var(--accent-emerald-glow);
}

.btn-subtle {
    background: rgba(255, 255, 255, 0.05);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.btn-subtle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--border-highlight);
}

.btn-danger {
    background: var(--accent-rose-glow);
    border-color: rgba(244, 63, 94, 0.3);
    color: var(--accent-rose);
}

.btn-danger:hover {
    background: var(--accent-rose);
    color: #fff;
}

.btn-sm {
    padding: 0.3rem 0.65rem;
    font-size: 0.78rem;
}

.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* Forms & Inputs */
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.85rem;
}

.form-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.form-input,
.form-select,
.form-control,
.tune-input,
.search-input-dark,
.form-select-dark,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="search"],
select.form-input,
select.form-select,
select.form-control,
select.form-select-dark {
    background: rgba(14, 18, 27, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius-sm, 6px);
    color: var(--text-primary, #f8fafc);
    font-family: var(--font-sans);
    font-size: 0.82rem;
    padding: 0.45rem 0.75rem;
    height: 36px;
    min-height: 36px;
    line-height: 1.4;
    transition: all var(--transition-fast, 0.15s ease);
    outline: none;
    box-sizing: border-box;
    vertical-align: middle;
}

.form-input:focus,
.form-select:focus,
.form-control:focus,
.tune-input:focus,
.search-input-dark:focus,
.form-select-dark:focus,
input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
input[type="search"]:focus {
    border-color: var(--accent-cyan, #06b6d4);
    background: rgba(14, 18, 27, 0.95);
    box-shadow: 0 0 0 2px var(--accent-cyan-glow, rgba(6, 182, 212, 0.15));
}

.form-input::placeholder,
.form-control::placeholder,
.tune-input::placeholder,
.search-input-dark::placeholder,
input::placeholder {
    color: var(--text-dim, #71717a);
    font-size: 0.8rem;
}

select.form-input,
select.form-select,
select.form-control,
select.form-select-dark,
select {
    cursor: pointer;
    background-color: #0d111a;
    color: var(--text-primary, #f8fafc);
}

select option {
    background-color: #0f172a;
    color: #f8fafc;
    padding: 0.5rem;
}

/* Search input container */
.search-input-container {
    position: relative;
    display: inline-flex;
    align-items: center;
    width: 100%;
}

.search-input-container .search-icon {
    position: absolute;
    right: 0.65rem;
    pointer-events: none;
    color: var(--text-dim, #71717a);
    z-index: 1;
}

.search-input-container .search-input-dark,
.search-input-container input {
    padding-right: 2rem !important;
    width: 100%;
}

/* Tune Grid & Panel styling */
.tune-panel {
    background: rgba(12, 16, 25, 0.85);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
    border-radius: var(--radius-sm, 6px);
    padding: 1rem;
    margin-bottom: 1rem;
}

.tune-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.tune-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.75rem;
    align-items: flex-end;
}

.tune-field {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.tune-field label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted, #94a3b8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-control-group {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.filter-control-item {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.filter-control-label {
    font-size: 0.8rem;
    color: var(--text-muted, #94a3b8);
    white-space: nowrap;
}

/* Filter Header & Actions Strip */
.filter-action-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.filter-action-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-inline-start: auto;
}

.filter-action-header-actions .btn {
    height: 36px !important;
    min-height: 36px !important;
    display: inline-flex;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
}

.filter-action-header-actions .btn-action-equal {
    min-width: 110px;
}

/* Parameters & Live Filters Bar */
.filter-controls-strip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.85rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 0.85rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.filter-controls-strip .filter-control-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.filter-controls-strip .form-select-dark,
.filter-controls-strip .search-input-dark,
.filter-controls-strip input {
    height: 36px !important;
    min-height: 36px !important;
    font-size: 0.82rem !important;
    box-sizing: border-box !important;
}

/* Lomino Specific Header Actions & Collapsible */
.lomino-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-inline-start: auto;
}

.lomino-header-actions .btn,
.lomino-header-actions .form-select-dark {
    height: 28px !important;
    min-height: 28px !important;
    display: inline-flex;
    align-items: center !important;
    justify-content: center !important;
    white-space: nowrap !important;
    box-sizing: border-box !important;
    font-size: 0.75rem !important;
}

.lomino-header-actions .btn-action-equal {
    min-width: 90px;
}

/* Collapsible Card System */
.card-collapsible {
    transition: all 0.2s ease;
}

.card-collapse-header {
    cursor: pointer;
    user-select: none;
}

.collapse-toggle-btn {
    background: transparent;
    border: none;
    color: var(--text-dim, #71717a);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: var(--radius-sm, 4px);
    transition: transform 0.2s ease, color 0.15s ease, background 0.15s ease;
    padding: 0;
}

.collapse-toggle-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.collapse-toggle-btn.collapsed {
    transform: rotate(180deg);
}

.collapsible-body {
    transition: opacity 0.2s ease;
}


/* Lomino Subtabs Segmented Minimal Dark UX */
.lomino-subtabs-segmented {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(0, 0, 0, 0.35);
    padding: 0.25rem;
    border-radius: var(--radius-sm, 6px);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}

.lomino-subtab-pill {
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted, #94a3b8);
    font-family: inherit;
    font-size: 0.83rem;
    font-weight: 600;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-sm, 4px);
    cursor: pointer;
    transition: all var(--transition-fast, 0.15s ease);
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    user-select: none;
    outline: none;
}

.lomino-subtab-pill:hover {
    color: var(--text-primary, #f1f5f9);
    background: rgba(255, 255, 255, 0.05);
}

.lomino-subtab-pill.active {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

/* Autocomplete Dropdown & Helper Badges */
.autocomplete-container {
    position: relative;
    width: 100%;
}

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    left: 0;
    z-index: 120;
    max-height: 240px;
    overflow-y: auto;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    border-radius: var(--radius-sm, 6px);
    box-shadow: 0 14px 35px rgba(0, 0, 0, 0.65);
}

.autocomplete-item {
    padding: 0.55rem 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background 0.15s ease;
    text-align: right;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: rgba(6, 182, 212, 0.15);
}

.tune-field-helper {
    font-size: 0.7rem;
    color: var(--text-dim, #94a3b8);
    margin-top: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 16px;
    line-height: 1.2;
}

.clickable-hint {
    cursor: pointer;
    transition: color 0.15s;
}

.clickable-hint:hover {
    color: var(--accent-cyan, #06b6d4) !important;
    text-decoration: underline;
}

/* Lomino OMS Single-Line Form Strips (Strict No-Break) */
.lomino-single-row {
    display: grid;
    gap: 0.5rem;
    align-items: flex-start;
    width: 100%;
}

.lomino-basket-row {
    grid-template-columns: minmax(160px, 2fr) minmax(95px, 1fr) minmax(120px, 1.2fr) minmax(130px, 1.3fr) minmax(115px, 1.1fr) minmax(120px, 1fr);
}

.lomino-sniper-row {
    grid-template-columns: minmax(150px, 1.6fr) minmax(95px, 1fr) minmax(95px, 1fr) minmax(105px, 1fr) minmax(115px, 1.1fr) minmax(110px, 1fr) minmax(120px, 1fr);
}

.lomino-single-row .tune-field {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    justify-content: flex-start !important;
}

.lomino-single-row .tune-field label {
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 18px !important;
    height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    display: block;
    color: var(--text-muted, #94a3b8);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box !important;
}

.lomino-single-row .tune-field input,
.lomino-single-row .tune-field select,
.lomino-single-row .tune-field .autocomplete-container,
.lomino-single-row .tune-field .autocomplete-container input,
.lomino-single-row .tune-field .btn {
    min-width: 0;
    width: 100% !important;
    height: 36px !important;
    min-height: 36px !important;
    max-height: 36px !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    font-size: 0.82rem;
}

.lomino-single-row .tune-field .btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 0.75rem !important;
    gap: 0.35rem !important;
    white-space: nowrap !important;
}

.lomino-single-row .tune-field .tune-field-helper {
    font-size: 0.7rem;
    color: var(--text-dim, #94a3b8);
    margin: 0 !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 16px !important;
    min-height: 16px !important;
    line-height: 16px !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box !important;
}

.collapsible-body.collapsed {
    display: none !important;
}

/* No Scrollbar Utility */
#workbench-presets-list,
.no-scrollbar {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

#workbench-presets-list::-webkit-scrollbar,

/* Display none strict override */
[style*="display: none"],
[style*="display:none"] {
    display: none !important;
}

#pq-symbol-search-input {
    width: 100% !important;
}

.no-scrollbar::-webkit-scrollbar {
    display: none !important;
    width: 0 !important;
    height: 0 !important;
}

/* Checkbox Modern Minimalist Dark */
input[type="checkbox"] {
    accent-color: var(--accent-cyan, #06b6d4);
    width: 15px;
    height: 15px;
    cursor: pointer;
    vertical-align: middle;
}

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-input,
.input-group .form-control {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.input-group .btn {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(255, 255, 255, 0.15);
    transition: var(--transition-fast);
    border-radius: var(--radius-full);
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    right: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-fast);
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--accent-emerald);
}

input:checked + .slider:before {
    transform: translateX(-18px);
}

/* Tables */
.table-responsive {
    overflow-x: auto;
    width: 100%;
}

.data-table {
    width: 100% !important;
    min-width: 100% !important;
    border-collapse: collapse;
    border-spacing: 0;
    font-size: 0.83rem;
}

.data-table thead,
.data-table tbody {
    width: 100% !important;
}

.data-table tr {
    width: 100% !important;
}

.data-table th {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-muted);
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    text-align: right;
    white-space: nowrap;
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    white-space: nowrap;
}

.data-table tr:hover td {
    background: rgba(255, 255, 255, 0.03);
}

.data-table-fixed {
    table-layout: fixed !important;
}

.table-center th,
.table-center td {
    text-align: center !important;
    vertical-align: middle !important;
}

#tab-instruments .data-table th,
#tab-instruments .data-table td {
    text-align: center !important;
    vertical-align: middle !important;
    padding: 1rem 1.25rem !important;
}

#tab-instruments .data-table .d-flex {
    justify-content: center !important;
}

td.mono,
th.mono {
    display: table-cell !important;
    text-align: center !important;
}

#tab-workbench {
    height: calc(100vh - 2.5rem);
    max-height: calc(100vh - 2.5rem);
    overflow: hidden;
}

/* Progress Bar */
.progress-bar-container {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

/* Skeleton Loaders */
.skeleton {
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.03) 25%, rgba(255, 255, 255, 0.08) 50%, rgba(255, 255, 255, 0.03) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
    display: inline-block;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Toast System */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    left: 1.5rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 0.75rem 1rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.65rem;
    animation: toast-in 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 380px;
}

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

/* Native Modal Dialog */
dialog.custom-modal {
    background: var(--bg-surface);
    border: 1px solid var(--border-highlight);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    padding: 1.5rem;
    max-width: 500px;
    width: 90%;
    margin: auto;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7);
    font-family: inherit;
}

dialog.custom-modal::backdrop {
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(4px);
}

/* Side Drawer */
.drawer-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 200;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-fast);
}

.drawer-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.drawer-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: 680px;
    max-width: 95vw;
    height: 100%;
    background: var(--bg-surface);
    border-right: 1px solid var(--border-color);
    box-shadow: 10px 0 40px rgba(0, 0, 0, 0.8);
    z-index: 201;
    transform: translateX(-100%);
    transition: transform var(--transition-smooth);
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.drawer-panel.open {
    transform: translateX(0);
}

.drawer-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.drawer-body {
    padding: 1.25rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    width: 100%;
    box-sizing: border-box;
}

.drawer-body img,
.drawer-body svg,
.drawer-body pre {
    max-width: 100%;
    box-sizing: border-box;
}

.drawer-body .table-responsive {
    overflow-x: hidden;
    width: 100%;
}

.drawer-body .glass-card {
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Compact Order Book (Level 2) */
.orderbook-table {
    width: 100% !important;
    min-width: 100% !important;
    table-layout: fixed !important;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    font-size: 0.78rem;
    font-variant-numeric: tabular-nums;
    margin: 0 !important;
}

.orderbook-table thead,
.orderbook-table tbody {
    width: 100% !important;
}

.orderbook-table tr {
    width: 100% !important;
    display: table-row !important;
}

.orderbook-table th {
    padding: 0.5rem 0.25rem;
    font-size: 0.72rem;
    font-weight: 600;
    text-align: center !important;
    vertical-align: middle !important;
    background: rgba(255, 255, 255, 0.03);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.orderbook-table td {
    padding: 0.45rem 0.25rem;
    text-align: center !important;
    vertical-align: middle !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    position: relative;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.orderbook-table td span.mono {
    display: inline-block;
    text-align: center;
    width: 100%;
}

.table-center th,
.table-center td {
    text-align: center !important;
    vertical-align: middle !important;
}

.table-center td > span,
.table-center td > div {
    margin-left: auto;
    margin-right: auto;
}

.orderbook-row-idx {
    width: 30px;
    max-width: 30px;
    background: rgba(255, 255, 255, 0.04);
    font-weight: 700;
    color: var(--text-muted);
}

.orderbook-depth-bar {
    position: absolute;
    top: 2px;
    bottom: 2px;
    opacity: 0.18;
    pointer-events: none;
    border-radius: 2px;
}

.orderbook-depth-bar.bid {
    right: 0;
    background: var(--accent-emerald);
}

.orderbook-depth-bar.ask {
    left: 0;
    background: var(--accent-rose);
}

/* Workbench Elements */
#workbench-send-btn {
    white-space: nowrap !important;
    min-width: 150px !important;
    min-height: 46px !important;
    height: 46px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 0.92rem !important;
    font-weight: 600 !important;
    flex-shrink: 0 !important;
    padding: 0 1.5rem !important;
}

#workbench-url-input {
    height: 46px !important;
    min-height: 46px !important;
    font-size: 0.9rem !important;
}

#workbench-output {
    width: 100%;
    box-sizing: border-box;
    white-space: pre-wrap;
    word-break: break-all;
}

/* Virtual Keypad Grid & Input Flash */
.virtual-keypad-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    width: 100%;
    max-width: 220px;
}

.virtual-keypad-grid .keypad-btn {
    height: 38px;
    min-width: unset;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    user-select: none;
}

.input-active-flash {
    border-color: var(--accent-cyan) !important;
    box-shadow: 0 0 0 3px var(--accent-cyan-glow) !important;
    transition: all 0.15s ease;
}

/* Generous Information Rows */
.info-row-spaced {
    padding: 0.85rem 1.15rem;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    transition: background var(--transition-fast);
}

.info-row-spaced:hover {
    background: rgba(255, 255, 255, 0.04);
}

/* Alert Banner */
.alert-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.25rem;
    border: 1px solid transparent;
}

.alert-amber {
    background: rgba(245, 158, 11, 0.08);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--accent-amber);
}

/* Tab Panels */
.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
    animation: tab-fade-in 0.2s ease;
}

@keyframes tab-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Utilities */
.d-flex { display: flex; }
.flex-column { flex-direction: column; }
.justify-between { justify-content: space-between; }
.align-center { align-items: center; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.w-100 { width: 100%; }
.text-dim { color: var(--text-dim); }
.text-muted { color: var(--text-muted); }
.text-white { color: #fff; }
.text-emerald { color: var(--accent-emerald); }
.text-cyan { color: var(--accent-cyan); }
.text-rose { color: var(--accent-rose); }
.text-amber { color: var(--accent-amber); }
.text-center { text-align: center; }
.cursor-pointer { cursor: pointer; }
.border-top { border-top: 1px solid var(--border-color); }
.border-bottom { border-bottom: 1px solid var(--border-color); }

/* ==========================================================================
   Vertical Sidebar Layout & Minimal Dark Navigation System
   ========================================================================== */
.app-layout {
    display: flex;
    min-height: 100vh;
    background: var(--bg-base, #080b12);
    color: var(--text-primary, #f8fafc);
}

.app-sidebar {
    width: 240px;
    min-width: 240px;
    max-width: 240px;
    background: #0b0f19;
    border-left: 1px solid var(--border-color, #1e293b);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1rem 0.75rem;
    box-sizing: border-box;
    user-select: none;
}

.sidebar-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color, #1e293b);
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: #fff;
}

.sidebar-brand-title {
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.sidebar-brand-tag {
    font-size: 0.68rem;
    color: var(--text-muted, #64748b);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-vertical-tabs {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
}

.nav-vertical-btn {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.55rem 0.75rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius-sm, 6px);
    color: var(--text-muted, #94a3b8);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    text-align: right;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: all var(--transition-fast, 0.15s ease);
    text-decoration: none;
    box-sizing: border-box;
    line-height: 1.3;
}

.nav-vertical-btn span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.nav-vertical-btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.nav-vertical-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

.nav-vertical-btn.active {
    color: #fff;
    background: rgba(6, 182, 212, 0.12);
    border-color: rgba(6, 182, 212, 0.35);
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color, #1e293b);
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    width: 100%;
    box-sizing: border-box;
}

.sidebar-footer .nav-vertical-btn,
.sidebar-footer .link-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.78rem;
    box-sizing: border-box;
    white-space: nowrap;
    border: 1px solid rgba(255, 255, 255, 0.05);
    background: rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-sm, 6px);
    color: var(--text-muted, #94a3b8);
}

.sidebar-footer .nav-vertical-btn:hover,
.sidebar-footer .link-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}

.sidebar-footer .nav-vertical-btn svg:last-child,
.sidebar-footer .link-btn svg:last-child {
    margin-right: auto;
}

.sidebar-footer .clock-badge {
    text-align: center;
    font-size: 0.78rem;
    padding: 0.4rem;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-sm, 6px);
}

.main-viewport {
    flex: 1;
    min-width: 0;
    padding: 1.25rem 1.5rem;
    max-width: calc(100vw - 240px);
    box-sizing: border-box;
}

@media (max-width: 1024px) {
    .app-layout {
        flex-direction: column;
    }
    .app-sidebar {
        width: 100%;
        max-width: 100%;
        height: auto;
        position: relative;
        border-left: none;
        border-bottom: 1px solid var(--border-color);
    }
    .main-viewport {
        max-width: 100%;
    }
}
