/* 
  AIOps Dashboard - Zynork Enterprise Light
  Theme: Zynork Operations
*/

:root {
    /* Zynork Enterprise Theme */
    --bg-app: #f6f7f9;
    /* Warm gray content area */
    --bg-sidebar: #0e1015;
    /* Dark Zynork sidebar */
    --bg-header: #ffffff;
    /* White operations header */

    /* brand (from ZYNORK) */
    --red: #D81030;
    --red-600: #B60D28;
    --red-tint: #FDECEE;
    --ink: #16181D;
    --ink-2: #3A3F4A;
    --slate: #5B6472;
    --slate-2: #8A909C;
    --line: #E6E8EC;
    --line-2: #EEF0F3;
    --bg: #F6F7F9;
    --card: #FFFFFF;
    --card-head: #FBFBFC;
    --panel: #0E1015;
    --panel-2: #15181F;
    --ok: #1FA463;
    --font: 'IBM Plex Sans', system-ui, sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, monospace;

    /* Surface colors for cards/panels */
    --bg-surface: #ffffff;
    --bg-surface-raised: #ffffff;

    /* Glass Panel */
    --bg-panel: rgba(255, 255, 255, 0.82);
    --glass-border: 1px solid rgba(255, 255, 255, 0.65);
    --glass-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);

    /* Borders */
    --border-subtle: 1px solid rgba(203, 213, 225, 0.7);
    --border-dark: 1px solid #334155;

    /* Text */
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-on-dark: #f1f5f9;
    --text-muted-dark: #94a3b8;

    /* Accents */
    --accent-blue: #d81030;
    --accent-purple: #b60d28;
    --accent-cyan: #d81030;
    --accent-selected-bg: rgba(216, 16, 48, 0.08);

    /* Functional Colors */
    --status-success: #10b981;
    --status-warning: #f59e0b;
    --status-error: #ef4444;

    /* Shadows — deeper for card layering over tinted background */
    --shadow-card: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow-hover: 0 10px 20px -4px rgba(15, 23, 42, 0.08), 0 4px 8px -2px rgba(15, 23, 42, 0.04);
    --shadow-levitate: 0 20px 30px -6px rgba(15, 23, 42, 0.10), 0 10px 10px -5px rgba(15, 23, 42, 0.04);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;

    --z-sidebar: 300;
    --z-header: 250;

    /* Layout dimensions — consumed by Grafana iframe pages */
    --layout-header-h: 48px;
    --layout-sidebar-w: 213px;
    --layout-sidebar-collapsed-w: 60px;
}

/* Troubleshoot final outcome — uses platform theme tokens instead of dark-only
   Tailwind utilities so the card remains readable in the Zynork light theme. */
.final-outcome-card {
    overflow: hidden;
    color: var(--text-primary, var(--ink, #16181d));
    background: var(--bg-surface, var(--card, #ffffff));
    border: 1px solid var(--line, #e6e8ec);
    border-radius: var(--radius-md, 12px);
    box-shadow: var(--shadow-card, 0 1px 3px rgba(15, 23, 42, 0.08));
}

.final-outcome-card__header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 16px 18px;
    background: var(--card-head, #fbfbfc);
    border-bottom: 1px solid var(--line, #e6e8ec);
}

.final-outcome-card__status-icon {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    color: var(--status-success, var(--ok, #059669));
    background: rgba(5, 150, 105, 0.1);
    border-radius: 50%;
}

.final-outcome-card--pending .final-outcome-card__status-icon {
    color: var(--status-warning, #d97706);
    background: rgba(217, 119, 6, 0.1);
}

.final-outcome-card--failed .final-outcome-card__status-icon {
    color: var(--status-error, #dc2626);
    background: rgba(220, 38, 38, 0.1);
}

.final-outcome-card__eyebrow {
    margin-bottom: 3px;
    color: var(--text-secondary, var(--slate, #5b6472));
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.final-outcome-card__status {
    color: var(--text-primary, var(--ink, #16181d));
    font-size: 15px;
    font-weight: 700;
    line-height: 1.45;
}

.final-outcome-card__body {
    padding: 4px 18px;
    background: var(--bg-surface, var(--card, #ffffff));
}

.final-outcome-card__section {
    padding: 14px 0;
    border-bottom: 1px solid var(--line-2, #eef0f3);
}

.final-outcome-card__section:last-child {
    border-bottom: 0;
}

.final-outcome-card__section h4 {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 9px;
    color: var(--text-secondary, var(--slate, #5b6472));
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

.final-outcome-card__section h4 i {
    color: var(--brand-primary, var(--red, #d81030));
}

.final-outcome-card__section ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.final-outcome-card__section li {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0;
    color: var(--text-primary, var(--ink-2, #3a3f4a));
    font-size: 14px;
    line-height: 1.5;
}

.final-outcome-card__section li > i {
    flex: 0 0 auto;
    margin-top: 4px;
    color: var(--status-success, var(--ok, #059669));
    font-size: 12px;
}

.final-outcome-card__section:first-child li > i {
    color: var(--brand-primary, var(--red, #d81030));
}

.final-outcome-card__risk.has-risk li > i,
.final-outcome-card__risk.has-risk h4 i {
    color: var(--status-warning, #d97706);
}

.final-outcome-card__reference-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    width: fit-content;
    padding: 8px 11px;
    color: var(--brand-primary, var(--red, #d81030));
    background: var(--brand-light, var(--red-tint, #fdecee));
    border: 1px solid rgba(216, 16, 48, 0.2);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: border-color 0.15s ease, background 0.15s ease;
}

.final-outcome-card__reference-link:hover {
    color: var(--brand-primary, var(--red, #d81030));
    background: rgba(216, 16, 48, 0.12);
    border-color: var(--brand-primary, var(--red, #d81030));
    text-decoration: none;
}

.final-outcome-card__reference-link .fa-arrow-right {
    font-size: 10px;
}

.final-outcome-card__feedback-slot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 48px;
    padding: 10px 18px;
    color: var(--text-secondary, var(--slate, #5b6472));
    background: var(--card-head, #fbfbfc);
    border-top: 1px solid var(--line, #e6e8ec);
}

.final-outcome-card__feedback-slot:empty {
    display: none;
}

.final-outcome-card__feedback-prompt {
    font-size: 12px;
    font-weight: 600;
}

.final-outcome-card__feedback-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.final-outcome-card__feedback-button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    color: var(--text-secondary, var(--slate, #5b6472));
    background: var(--bg-surface, var(--card, #ffffff));
    border: 1px solid var(--line, #e6e8ec);
    border-radius: 7px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.final-outcome-card__feedback-button:hover {
    color: var(--brand-primary, var(--red, #d81030));
    background: var(--brand-light, #fdecee);
    border-color: var(--brand-primary, var(--red, #d81030));
}

@media (max-width: 640px) {
    .final-outcome-card__feedback-slot {
        align-items: flex-start;
        flex-direction: column;
    }
}

/* Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* Custom scrollbar for the content areas */
.main-content::-webkit-scrollbar,
.runbooks-main::-webkit-scrollbar {
    width: 6px;
}

.main-content::-webkit-scrollbar-track,
.runbooks-main::-webkit-scrollbar-track {
    background: transparent;
}

.main-content::-webkit-scrollbar-thumb,
.runbooks-main::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 3px;
}

.main-content::-webkit-scrollbar-thumb:hover,
.runbooks-main::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.55);
}

body {
    font-family: 'Adobe Clean', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    /* Fallback stack */
    background-color: var(--bg-sidebar);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    line-height: normal;
    font-size: 14px;
}

/* Shared form control styling for all template fields that use .input-field */
.input-field {
    border: var(--border-subtle);
    background: var(--bg-surface-raised);
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.input-field::placeholder {
    color: var(--text-secondary);
}

.input-field:focus {
    border-color: var(--accent-blue);
    box-shadow: 0 0 0 3px rgba(216, 16, 48, 0.12);
    outline: none;
}

/* Rules form specific overrides to ensure consistent theme borders */
#ruleForm .input-field,
#ruleForm input[type="text"],
#ruleForm input[type="number"],
#ruleForm input[type="search"],
#ruleForm input[type="email"],
#ruleForm textarea,
#ruleForm select {
    border: var(--border-subtle) !important;
    background: var(--bg-surface-raised) !important;
    color: var(--text-primary) !important;
    border-radius: var(--radius-sm) !important;
}

#ruleForm .input-field:focus,
#ruleForm input:focus,
#ruleForm textarea:focus,
#ruleForm select:focus {
    border-color: var(--accent-blue) !important;
    box-shadow: 0 0 0 3px rgba(216, 16, 48, 0.12) !important;
    outline: none !important;
}

#ruleForm label {
    color: var(--text-secondary);
}

/* Modal card / New Rule styling to match theme */
.card {
    background: var(--bg-panel) !important;
    border: var(--glass-border) !important;
    box-shadow: var(--shadow-card) !important;
    color: var(--text-primary) !important;
}

.card .flex.items-center.justify-between.p-6.pb-0.flex-shrink-0,
.card .modal-header {
    background: transparent !important;
    padding: 1rem 1.5rem !important;
}

.card h3#modalTitle,
.card .modal-title {
    color: var(--text-primary) !important;
}

.card .info-tooltip-icon {
    background: rgba(15,23,42,0.06);
    color: var(--text-secondary);
    border-radius: 3px;
    padding: 2px 6px;
    font-size: 11px;
}

.card .border-t {
    border-color: rgba(15,23,42,0.06) !important;
}

.card .btn-primary {
    background: #0e1015 !important;
    border-color: #0e1015 !important;
    color: #fff !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 5px !important;
    text-transform: none !important;
    box-shadow: 0 2px 6px rgba(14, 16, 21, 0.25) !important;
}

.card .btn-primary:hover {
    background: #000000 !important;
    border-color: #000000 !important;
    box-shadow: 0 4px 12px rgba(14, 16, 21, 0.35) !important;
}

.card .btn-secondary {
    background: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #475569 !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    border-radius: 5px !important;
    text-transform: none !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

.card .btn-secondary:hover {
    background: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #1e293b !important;
}

/* Checkbox styling */
.form-checkbox {
    width: 18px;
    height: 18px;
    border: 1px solid rgba(15,23,42,0.12);
    background: #fff;
    accent-color: var(--accent-blue);
}

/* Ensure modal footer blends with dark header area when present */
.card .flex.justify-end.space-x-2.p-6.border-t {
    background: rgba(15,23,42,0.04) !important;
}

/* Footer button alignment and sizing for modal */
.card .modal-footer,
.card .flex.justify-end.space-x-2.p-6.border-t {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 0.5rem !important;
    padding: 1rem 1.5rem !important;
}

.card .modal-footer .btn-primary,
.card .modal-footer .btn-secondary,
.card .flex.justify-end .btn-primary,
.card .flex.justify-end .btn-secondary {
    min-height: 35px !important;
    padding: 8px 16px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Make both buttons visually aligned and same baseline */
.card .btn-primary {
    border-radius: 5px !important;
    line-height: 1.2 !important;
}

.card .btn-secondary {
    border-radius: 5px !important;
    line-height: 1.2 !important;
}

/* Ensure both modal footer buttons share identical box model and visual weight */
.card .btn-primary,
.card .btn-secondary {
    box-shadow: none !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    vertical-align: middle !important;
    font-size: 13px !important;
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}

/* Make secondary button visually consistent (white surface with subtle border) */
.card .btn-secondary {
    background: #ffffff !important;
    color: #475569 !important;
    border: 1px solid #e2e8f0 !important;
}

/* Footer baseline alignment fix: remove extra internal offsets */
.card .flex.justify-end.space-x-2.p-6.border-t button,
.card .modal-footer button {
    margin: 0 !important;
}

/* Strong baseline/height normalization to ensure visual alignment */
.card .flex.justify-end.space-x-2.p-6.border-t button,
.card .modal-footer button,
.card .btn-primary,
.card .btn-secondary {
    box-sizing: border-box !important;
    height: 35px !important;
    min-height: 35px !important;
    line-height: 1.2 !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
}

/* Keep internal centering while removing conflicting padding */
.card .btn-primary > span,
.card .btn-secondary > span {
    display: inline-block;
    padding: 0 12px;
}

/* Fallback if buttons have text directly (no span) */
.card .btn-primary,
.card .btn-secondary {
    padding-left: 16px !important;
    padding-right: 16px !important;
}

/* Ensure modal content background aligns with footer when using dark header/footer */
.card {
    background-clip: padding-box;
}

/* Layout Structure */
.app-container {
    display: grid;
    grid-template-columns: var(--layout-sidebar-w) 1fr 0px;
    /* Sidebar | Main | Chat (collapsed) */
    grid-template-rows: 48px 1fr;
    height: 100vh;
    width: 100vw;
    /* Force full width */
    background: var(--bg-sidebar);
    transition: grid-template-columns 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Chat Open State */
.app-container.ai-open {
    grid-template-columns: var(--layout-sidebar-w) 1fr var(--ai-helper-width);
}



/* Collapsed Sidebar State */
.app-container.collapsed {
    grid-template-columns: var(--layout-sidebar-collapsed-w) 1fr 0px;
}

/* Collapsed Sidebar + Chat Open */
.app-container.collapsed.ai-open {
    grid-template-columns: var(--layout-sidebar-collapsed-w) 1fr var(--ai-helper-width);
}

/* Sidebar */
.sidebar {
    grid-row: 1 / -1;
    /* Sidebar spans ALL rows including header row */
    grid-column: 1;
    /* Always column 1 */
    background: var(--bg-sidebar);
    border-right: none;
    padding: 0;
    display: flex;
    flex-direction: column;
    z-index: var(--z-sidebar);
    position: relative;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    white-space: nowrap;
    scrollbar-width: none;
    /* Firefox */
}

.sidebar::-webkit-scrollbar {
    width: 0px;
    /* Chrome/Safari/Opera */
    background: transparent;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    /* Ensure left alignment */
    height: 48px;
    padding: 8px 12px;
    /* Balanced padding */
    background: var(--bg-sidebar);
    flex-shrink: 0;
    width: 100%;
}

.sidebar-logo-img {
    height: 100%;
    width: 100%;
    max-height: 50px;
    /* Slightly taller limit */
    max-width: 100%;
    /* Remove tight 140px restriction */
    object-fit: contain;
    object-position: left center;
    /* Snap to left edge */
    transition: all 0.2s ease;
}

.logo-icon {
    display: none;
    /* Hidden by default */
}

.app-container.collapsed .sidebar-logo {
    padding: 0;
}

.app-container.collapsed .logo-full {
    display: none;
}

.app-container.collapsed .logo-icon {
    display: block;
    max-width: 40px;
    max-height: 40px;
    object-fit: contain;
    padding: 4px;
}

/* Sidebar Header Group */
.sidebar-header {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-muted-dark);
    font-weight: 600;
    letter-spacing: 0.5px;
    padding: 16px 20px 8px 20px;
    opacity: 0.7;
    margin-top: 4px;
}

.app-container.collapsed .sidebar-header {
    display: none;
}

/* Header */
.top-header {
    grid-column: 2;
    /* Header starts at column 2, after sidebar */
    grid-row: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0;
    /* Changed to 0, managing gap via padding/margins */
    padding: 0 5px;
    /* Minimal horizontal padding */
    height: 48px;
    max-height: 48px;
    border-bottom: none;
    /* Border removed per request */
    background: var(--bg-header);
    z-index: var(--z-header);
    color: var(--text-on-dark);
    overflow: visible !important;
    /* Forces dropdown visibility */
}

.header-logo-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text-on-dark);
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow: hidden;
    white-space: nowrap;
    width: var(--layout-sidebar-w);
    /* Matches Expanded Sidebar Width */
    padding-left: 12px;
    /* Small padding for expanded state */
    flex-shrink: 0;
    height: 100%;
}

/* Collapsed Header Logo Area */
.app-container.collapsed .header-logo-area {
    width: var(--layout-sidebar-collapsed-w);
    /* Matches Collapsed Sidebar Width */
    padding-left: 0;
    justify-content: center;
    gap: 0;
}

/* Logo Icon in Header (Always visible) */
.header-logo-area .logo-icon {
    width: 35px;
    height: 35px;
    background: var(--accent-blue);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 16px;
    flex-shrink: 0;
}

.logo-text {
    transition: opacity 0.2s ease, max-width 0.3s ease, transform 0.3s ease;
    opacity: 1;
    max-width: 200px;
    /* Arbitrary large width */
    transform: translateX(0);
}

.app-container.collapsed .logo-text {
    opacity: 0;
    max-width: 0;
    transform: translateX(-10px);
    margin-left: 0;
}

/* Removed old logo-area and sidebarToggle styles */

/* Old #sidebarToggle styles removed */

/* Sidebar Footer (New Class) */
.sidebar-footer {
    border-top: 1px solid #333;
    /* Optional separator */
    margin-top: auto;
    display: flex;
    flex-direction: column;
    padding: 8px;
    /* Default */
}

.app-container.collapsed .sidebar-footer {
    padding: 8px 0 !important;
    align-items: center !important;
    width: 100%;
}

/* Audit Page & Runbooks Styles */

/* Tabs */
.rb-tabs {
    display: flex;
    gap: 24px;
    border-bottom: 1px solid rgba(203, 213, 225, 0.6);
    margin-bottom: 24px;
}

.rb-tab {
    background: none;
    border: none;
    padding: 12px 4px;
    font-size: 14px;
    font-weight: 500;
    color: #64748b;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.rb-tab:hover {
    color: #1e293b;
}

.rb-tab.active {
    color: #d81030;
    border-bottom-color: #d81030;
    font-weight: 600;
}

.rb-tab svg {
    width: 20px;
    height: 20px;
}

/* Tables */
.rb-table-container {
    background: var(--bg-surface);
    border: 1px solid rgba(203, 213, 225, 0.5);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow-card);
}

.rb-table {
    width: 100%;
    border-collapse: collapse;
}

.rb-table th {
    padding: 12px 24px;
    background: rgba(241, 245, 249, 0.7);
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    border-bottom: 1px solid rgba(203, 213, 225, 0.5);
}

.rb-table td {
    padding: 16px 24px;
    border-bottom: 1px solid #f1f5f9;
    font-size: 14px;
    color: #0f172a;
    vertical-align: middle;
}

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

.sidebar-toggle-wrapper {
    display: flex;
    width: 100%;
    justify-content: center;
    align-items: center;
    gap: 6px;
    padding: 0 4px;
    box-sizing: border-box;
}

.app-container.collapsed .sidebar-toggle-wrapper {
    justify-content: center;
    flex-direction: column;
    width: 100%;
    padding: 0;
    gap: 4px;
}

.app-container.collapsed .sidebar-toggle-wrapper .sidebar-toggle-btn {
    width: 28px;
    height: 28px;
}

.app-container.collapsed .sidebar-toggle-wrapper .sidebar-toggle-btn svg {
    width: 14px;
    height: 14px;
}

.sidebar-toggle-btn {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted-dark);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-toggle-btn:hover {
    background: rgba(216, 16, 48, 0.15);
    color: white;
    border-color: rgba(216, 16, 48, 0.3);
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(216, 16, 48, 0.2);
}

.sidebar-toggle-btn:active {
    transform: scale(0.95);
}

.sidebar-lock-btn.locked {
    background: rgba(216, 16, 48, 0.2);
    border-color: rgba(216, 16, 48, 0.4);
    color: #f5c2ca;
}

.sidebar-lock-btn.sidebar-lock-hidden {
    display: none !important;
}

.sidebar-toggle-btn svg {
    width: 18px;
    height: 18px;
    stroke-width: 2.5px;
}

/* Nav Menu */
.nav-menu {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 0 8px;
}

.app-container.collapsed .nav-menu {
    padding: 0 8px !important;
    align-items: center !important;
    width: 100%;
}

/* Nav Item */
.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--text-muted-dark);
    transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    cursor: pointer;
    font-weight: 400;
    border: none;
    height: 36px;
    justify-content: flex-start;
    width: 100%;
    text-decoration: none;
}

.app-container.collapsed .nav-item:not(.submenu-item) {
    width: 32px !important;
    padding: 8px 7px !important;
    gap: 0 !important;
    justify-content: center !important;
}

.app-container.collapsed .nav-item svg,
.app-container.collapsed .nav-item i {
    margin: 0 !important;
}

.app-container.collapsed .submenu-toggle-icon {
    display: none !important;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-on-dark);
    box-shadow: none;
    text-shadow: none;
    border: none;
}

.nav-item.active {
    background: rgba(216, 16, 48, 0.15);
    color: white;
    font-weight: 600;
    box-shadow: 0 0 8px rgba(216, 16, 48, 0.25);
    border: 1px solid rgba(216, 16, 48, 0.3);
}

/* Sidebar Icons */
.nav-item svg,
.nav-item i {
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0;
    transition: color 0.2s;
    color: #a0a0a0;
    stroke: currentColor;
    fill: none;
}

.nav-item .feather-grid,
.nav-item i[data-feather="grid"] {
    color: #d81030 !important;
    stroke: #d81030 !important;
}

.nav-item .feather-activity,
.nav-item i[data-feather="activity"] {
    color: #10b981 !important;
    stroke: #10b981 !important;
}

.nav-item .feather-alert-circle,
.nav-item i[data-feather="alert-circle"] {
    color: #ef4444 !important;
    stroke: #ef4444 !important;
}

.nav-item .feather-zap,
.nav-item i[data-feather="zap"] {
    color: #8b5cf6 !important;
    stroke: #8b5cf6 !important;
}

.nav-item .feather-layers,
.nav-item i[data-feather="layers"] {
    color: #f59e0b !important;
    stroke: #f59e0b !important;
}

.nav-item .feather-file-text,
.nav-item i[data-feather="file-text"] {
    color: #d81030 !important;
    stroke: #d81030 !important;
}

.nav-item .feather-settings,
.nav-item i[data-feather="settings"] {
    color: #94a3b8 !important;
    stroke: #94a3b8 !important;
}

.nav-item.active svg,
.nav-item.active i {
    color: white !important;
    stroke: white !important;
}

.nav-item:not(.active):hover svg,
.nav-item:not(.active):hover i {
    color: #f5c2ca !important;
    stroke: #f5c2ca !important;
}

/* Nav Text */
.nav-text {
    white-space: nowrap;
    overflow: hidden;
    transition: opacity 0.2s ease, max-width 0.3s ease;
}

.app-container.collapsed .nav-text {
    opacity: 0;
    max-width: 0;
    display: none;
}

/* Submenu */
.submenu {
    list-style: none;
    padding-left: 0;
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out, opacity 0.3s ease;
    opacity: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    background: var(--bg-sidebar);
    border-radius: var(--radius-md);
    margin-top: 0.25rem;
    border-left: 2px solid #444;
}

.nav-group.open .submenu {
    max-height: 500px;
    opacity: 1;
    padding-bottom: 8px;
}

.submenu-toggle-icon {
    transition: transform 0.3s ease;
}

.nav-group.open .submenu-toggle-icon {
    transform: rotate(90deg);
}

.submenu-item {
    margin-left: 12px;
    font-size: 0.9em;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
}

.submenu-item:hover {
    border-left-color: var(--accent-blue);
    background: rgba(255, 255, 255, 0.05);
}

.submenu-item:hover i {
    color: white;
}

.submenu-item i {
    width: 14px;
    height: 14px;
    color: var(--text-muted-dark);
}

/* Collapsed Sidebar Submenu Hover */
.app-container.collapsed .nav-group {
    position: relative;
    width: 32px;
}

.app-container.collapsed .nav-group .submenu {
    display: flex !important;
    flex-direction: column;
    position: absolute;
    left: calc(100% + 18px) !important;
    transform: none;
    top: 0;
    min-width: 200px;
    background: var(--bg-sidebar);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-left: none;
    box-shadow: 12px 6px 18px -8px rgba(0, 0, 0, 0.55);
    border-radius: 0 8px 8px 0;
    z-index: var(--z-sidebar);
    max-height: none !important;
    padding: 8px 0;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: auto;
    transition: opacity 0.15s ease 0.3s, visibility 0s linear 0.3s;
}

.app-container.collapsed .nav-group:hover .submenu,
.app-container.collapsed .nav-group .submenu:hover {
    opacity: 1 !important;
    visibility: visible;
    transition-delay: 0s;
}

.app-container.collapsed .nav-group .submenu::before {
    content: '';
    position: absolute;
    left: -6px;
    top: 0;
    width: 6px;
    height: 100%;
    background: transparent;
}

.app-container.collapsed .nav-group:hover .submenu .submenu-item {
    display: flex !important;
    align-items: center;
    gap: 10px;
    padding: 10px 16px !important;
    width: auto !important;
    min-width: 180px !important;
    box-sizing: border-box;
    cursor: pointer;
    transition: background 0.2s ease;
    justify-content: flex-start !important;
}

.app-container.collapsed .nav-group:hover .submenu .submenu-item:hover {
    background: rgba(216, 16, 48, 0.15);
}

.app-container.collapsed .nav-group:hover .submenu .nav-text {
    display: inline-block !important;
    opacity: 1 !important;
    width: auto !important;
    max-width: none !important;
    font-size: 13px;
    color: #e2e8f0;
    white-space: nowrap;
}

.app-container.collapsed .sidebar {
    overflow: visible;
}

/* Global Button Border Radius Override */
button,
.btn,
.btn-primary,
.btn-secondary,
[class*="-btn"],
[class^="btn-"],
input[type="button"],
input[type="submit"] {
    border-radius: 5px !important;
}

/* Exceptions for rounded-full buttons */
button.rounded-full,
.rounded-full {
    border-radius: 9999px !important;
}

/* ===== Time Range Picker (header widget) ===== */
/* Defaults work for dark-header themes (aftab, olive_leaf, default) */
.time-range-picker {
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.20);
}
.time-range-select {
    color: rgba(255, 255, 255, 0.85);
}
.time-range-select:hover { color: #ffffff; }
.time-range-select option {
    background: #1a1a2e;
    color: #e2e8f0;
}
.time-range-icon { color: rgba(255, 255, 255, 0.55); }
.time-range-divider { background: rgba(255, 255, 255, 0.20); }
.time-range-refresh { color: rgba(255, 255, 255, 0.65); }
.time-range-refresh:hover { color: #ffffff; background: rgba(255, 255, 255, 0.10); }

/* ===== Slate Color Polyfill (Tailwind v2 lacks slate) ===== */
/* These base values work for all themes; individual themes override as needed */
.text-slate-900 { color: #0f172a; }
.text-slate-800 { color: #1e293b; }
.text-slate-700 { color: #334155; }
.text-slate-600 { color: #475569; }
.text-slate-500 { color: #64748b; }
.text-slate-400 { color: #94a3b8; }
.text-slate-300 { color: #cbd5e1; }
.text-slate-200 { color: #e2e8f0; }
.text-slate-100 { color: #f1f5f9; }
.bg-slate-50  { background-color: #f8fafc; }
.bg-slate-100 { background-color: #f1f5f9; }
.bg-slate-200 { background-color: #e2e8f0; }
.bg-slate-800 { background-color: #1e293b; }
.bg-slate-900 { background-color: #0f172a; }
.border-slate-100 { border-color: #f1f5f9; }
.border-slate-200 { border-color: #e2e8f0; }
.border-slate-300 { border-color: #cbd5e1; }

/* hover: slate utilities used by alert detail */
.hover\:bg-slate-50:hover  { background-color: #f8fafc; }
.hover\:bg-slate-100:hover { background-color: #f1f5f9; }
.hover\:border-slate-300:hover { border-color: #cbd5e1; }
.hover\:text-slate-600:hover { color: #475569; }
.hover\:text-slate-700:hover { color: #334155; }

/* End of Base Layout Styles */
/* ==========================================
   Global Quick Navigation (header search)
   ========================================== */
.search-bar.quick-nav {
    position: relative;
}

.quick-nav-results {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.18);
    overflow: hidden;
    z-index: 1200;
}

.quick-nav-results.hidden {
    display: none;
}

.quick-nav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 9px 14px;
    cursor: pointer;
    font-size: 13px;
}

.quick-nav-item:hover,
.quick-nav-item.active {
    background: #fff7f8;
}

.quick-nav-label {
    color: #1e293b;
    font-weight: 500;
}

.quick-nav-item:hover .quick-nav-label,
.quick-nav-item.active .quick-nav-label {
    color: #8f1024;
}

.quick-nav-group {
    color: #94a3b8;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
}

.quick-nav-empty {
    padding: 12px 14px;
    font-size: 13px;
    color: #94a3b8;
}

/* Dark theme (jackson) adjustments */
[data-theme="jackson"] .quick-nav-results {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="jackson"] .quick-nav-item:hover,
[data-theme="jackson"] .quick-nav-item.active {
    background: rgba(216, 16, 48, 0.18);
}

[data-theme="jackson"] .quick-nav-label {
    color: #e2e8f0;
}

[data-theme="jackson"] .quick-nav-item:hover .quick-nav-label,
[data-theme="jackson"] .quick-nav-item.active .quick-nav-label {
    color: #f5c2ca;
}

/* Troubleshoot chat: "Stopped" annotation appended to a cancelled AI response */
.ts-stopped-note {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin-top: 8px;
    padding: 2px 8px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    font-size: 11px;
    font-style: italic;
}

/* ==========================================
   ZYNORK Header Layout & Styling
   ========================================== */
.top-header {
    height: 66px !important;
    max-height: 66px !important;
    padding: 0 24px !important;
    background: #ffffff !important;
    border-bottom: 1px solid var(--line) !important;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    z-index: var(--z-header);
    color: var(--ink);
    overflow: visible !important;
}

.app-container {
    grid-template-rows: 66px 1fr !important;
}

/* Header Info / Dashboard Title */
.header-info {
    display: flex;
    align-items: center;
    gap: 12px;
    white-space: nowrap;
}

.header-title-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
}

.gauge {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: linear-gradient(135deg, #E5324B, #B60D28);
    display: grid;
    place-items: center;
    flex: none;
}

.gauge svg {
    width: 17px;
    height: 17px;
    color: #fff;
}

.header-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -.01em;
    color: var(--ink);
    margin: 0 !important;
}

.feed-ok {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 14px;
    font-weight: 600;
    color: var(--ink-2);
}

.feed-ok::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--ok);
    box-shadow: 0 0 0 3px rgba(31, 164, 99, 0.18);
}

.header-divider {
    color: var(--line);
    font-size: 18px;
}

.header-breadcrumbs {
    font-size: 15px;
    color: var(--slate);
    font-weight: 500;
    display: flex;
    align-items: center;
}

/* Global Search Box (styled like ZYNORK search) */
.search-bar.quick-nav {
    flex: 1;
    max-width: 560px;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 40px;
    padding: 0 14px;
    background: #FBFBFC !important;
    border: 1px solid var(--line) !important;
    border-radius: 11px;
    color: var(--slate-2);
}

.search-bar.quick-nav svg,
.search-bar.quick-nav i {
    width: 17px;
    height: 17px;
    color: var(--slate-2) !important;
}

.search-bar.quick-nav input {
    border: 0 !important;
    outline: 0 !important;
    background: transparent !important;
    font-family: var(--font) !important;
    font-size: 14px !important;
    width: 100% !important;
    color: var(--ink) !important;
    box-shadow: none !important;
}

.search-bar.quick-nav input:focus {
    outline: none !important;
    box-shadow: none !important;
    border: none !important;
}

.kbd-shortcut {
    font-family: var(--mono) !important;
    font-size: 12px !important;
    color: var(--slate) !important;
    border: 1px solid var(--line) !important;
    border-radius: 5px !important;
    padding: 1px 7px !important;
    background: #fff !important;
}

/* Actions area */
.header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.theme-zoom-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ddl-select {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font-size: 13.5px;
    font-weight: 500;
    color: var(--ink-2);
    cursor: pointer;
}

.ddl-select svg {
    width: 15px;
    height: 15px;
    color: var(--slate);
}

.rbtn {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--line) !important;
    background: #fff !important;
    display: grid;
    place-items: center;
    color: var(--ink-2) !important;
    cursor: pointer;
    transition: 0.14s;
    padding: 0 !important;
    box-shadow: none !important;
}

.rbtn:hover {
    border-color: #D2D6DD !important;
    background: #f8fafc !important;
}

.rbtn svg,
.rbtn i {
    width: 16px;
    height: 16px;
    color: var(--ink-2) !important;
}

.rbtn.dark {
    background: var(--ink) !important;
    border-color: var(--ink) !important;
    color: #fff !important;
}

.rbtn.dark:hover {
    background: #000 !important;
    color: #fff !important;
}

.rbtn.dark svg,
.rbtn.dark i {
    color: #fff !important;
}

.rbtn.rel {
    position: relative;
}

.rbtn .dot {
    position: absolute;
    top: 8px;
    right: 9px;
    width: 7px;
    height: 7px;
    background: var(--red) !important;
    border-radius: 50%;
    border: 1.5px solid #fff;
}

.ava {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: linear-gradient(135deg, #D81030, #7A0A1C);
    display: grid;
    place-items: center;
    color: #fff !important;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    box-shadow: 0 1px 2px rgba(16,18,22,.03);
}

/* Theme adaptation overrides to keep the dark mode looking great */
[data-theme="jackson"] .top-header {
    background: var(--bg-sidebar) !important;
    border-bottom-color: var(--border-dark) !important;
    color: var(--text-on-dark) !important;
}

[data-theme="jackson"] .header-title {
    color: var(--text-on-dark) !important;
}

[data-theme="jackson"] .feed-ok {
    color: var(--text-muted-dark) !important;
}

[data-theme="jackson"] .header-divider {
    color: var(--border-dark) !important;
}

[data-theme="jackson"] .header-breadcrumbs {
    color: var(--text-muted-dark) !important;
}

[data-theme="jackson"] .search-bar.quick-nav {
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: var(--border-dark) !important;
    color: var(--text-muted-dark);
}

[data-theme="jackson"] .search-bar.quick-nav input {
    color: var(--text-on-dark) !important;
}

[data-theme="jackson"] .kbd-shortcut {
    border-color: var(--border-dark) !important;
    background: var(--bg-sidebar) !important;
    color: var(--text-muted-dark) !important;
}

[data-theme="jackson"] .ddl-select {
    border-color: var(--border-dark);
    background: var(--bg-sidebar);
    color: var(--text-on-dark);
}

[data-theme="jackson"] .rbtn {
    border-color: var(--border-dark) !important;
    background: var(--bg-sidebar) !important;
    color: var(--text-on-dark) !important;
}

[data-theme="jackson"] .rbtn:hover {
    border-color: rgba(255, 255, 255, 0.2) !important;
    background: rgba(255, 255, 255, 0.08) !important;
}

[data-theme="jackson"] .rbtn svg,
[data-theme="jackson"] .rbtn i {
    color: var(--text-on-dark) !important;
}

[data-theme="jackson"] .rbtn.dark {
    background: #fff !important;
    border-color: #fff !important;
    color: var(--ink) !important;
}

[data-theme="jackson"] .rbtn.dark:hover {
    background: rgba(255,255,255,0.9) !important;
}

[data-theme="jackson"] .rbtn.dark svg,
[data-theme="jackson"] .rbtn.dark i {
    color: var(--ink) !important;
}

/* ==========================================
   Force revive-chat-btn and icon-btn to use
   ZYNORK rbtn style — must come last to win
   ========================================== */
.revive-chat-btn {
    width: 38px !important;
    height: 38px !important;
    border-radius: 10px !important;
    background: var(--ink) !important;       /* dark fill */
    border: 1px solid var(--ink) !important;
    color: #fff !important;
    display: grid !important;
    place-items: center !important;
    cursor: pointer;
    transition: 0.14s !important;
    padding: 0 !important;
    box-shadow: none !important;
    transform: none !important;
}

.revive-chat-btn:hover {
    background: #000 !important;
    box-shadow: none !important;
    transform: none !important;
}

.revive-chat-btn svg,
.revive-chat-btn i {
    width: 18px !important;
    height: 18px !important;
    color: #fff !important;
    stroke: #fff !important;
}

/* Notification button — ZYNORK rbtn style */
.icon-btn {
    width: 38px !important;
    height: 38px !important;
    border-radius: 10px !important;
    border: 1px solid var(--line) !important;
    background: #fff !important;
    display: grid !important;
    place-items: center !important;
    color: var(--ink-2) !important;
    cursor: pointer;
    transition: 0.14s !important;
    padding: 0 !important;
    box-shadow: none !important;
    transform: none !important;
}

.icon-btn:hover {
    border-color: #D2D6DD !important;
    background: #f8fafc !important;
    box-shadow: none !important;
    transform: none !important;
}

.icon-btn svg,
.icon-btn i {
    width: 18px !important;
    height: 18px !important;
    color: var(--ink-2) !important;
    stroke: var(--ink-2) !important;
}

/* Dark theme overrides */
[data-theme="jackson"] .revive-chat-btn {
    background: #fff !important;
    border-color: #fff !important;
    color: var(--ink) !important;
}

[data-theme="jackson"] .revive-chat-btn:hover {
    background: rgba(255,255,255,0.9) !important;
}

[data-theme="jackson"] .revive-chat-btn svg,
[data-theme="jackson"] .revive-chat-btn i {
    color: var(--ink) !important;
    stroke: var(--ink) !important;
}

[data-theme="jackson"] .icon-btn {
    border-color: var(--border-dark) !important;
    background: var(--bg-sidebar) !important;
    color: var(--text-on-dark) !important;
}

[data-theme="jackson"] .icon-btn:hover {
    border-color: rgba(255,255,255,0.2) !important;
    background: rgba(255,255,255,0.08) !important;
}

[data-theme="jackson"] .icon-btn svg,
[data-theme="jackson"] .icon-btn i {
    color: var(--text-on-dark) !important;
    stroke: var(--text-on-dark) !important;
}
