@charset "utf-8";
/* CSS Document */
/* AI Command & Control CSS */

/* Tippy.js light-border theme override */
.tippy-box[data-theme~='light-border'] {
  border-radius: 10px;
  color: #370B93;
  background: #ffffff;
  border: 2px solid #000000;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
}
.tippy-box[data-theme~='light-border'] .tippy-content {
  padding: 10px 12px;
}

/* Tippy.js Custom Theme - Compass */
.tippy-box[data-theme~='compass'] {
  background-color: #ffffff;
  color: #495057;
  border: 1px solid #000000;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.tippy-box[data-theme~='compass'] .tippy-content {
  padding: 12px 16px;
}

.tippy-box[data-theme~='compass'] .tippy-arrow {
  color: #000000;
}

.tippy-box[data-theme~='compass'] .tippy-arrow::before {
  border-right-color: #000000;
}

.tippy-box[data-theme~='compass'][data-placement^='right'] > .tippy-arrow::before {
  border-right-color: #000000;
}

.tippy-box[data-theme~='compass'][data-placement^='left'] > .tippy-arrow::before {
  border-left-color: #000000;
}

.tippy-box[data-theme~='compass'][data-placement^='top'] > .tippy-arrow::before {
  border-top-color: #000000;
}

.tippy-box[data-theme~='compass'][data-placement^='bottom'] > .tippy-arrow::before {
  border-bottom-color: #000000;
}

.tippy-box[data-theme~='compass'] .tip-card {
  font-size: 14px;
  line-height: 1.5;
}

/* CSS Variables */
:root{
  /* Light Theme */
  --primary-bg: #ffffff;
  --secondary-bg: #f8f9fa;
  --card-bg: #ffffff;
  --border-color: #dee2e6;
  --text-muted: #6c757d;
  --hover-bg: rgba(0,0,0,0.05);
  --text-primary: #212529;
  --warning-bg:#dc3545;
  --success-bg:#198754;
  --info-bg:#0dcaf0;
  --primary-blue:#0d6efd;
  --grid-color: #e9ecef; /* Light gray for grid lines */
}


/* Base Styles */
body {
    background: var(--primary-bg);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    margin: 0;
    min-height: 100vh;
    overflow-y: scroll;
}


/* Thin, visible vertical handle for the left panel */
/* Slim vertical handle inside the left panel */
.panel-resizer,
#panel-resizer {
  position: absolute;
  top: 0;
  right: -2px;                 /* sits just in the gap */
  bottom: 0;
  width: 4px;                  /* was 12px */
  cursor: col-resize;
  background: var(--border-color);          /* subtle, not white */
  border: none;                              
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.25);  /* crisp edge */
  opacity: .9;
  z-index: 50;
}
.panel-resizer:hover,
#panel-resizer:hover { opacity: 1; }



/* Header Styles */
.header {
    flex: 0 0 auto;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    background: #ffffff;
    padding: 20px 2rem;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 9500;
}

.header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    position: relative;
}

.header-left {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    z-index: 1;
}

.header-left img {
    height: 50px;
    width: auto;
}

.header-center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-title {
    font-family: Tahoma, Geneva, Verdana, sans-serif;
    font-size: 36px;
    font-weight: bold;
    color: var(--text-primary);
}

.header-right {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    z-index: 1;
}

/* Settings gear button & dropdown */
.header-settings-wrapper {
    position: relative;
}

.header-settings-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: var(--secondary-bg, #f5f5f5);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.2s, color 0.2s, transform 0.3s;
    position: relative;
    z-index: 9999;
}

.header-settings-btn:hover {
    background: var(--hover-bg, #e8e8e8);
    color: var(--text-primary);
    transform: rotate(45deg);
}

.header-settings-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    z-index: 1000;
    overflow: hidden;
}

.header-settings-dropdown.open {
    display: block;
}

.settings-dropdown-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #333);
}

.settings-dropdown-user i {
    font-size: 20px;
    color: var(--text-muted, #888);
}

.settings-dropdown-divider {
    height: 1px;
    background: var(--border-color, #eee);
}

.settings-dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    font-size: 14px;
    color: var(--text-muted, #666);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
    cursor: pointer;
}

.settings-dropdown-item:hover {
    background: #f5f5f5;
    color: #d32f2f;
    text-decoration: none;
}

/* Main Navigation Bar */
.main-nav {
    display: flex;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
    padding: 10px 2rem;
    background: #ffffff;
}

.nav-left {
    width: 20%;
    display: flex;
    align-items: center;
}

.nav-center {
    width: 60%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.nav-right {
    width: 20%;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
}

/* Library button - right justified in prompt header */
.btn-library {
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.nav-info-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #2196F3;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: background 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.nav-info-btn:hover {
    background: #1976D2;
    transform: scale(1.05);
}

.nav-link {
    padding: 8px 16px;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link.active {
    color: var(--primary-blue);
    border-bottom-color: var(--primary-blue);
}

.nav-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 16px 8px;
    border-radius: 10px;
}

.nav-group.nav-group-framework {
    background: #f0f7ff;
    border: 1.5px solid #c4c8cc;
}

.nav-group.nav-group-operations {
    background: #f0f7ff;
    border: 1.5px solid #c4c8cc;
}

.nav-group.nav-group-conductor {
    background: #f0f7ff;
    border: 1.5px solid #c4c8cc;
}

.nav-group-label {
    font-size: 0.55rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: #9ca3af;
}

.nav-group.nav-group-framework .nav-group-label,
.nav-group.nav-group-operations .nav-group-label,
.nav-group.nav-group-conductor .nav-group-label {
    color: #7c8490;
}

/* Multi-note icon for the Conductor menu item — five staggered music
   glyphs forming a short motif. */
.conductor-notes {
    display: inline-flex;
    align-items: baseline;
    gap: 2px;
    line-height: 1;
    letter-spacing: 0;
    color: #2563eb;
    font-size: 1.05rem;
}
.conductor-notes > span { display: inline-block; }
.conductor-notes .n1 { font-size: 0.90em; transform: translateY(-1px); }
.conductor-notes .n2 { font-size: 1.05em; transform: translateY(2px); }
.conductor-notes .n3 { font-size: 1.15em; transform: translateY(-2px); }
.conductor-notes .n4 { font-size: 1em;    transform: translateY(1px); }
.conductor-notes .n5 { font-size: 0.95em; transform: translateY(-1px); }

.nav-group-items {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-separator {
    display: none;
}

/* Nav Dropdown (Governance) */
.nav-dropdown {
    position: relative;
    display: inline-flex;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    min-width: 210px;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
    padding: 4px 0;
    margin-top: 2px;
}

.nav-dropdown-menu.show {
    display: block;
}

.nav-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 8px 16px;
    background: none;
    border: none;
    font-size: 13px;
    color: var(--text-primary, #1e293b);
    cursor: pointer;
    text-align: left;
}

.nav-dropdown-item:nth-child(even) {
    background: var(--hover-bg, #f1f5f9);
}

.nav-dropdown-item:hover {
    background: #e2e8f0;
}

.nav-dropdown-item.active {
    color: var(--primary-blue, #2563eb);
    font-weight: 600;
}

.gov-step-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #2563eb;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    flex-shrink: 0;
    line-height: 1;
}

/* Governance sub-content scrollable */
.gov-sub-content {
    height: 100%;
    overflow-y: auto;
}

/* Default toggle on each governance sub-panel */
.gov-default-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

/* Getting Started - 7 Steps */
.gov-getting-started {
    padding: 24px;
    max-width: 900px;
    margin: 0 auto;
}

.gov-gs-header {
    margin-bottom: 24px;
}

.gov-gs-header h4 {
    margin: 0 0 6px;
    font-weight: 700;
    font-size: 1.3rem;
}

.gov-gs-header p {
    margin: 0;
    color: #64748b;
    font-size: 0.9rem;
}

.gov-gs-steps {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    overflow: hidden;
}

.gov-gs-step {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
}

.gov-gs-step:last-child {
    border-bottom: none;
}

.gov-gs-step:nth-child(odd) {
    background: var(--hover-bg, #f8fafc);
}

.gov-gs-step-num {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #2563eb;
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
}

.gov-gs-step-body h5 {
    margin: 0 0 6px;
    font-weight: 700;
    font-size: 0.95rem;
}

.gov-gs-step-body p {
    margin: 0;
    color: #475569;
    font-size: 0.85rem;
    line-height: 1.6;
}

.gov-gs-step-body p.gov-gs-howto {
    margin-top: 8px;
    padding: 8px 12px;
    background: #eff6ff;
    border-left: 3px solid #2563eb;
    border-radius: 0 6px 6px 0;
    color: #1e40af;
    font-size: 0.83rem;
}

/* Governance 1st Chatbot */
.gov-gs-chatbot {
    margin-top: 24px;
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    overflow: hidden;
}

.gov-gs-chatbot-header {
    padding: 14px 20px;
    background: #1e293b;
    color: #fff;
}

.gov-gs-chatbot-header h5 {
    margin: 0 0 4px;
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gov-gs-chatbot-header p {
    margin: 0;
    font-size: 0.8rem;
    color: #94a3b8;
}

.gov-gs-chatbot-body {
    padding: 16px;
    background: var(--card-bg, #fff);
}

.gov-chat-messages {
    max-height: 250px;
    overflow-y: auto;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.gov-chat-msg {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 0.85rem;
    line-height: 1.5;
    max-width: 85%;
}

.gov-chat-msg.bot {
    background: #f1f5f9;
    color: #334155;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
}

.gov-chat-msg.user {
    background: #2563eb;
    color: #fff;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.gov-chat-input-wrap {
    display: flex;
    gap: 8px;
}

.gov-chat-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color, #d1d5db);
    border-radius: 8px;
    font-size: 0.85rem;
    outline: none;
    background: var(--card-bg, #fff);
    color: var(--text-primary, #1e293b);
}

.gov-chat-input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.15);
}

.nav-icon-btn {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    background: var(--secondary-bg);
    color: var(--text-muted);
    border: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background 0.2s, color 0.2s, transform 0.1s;
    flex-shrink: 0;
}

.nav-icon-btn:hover {
    background: var(--hover-bg);
    color: var(--text-primary);
    transform: scale(1.05);
}

.nav-icon-btn.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

/* Legacy header styles - keep for compatibility */
.header-top-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    width: 100%;
    position: relative;
    padding-top: 0.5rem;
}

.header-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    position: relative;
    padding-top: 2px;
}

.hr-left-logo {
    height: 60px;
    width: auto;
}

.aicompass-logo-center {
    height: 50px;
    width: auto;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.aicompass-title-center {
    font-family: Tahoma, Geneva, Verdana, sans-serif !important;
    font-size: 48px !important;
    font-weight: 700 !important;
    color: #000 !important;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    line-height: 1;
    letter-spacing: -1px;
}

.aicompass-logo {
    height: 40px;
    width: auto;
}

.hr-center-logo {
    height: 60px;
    width: auto;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.header-icons-right {
    display: flex;
    align-items: flex-end;
    gap: 1.5rem;
}

.header-icon-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
}

.header-icon {
    height: 51px;
    width: auto;
}

.header-icon-label {
    font-size: 12px;
    color: var(--text-muted);
    text-align: center
}

.header-labels-right {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.header-labels-right .header-icon-label {
    min-width: 51px;
    text-align: center;
}

.header-spacer {
    width: 100px;
}

.logo-tagline {
    font-size: 14px;
    color: var(--text-muted);
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-muted);
    font-size: 14px;
}

.logout-link {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
}

.logout-link:hover {
    color: var(--text-primary);
    text-decoration: underline;
}

.header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.hr-logo {
    height: 80px;
    width: auto;
}

.logo-container {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 0 0 10px;
}

.header-right .user-info {
    flex: 1;
    justify-content: flex-end;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-muted);
}

/* Footer */
.footer {
    background: var(--primary-bg);
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: 1400px;
    margin: 0 auto;
}

.footer-content {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-text {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.footer-logo {
    height: 40px;
    width: auto;
}

/* Main Container */
.main-container {
    padding: 0.5rem 2rem;
    max-width: 1400px;
    margin: 0 auto;
}

/* Standalone tab containers — siblings of .ai-interface inside .main-container */
.standalone-tab-container {
    height: calc(100vh - 140px);
    overflow-y: auto;
}

/* AI Interface Grid - 40/60 Split on Desktop */
.ai-interface {
    display: grid;
    grid-template-columns: 2fr 3fr; /* 40/60 split */
    gap: 2rem;
    height: calc(100vh - 140px);
    min-height: 600px;
}

/* Panel Base Styles */
.guardrails-panel,
.input-section,
.output-section {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.25);
}

/* Admin Tab Container - above left panel */
.admin-tab-container {
    position: absolute;
    top: -42px;
    left: 50px;
    display: flex;
    gap: 0;
    z-index: 5;
}

.admin-tab-container .nav-tab.admin-tab {
    padding: 10px 20px;
    background: #fff;  /* White when not selected */
    color: #666;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    border-radius: 10px 10px 0 0;
    border: 1px solid var(--border-color, #dee2e6);
    border-bottom: none;
    transition: background 0.2s, color 0.2s;
    text-decoration: none;
}

.admin-tab-container .nav-tab.admin-tab:hover {
    background: #f0f0f0;
    color: #444;
}

.admin-tab-container .nav-tab.admin-tab:active {
    background: #dbeafe;  /* Light blue when clicked */
    color: #1d4ed8;
}

/* Guardrails Panel */
.guardrails-panel, .left-tabs {
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.panel-title {
    margin: 0 0 1rem 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-title {
    margin: 0 0 0.75rem 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Filter Section */
.filter-section .form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

/* Guardrails List */
.guardrails-list, #guardrails-container {
    flex: 1;
    min-height: 200px;
}

.guardrails-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.guardrails-header .section-title {
    margin: 0;
}

.guardrail-header-actions {
    display: flex;
    gap: 0.5rem;
}

.guardrail-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 0.25rem; /* Reduced spacing between items */
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.guardrail-item:hover {
    border-color: var(--primary-blue);
    background: var(--hover-bg);
}

.guardrail-item.selected {
    border-color: var(--primary-blue);
    background: rgba(13, 110, 253, 0.15);
    box-shadow: 0 2px 8px rgba(13, 110, 253, 0.2);
}

.guardrail-item.selected .guardrail-title {
    color: var(--primary-blue);
}

.guardrail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.5rem;
}

.guardrail-item .guardrail-title {
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
    margin-right: 0.5rem;
}

.guardrail-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--primary-blue);
}

.guardrail-item .guardrail-desc {
    font-size: 0.875rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.guardrail-item .guardrail-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Risk Badges */
.risk-badge {
    display: inline-block;
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.risk-low { background: var(--success-bg); color: white; }
.risk-medium { background: #fd7e14; color: white; }
.risk-high { background: var(--warning-bg); color: white; }

/* RegX Section */
.regex-controls {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.regex-dropdown {
    position: relative;
}

.regex-content {
    display: none;
    position: absolute;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    z-index: 1000;
    min-width: 320px;
    max-height: 400px;
    overflow-y: auto;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    box-shadow: 0 8px 24px rgba(0,0,0,.5);
}

.regex-content.show {
    display: block;
}

.regex-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    font-weight: 600;
}

.regex-pattern {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem;
    margin-bottom: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.75rem;
    word-break: break-all;
}

.regex-pattern .pattern-name {
    font-weight: 600;
    color: var(--primary-blue);
    margin-bottom: 0.25rem;
}

.regex-pattern .pattern-code {
    color: var(--text-muted);
}

/* Main Panel */
.main-panel {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto; /* Allow scrolling when content grows */
}

/* Input Section - ~50% of vertical space when stacked */
.input-section {
    flex: 50 1 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

/* Light gray borders for prompt input and AI response textareas */
#user-prompt,
#ai-response-content {
    border: 2px solid #d1d5db !important;
}

#user-prompt:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
}

/* Prompt Input Header */
.prompt-input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 1rem;
}

.prompt-input-left {
    display: flex;
    align-items: center;
    gap: 0.125rem;
}

.prompt-input-title {
    font-weight: 800;
    font-size: 0.95rem;
    margin: 0;
    margin-left: 10px;
    color: var(--text-primary);
}

.prompt-input-left .char-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
    margin-left: 0.25rem;
}

/* Square button style - override Bootstrap */
.prompt-input-left .btn-square {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 6px !important;
    border: 1px solid #999 !important;
    background-color: #f0f0f0 !important;
    color: #555 !important;
}

/* Voice input recording state */
#voice-input-btn.recording {
    background-color: #dc3545 !important;
    border-color: #dc3545 !important;
    color: white !important;
    animation: pulse-recording 1s infinite;
}

@keyframes pulse-recording {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.model-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: 12px;
}

.model-controls .form-label {
    margin: 0;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.prompt-input-area {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.prompt-input-area textarea {
    flex: 1 1 auto;
    resize: vertical;
    height: 180px !important;
    min-height: 140px !important;
    max-height: 400px !important;
    overflow-y: auto;
}

.input-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.input-actions {
    display: flex;
    gap: 0.5rem;
}

.char-count {
    font-size: 0.75rem;
}

.submit-controls {
    display: flex;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Prompt Content Layout - tighter spacing (only when active) */
#prompt-content.active {
    gap: 10px !important;
}

/* Token Cost Panel */
.token-cost-panel {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 8px 16px;
    margin: 0;
    flex-shrink: 0;
}

.token-cost-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
}

.token-cost-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.token-cost-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.token-cost-value {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-color);
    font-family: 'SF Mono', Monaco, Consolas, monospace;
}

.token-cost-divider {
    width: 1px;
    height: 20px;
    background: var(--border-color);
}

.token-cost-item.cost .token-cost-value {
    color: #4CAF50;
    font-size: 14px;
}

/* Textarea Footer - attached to bottom of textarea */
.textarea-footer {
    display: flex;
    gap: 0;
    background: #2196F3;
    border-radius: 0 0 8px 8px;
    flex-shrink: 0;
}

.textarea-footer-btn {
    flex: 1;
    padding: 10px 8px;
    background: #e0e0e0;
    color: #333;
    border: none;
    border-right: 1px solid #2196F3;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.2s, color 0.2s;
}

.textarea-footer-btn:first-child {
    border-radius: 0 0 0 8px;
}

.textarea-footer-btn:last-child {
    border-right: none;
    border-radius: 0 0 8px 0;
}

.textarea-footer-btn:hover {
    background: #2196F3;
    color: #fff;
}

.textarea-footer-btn i {
    font-size: 13px;
}

/* Make textarea connect to footer (no bottom border-radius) */
.prompt-input-area textarea {
    border-radius: 8px 8px 0 0 !important;
}

/* Attached Documents */
.attached-documents {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px 8px;
    background: #f0f4f8;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
}

.attached-documents + textarea {
    border-radius: 0 !important;
}

.attached-doc-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    background: #ffffff;
    border: 1px solid #c8d6e5;
    border-radius: 16px;
    font-size: 12px;
    color: #2d3436;
    max-width: 250px;
}

.attached-doc-chip i {
    color: #0d6efd;
    font-size: 11px;
}

.attached-doc-chip .doc-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.attached-doc-chip .doc-remove {
    cursor: pointer;
    color: #999;
    font-size: 13px;
    line-height: 1;
    padding: 0 2px;
}

.attached-doc-chip .doc-remove:hover {
    color: #dc3545;
}

.attached-doc-chip.uploading {
    opacity: 0.6;
}

.attached-doc-chip.uploading i {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Output Section - ~50% of vertical space when stacked */
.output-section {
    flex: 50 1 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden; /* Contain children */
}

.output-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.risk-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Warning Box */
.warning-box {
    background: rgba(220, 53, 69, 0.1);
    border: 1px solid var(--warning-bg);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.warning-box .fa-exclamation-triangle {
    color: var(--warning-bg);
    margin-top: 0.125rem;
}

.warning-box .warning-content {
    flex: 1;
}

.warning-box .warning-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.warning-box .warning-message {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Filter Activity */
.filter-activity {
    background: rgba(13, 202, 240, 0.1);
    border: 1px solid var(--info-bg);
    border-radius: 8px;
    padding: 0.75rem;
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.filter-activity .activity-title {
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--info-bg);
}

.filter-activity .activity-item {
    margin-bottom: 0.25rem;
    color: var(--text-muted);
}

/* Response Content */
.response-content {
    flex: 1 1 0;
    margin-bottom: 1rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Important for flex children to shrink */
}

.response-text {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 1rem;
    min-height: 0; /* Allow shrinking */
    flex: 1 1 0;
    overflow-y: auto; /* Scroll when content overflows */
    white-space: pre-wrap;
    word-wrap: break-word;
    font-family: inherit;
    line-height: 1.6;
}

/* Copy success animation */
#copy-response-btn.copy-success {
    background-color: #28a745 !important;
    border-color: #28a745 !important;
    color: white !important;
}

.response-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--text-muted);
    height: 200px;
}

.response-placeholder i {
    font-size: 2rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.response-placeholder p {
    margin: 0;
    font-size: 0.875rem;
}

/* Response Actions */
.response-actions {
    display: flex;
    gap: 0.75rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
}

/* Form Controls */
.form-control, .form-select {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.form-control:focus, .form-select:focus {
    background: var(--card-bg);
    border-color: var(--primary-blue);
    color: var(--text-primary);
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
}

.form-select {
    max-height: 200px;
    overflow-y: auto;
}

.form-select option {
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 0.5rem;
}

/* Filter section specific styling */
.filter-section .form-select {
    max-height: 150px;
}

/* Button Styles */
.btn {
    border-radius: 8px;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: var(--primary-blue);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background: #0b5ed7;
    color: white;
}

.btn-secondary {
    background: var(--card-bg);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--hover-bg);
    color: var(--text-primary);
    border-color: var(--primary-blue);
}

.btn-warning {
    background: var(--warning-bg);
    color: white;
}

.btn-warning:hover:not(:disabled) {
    background: #c02e3b;
    color: white;
}

.btn-success {
    background: var(--success-bg);
    color: white;
}

.btn-success:hover:not(:disabled) {
    background: #146c43;
    color: white;
}

.btn.btn-outline-secondary {
    background: transparent;
    color: var(--text-muted);
    border: 1px solid #ccc !important;
}

.btn.btn-outline-secondary:hover:not(:disabled) {
    background: var(--hover-bg, #f5f5f5);
    color: var(--text-primary);
    border-color: #999 !important;
}

.btn.btn-sm {
    padding: 0.15rem 0.5rem !important;
    font-size: 0.875rem;
}

.btn.btn-icon-square {
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}

/* Loading States */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--text-muted);
    padding: 1rem;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-content {
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 2rem;
    text-align: center;
    min-width: 200px;
}

/* Utility Classes */
.text-muted {
    color: var(--text-muted) !important;
}

.text-primary {
    color: var(--text-primary) !important;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .ai-interface {
        grid-template-columns: 2fr 3fr; /* Keep 40/60 even on smaller desktops */
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .main-container {
        padding: 1rem;
    }
    
    .ai-interface {
        grid-template-columns: 1fr; /* Stack vertically on mobile */
        gap: 1rem;
        height: auto;
    }
    
    .guardrails-panel {
        order: 2; /* Put guardrails panel second on mobile */
        max-height: 400px;
    }
    
    .header {
        padding: 1rem;
    }
    
    .header h1 {
        font-size: 1.25rem;
    }
    
    .response-actions {
        flex-direction: column;
    }
    
    .submit-controls {
        flex-direction: column;
    }
    
    .guardrail-header-actions {
        flex-direction: column;
        width: 100%;
        gap: 0.25rem;
    }
}

@media (max-width: 480px) {
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .model-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .input-actions {
        flex-direction: column;
        width: 100%;
        align-items: stretch;
    }
    
    .input-meta {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }
}


/* --- Remove Upload Doc entirely --- */
#upload-doc-btn { display: none !important; }

/* --- Buttons layout handled by inline flexbox in HTML --- */


/* --- Left column resizer --- */
.ai-interface { position: relative; }           /* container for absolute resizer */
#col-resizer {
  position: absolute;
  top: 0; bottom: 0;
  width: 4px;                                   /* thinner bar */
  background: var(--border-color);
  cursor: col-resize;
  z-index: 50;
  opacity: 0.9;
}
#col-resizer:hover { opacity: 1; }
body.resizing-x { cursor: col-resize; user-select: none; }



/* Keep "AI Model:" + dropdown on one line and give it more room */
/* Keep label and select on one line, but don't let the select stretch */
.model-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: nowrap;      /* no wrapping */
}

.model-controls .form-label {
  white-space: nowrap;    /* never break "AI Model:" */
  margin: 0;
}

/* ↓ This is the key change: stop flex-stretching and use intrinsic width */
.model-controls select,
.model-controls .form-select {
  flex: 0 0 auto;         /* <— was flex: 1 1 auto; remove any width:100% overrides */
  width: auto;
  max-width: 320px;       /* tweak to taste (e.g., 260–360px) */
  min-width: 0;
}


/* If your row container is flex and was wrapping, keep it single-line */
.model-row, .controls-row, .top-controls {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.75rem;
}


/* Prompt actions row: Submit on the left; others on the right */
.input-meta{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.input-actions{
  display: flex;
  align-items: center;
  gap: .5rem;
  flex: 1;                 /* take remaining row width */
}

/* Button ordering removed - using HTML structure with nested flexbox divs instead */

/* Remove Upload Doc button entirely (even if HTML still has it) */
#upload-doc-btn{ display: none !important; }


/* Make the left panel’s scrollbar dark & thin so it doesn’t look like a big white bar */
.guardrails-panel {
  /* Firefox */
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.35) transparent;
}

/* Chromium/WebKit */
.guardrails-panel::-webkit-scrollbar {
  width: 8px;           /* was ~12px default */
}
.guardrails-panel::-webkit-scrollbar-track {
  background: transparent;   /* no white track */
}
.guardrails-panel::-webkit-scrollbar-thumb {
  background-color: rgba(255,255,255,0.35);
  border-radius: 8px;
  border: 2px solid transparent;   /* creates some breathing room */
  background-clip: content-box;
}
.guardrails-panel::-webkit-scrollbar-thumb:hover {
  background-color: rgba(255,255,255,0.5);
}


/* ── Left-panel accordion (mobile-first) ───────────────────────────── */
.left-accordion{display:flex;flex-direction:column;gap:.5rem}
.acc-item{border:1px solid var(--border-color);border-radius:8px;background:var(--card-bg)}
.acc-btn{
  width:100%;display:flex;align-items:center;justify-content:space-between;gap:.5rem;
  padding:.6rem .8rem;background:transparent;border:0;color:var(--text-primary);
  font-size:14px;font-weight:600;cursor:pointer;border-radius:8px
}
.acc-btn:hover{background:var(--hover-bg)}
.acc-btn .badge{font-size:12px;padding:.1rem .4rem;border:1px solid var(--border-color);border-radius:999px;color:var(--text-muted)}
.acc-panel{
  overflow:hidden;max-height:0;transition:max-height .2s ease;
}
.acc-item.is-open>.acc-panel{ /* JS sets max-height to scrollHeight for smooth open */
  /* no fixed value here; JS computes it so we don't cut off content */
}
.acc-content{padding:.6rem .8rem}

/* Make sure the accordion fills the panel nicely on mobile */
.guardrails-panel{display:flex;flex-direction:column;height:100%}
.guardrails-panel>.left-accordion{flex:1 1 auto}
.guardrails-panel>.left-tabs{flex:1 1 auto;margin-bottom:0.5rem}

/* Keep the left panel's scrollbar thin/dark (already added before; harmless if repeated) */
.guardrails-panel{scrollbar-width:thin;scrollbar-color:rgba(255,255,255,.35) transparent}
.guardrails-panel::-webkit-scrollbar{width:8px}
.guardrails-panel::-webkit-scrollbar-track{background:transparent}
.guardrails-panel::-webkit-scrollbar-thumb{
  background-color:rgba(255,255,255,.35);border-radius:8px;border:2px solid transparent;background-clip:content-box
}
.guardrails-panel::-webkit-scrollbar-thumb:hover{background-color:rgba(255,255,255,.5)}

/* Tab panel scrollbar styles moved to .left-tabs .tab-panel.is-active */

/* ── Left panel: horizontal tabs ───────────────────────────────────── */
.left-tabs {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto; /* Allow the tab component to fill the panel */
  min-height: 0; /* Important for nested flex scrolling */
  overflow: hidden;
}

.left-tabs .tab-panels {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.left-tabs .tab-strip {
  display: flex;
  gap: 7px;
  padding: 0 .25rem 0 .25rem;
  border-bottom: 1px solid var(--border-color); /* The line under the tabs */
  align-items: flex-end;
}

.left-tabs .tab-btn{
  flex: 0 0 auto;
  padding: .4rem .5rem;
  border: 1px solid transparent;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
}

.left-tabs .tab-btn:not(.is-active):hover{
  background: var(--hover-bg);
  color: var(--text-primary);
}
 
.left-tabs .tab-btn.is-active{
  border-color: var(--border-color);
  background: var(--secondary-bg);
  color: #212529;
  font-weight: 500;
  border-bottom-color: var(--secondary-bg);
  transform: translateY(1px);
}

.left-tabs .tab-panel{
  display: none;
  padding: 0.25rem 0.75rem 0.75rem; /* Reduced top padding */
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-top: none; /* Tab strip provides top border */
  border-radius: 0 0 8px 8px;
  flex: 1 1 auto;
  min-height: 0; /* Allow flex shrinking */
  max-height: calc(100vh - 300px); /* Constrain height to enable scrolling */
}

.left-tabs .tab-panel.is-active {
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #888 #e0e0e0;
}
.left-tabs .tab-panel.is-active::-webkit-scrollbar {
  width: 10px;
}
.left-tabs .tab-panel.is-active::-webkit-scrollbar-track {
  background: #e0e0e0;
  border-radius: 5px;
}
.left-tabs .tab-panel.is-active::-webkit-scrollbar-thumb {
  background-color: #888;
  border-radius: 5px;
  border: 2px solid #e0e0e0;
}
.left-tabs .tab-panel.is-active::-webkit-scrollbar-thumb:hover {
  background-color: #666;
}

/* === AICC Filters Panel ===================================== */
.filters-panel {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .25rem;
}

.filters-title {
  font-weight: 700;
  font-size: 15px;
  margin: 0;
}

.filters-table {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.filter-row {
  display: grid;
  grid-template-columns: 40px 1fr auto; /* [checkbox] [info] [actions] */
  align-items: start;
  gap: .75rem;
  padding: .75rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.filter-row:hover {
  border-color: var(--primary-blue);
  background: var(--hover-bg);
}

.filter-check {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 2px; /* Align with first line of text */
}

.filter-check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: var(--primary-blue);
}

.filter-info {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-width: 0; /* Allows text to wrap properly */
}

.filter-name {
  font-weight: 600;
  font-size: .95rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.filter-desc {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.4;
  word-break: break-word;
}

.filter-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-shrink: 0; /* Prevent shrinking */
}

.filter-actions .btn {
  padding: .375rem .5rem;
  font-size: .75rem;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.filter-actions .btn i {
  font-size: .875rem;
}

/* Modal Styles */
.filter-modal.hidden { 
  display: none; 
}

.filter-modal { 
  position: fixed; 
  inset: 0; 
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.filter-modal-backdrop {
  position: absolute; 
  inset: 0; 
  background: rgba(0,0,0,.6);
}

.filter-modal-dialog {
  position: relative;
  width: min(600px, 95vw);
  max-height: 95vh;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  display: flex;
  flex-direction: column;
}

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

.filter-modal-header h5 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.filter-modal-body { 
  padding: 1.25rem; 
  overflow-y: auto;
  flex: 1;
}

.filter-modal-footer {
  display: flex; 
  align-items: center; 
  justify-content: flex-end;
  gap: .75rem; 
  padding: 1rem 1.25rem; 
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.filter-modal-close {
  background: transparent; 
  border: 0; 
  font-size: 24px; 
  line-height: 1;
  color: var(--text-primary); 
  cursor: pointer;
  padding: .25rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.filter-modal-close:hover {
  background: var(--hover-bg);
}

/* Form Styles within Modal */
.filter-modal .form-group {
  margin-bottom: 1rem;
}

.filter-modal .form-group:last-child {
  margin-bottom: 0;
}

.filter-modal .form-group label {
  display: block; 
  margin-bottom: .5rem; 
  color: var(--text-primary);
  font-weight: 500;
  font-size: .9rem;
}

.filter-modal .form-control,
.filter-modal .form-select {
  width: 100%;
  padding: .6rem .75rem;
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: .9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-modal .form-control:focus,
.filter-modal .form-select:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.filter-modal textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.filter-modal input[type="checkbox"] {
  margin-right: .5rem;
  accent-color: var(--primary-blue);
}

/* PLMS Modal Styles */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,.6);
}

.plms-modal {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  width: min(320px, 90vw);
}

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

.plms-modal-header h6 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
}

.plms-modal-body {
  padding: 1rem;
}

.plms-modal-body label {
  display: block;
  margin-bottom: 0.5rem;
  font-size: 0.875rem;
  color: var(--text-color);
}

.plms-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-color);
}

/* Notification Styles */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  padding: 12px 20px;
  border-radius: 6px;
  color: white;
  font-weight: 500;
  z-index: 10001;
  animation: slideIn 0.3s ease-out;
  max-width: 400px;
  word-wrap: break-word;
}

@keyframes slideIn {
  from { 
    transform: translateX(100%); 
    opacity: 0; 
  }
  to { 
    transform: translateX(0); 
    opacity: 1; 
  }
}

.notification-success {
  background-color: #28a745;
}

.notification-error {
  background-color: #dc3545;
}

.notification-warning {
  background-color: #ffc107;
  color: #000;
}

.notification-info {
  background-color: #17a2b8;
}


/* Validation Results Styling - Always top-left, no indentation */
.response-text .validation-ok,
.response-text .validation-report {
    margin: 0;
    padding: 0;
    text-align: left;
    white-space: normal;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.4;
}

.validation-ok {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--success-bg);
    font-weight: 500;
    margin: 0;
    padding: 0;
}

.validation-ok i {
    font-size: 1.1rem;
    color: var(--success-bg);
}

.validation-report {
    margin: 0;
    padding: 0;
}

.validation-summary {
    font-weight: 600;
    color: var(--warning-bg);
    margin: 0 0 0.75rem 0;
    padding: 0;
}

.validation-list {
    margin: 0;
    padding: 0 0 0 1rem; /* Only minimal left padding for bullet points */
    list-style-type: disc;
}

.validation-list li {
    margin: 0 0 0.5rem 0;
    padding: 0;
    color: var(--text-primary);
}

.validation-list li strong {
    color: var(--warning-bg);
}

.validation-list .text-muted {
    margin: 0.25rem 0 0 0;
    padding: 0;
    font-size: 0.85rem;
    font-family: 'Courier New', monospace;
    color: var(--text-muted);
}

/* Override any inherited text positioning */
/* Validation Results Styling - Force top-left positioning */
#ai-response-content {
    display: flex;
    flex-direction: column;
}

.response-text .validation-ok,
.response-text .validation-report {
    margin: 0 !important;
    padding: 0 !important;
    text-align: left !important;
    white-space: normal !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
    line-height: 1.4 !important;
    position: relative !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    text-indent: 0 !important;
}

.validation-ok {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--success-bg);
    font-weight: 500;
}

.validation-ok i {
    font-size: 1.1rem;
    color: var(--success-bg);
}

.validation-summary {
    font-weight: 600;
    color: var(--warning-bg);
    margin: 0 0 0.75rem 0;
}

.validation-list {
    margin: 0;
    padding: 0 0 0 1rem;
    list-style-type: disc;
}

.validation-list li {
    margin: 0 0 0.5rem 0;
    color: var(--text-primary);
}

.validation-list li strong {
    color: var(--warning-bg);
}

/* === Documents Panel Styles ===================================== */
.documents-panel {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.documents-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: .25rem;
}

.documents-title {
  font-weight: 700;
  font-size: 15px;
  margin: 0;
}

.documents-table {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.document-row {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: .75rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  transition: all 0.2s ease;
}

.document-row:hover {
  border-color: var(--primary-blue);
  background: var(--hover-bg);
}

/* Use case row selected state */
.usecase-row.selected {
  border-color: var(--primary-blue);
  background: rgba(13, 110, 253, 0.15);
  box-shadow: 0 2px 8px rgba(13, 110, 253, 0.2);
}

.usecase-row.selected .document-title {
  color: var(--primary-blue);
}

.document-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.document-info {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  min-width: 0;
  flex: 1;
}

.document-title-row {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.vector-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  background: var(--primary-blue);
  color: white;
  font-size: .65rem;
  font-weight: 700;
  border-radius: 3px;
  flex-shrink: 0;
}

.document-title {
  font-weight: 600;
  font-size: .95rem;
  color: var(--text-primary);
  line-height: 1.3;
}

.document-desc {
  font-size: .85rem;
  color: var(--text-muted);
  line-height: 1.4;
  word-break: break-word;
}

.document-meta {
  display: flex;
  gap: .5rem;
  margin-top: .25rem;
  flex-wrap: wrap;
}

.doc-type-badge,
.doc-status-badge,
.semantic-badge {
  padding: .125rem .375rem;
  border-radius: 4px;
  font-size: .625rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.doc-type-badge {
  background: #6c757d;
  color: white;
}

.doc-status-badge.draft {
  background: #ffc107;
  color: #000;
}

.doc-status-badge.approved {
  background: #28a745;
  color: white;
}

.doc-status-badge.in_review {
  background: #17a2b8;
  color: white;
}

.doc-status-badge.archived {
  background: #6c757d;
  color: white;
}

.semantic-badge {
  background: var(--primary-blue);
  color: white;
}

.document-data-types {
  font-size: .7rem;
  color: var(--text-muted);
  margin-top: .25rem;
}

.document-actions {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.document-actions .btn {
  padding: 0;
  font-size: .875rem;
  width: 32px;
  height: 32px;
  min-width: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: white;
  color: #212529;
  border: 1px solid var(--border-color);
  border-radius: 8px;
}

.document-actions .btn:hover {
  background: var(--hover-bg);
  border-color: var(--primary-blue);
}

.document-actions .btn.btn-danger {
  background: white;
  color: #212529;
  border: 1px solid var(--border-color);
}

.document-actions .btn.btn-danger:hover {
  background: #dc3545;
  color: white;
  border-color: #dc3545;
}

.document-actions .btn.btn-outline-warning {
  background: white;
  color: #212529;
  border: 1px solid var(--border-color);
}

.document-actions .btn.btn-outline-warning:hover {
  background: #ffc107;
  color: #000;
  border-color: #ffc107;
}

/* Document Modal Styles */
.document-modal.hidden { display: none; }
.document-modal { 
  position: fixed; 
  inset: 0; 
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.document-modal-backdrop {
  position: absolute; 
  inset: 0; 
  background: rgba(0,0,0,.6);
}

.document-modal-dialog {
  position: relative;
  width: min(800px, 95vw);
  max-height: 90vh;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  display: flex;
  flex-direction: column;
}

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

.document-modal-header h5 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.document-modal-body { 
  padding: 1.25rem; 
  overflow-y: auto;
  flex: 1;
}

.document-modal-footer {
  display: flex; 
  align-items: center; 
  justify-content: flex-end;
  gap: .75rem; 
  padding: 1rem 1.25rem; 
  border-top: 1px solid var(--border-color);
  flex-shrink: 0;
}

.document-modal-close {
  background: transparent; 
  border: 0; 
  font-size: 24px; 
  line-height: 1;
  color: var(--text-primary); 
  cursor: pointer;
  padding: .25rem;
  border-radius: 4px;
  transition: background-color 0.2s ease;
}

.document-modal-close:hover {
  background: var(--hover-bg);
}

/* Form row layout for side-by-side fields */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.document-modal .form-group {
  margin-bottom: 1rem;
}

.form-row .form-group {
  margin-bottom: 0;
}

.document-modal .form-group label {
  display: block; 
  margin-bottom: .5rem; 
  color: var(--text-primary);
  font-weight: 500;
  font-size: .9rem;
}

.document-modal .form-control,
.document-modal .form-select {
  width: 100%;
  padding: .5rem .75rem;
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: .9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.document-modal .form-control:focus,
.document-modal .form-select:focus {
  outline: none;
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 0.2rem rgba(13, 110, 253, 0.25);
}

.document-modal textarea.form-control {
  resize: vertical;
  min-height: 80px;
}

.document-modal input[type="checkbox"] {
  margin-right: .5rem;
  accent-color: var(--primary-blue);
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .document-row {
    gap: .25rem;
  }

  .document-actions {
    flex-wrap: wrap;
  }
  
  .form-row {
    grid-template-columns: 1fr;
    gap: .5rem;
  }
}

/* Lock icons and associations CSS removed */

/* === Panel Toggle Buttons === */
.panel-toggle-container {
  position: absolute;
  left: calc(40% - 12px); /* Position at edge of left panel (2fr out of 5fr = 40%) */
  top: 50%;
  transform: translateY(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.panel-toggle-btn {
  width: 24px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border-color);
  background: var(--secondary-bg);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.panel-toggle-btn.left-toggle {
  border-left: none;
  border-radius: 0 8px 8px 0;
  box-shadow: 2px 0 8px rgba(0,0,0,0.1);
}

.panel-toggle-btn.right-toggle {
  border-right: none;
  border-radius: 8px 0 0 8px;
  box-shadow: -2px 0 8px rgba(0,0,0,0.1);
}

.panel-toggle-btn:hover {
  background: var(--hover-bg);
  color: var(--text-primary);
}

.panel-toggle-btn i {
  font-size: 12px;
  transition: transform 0.3s ease;
}

/* Left panel collapsed state */
.ai-interface.left-collapsed .panel-toggle-container {
  left: 0;
}

.ai-interface.left-collapsed .panel-toggle-btn.left-toggle i {
  transform: rotate(180deg);
}

/* When left panel is collapsed, hide the right toggle (only show expand-left arrow) */
.ai-interface.left-collapsed .panel-toggle-btn.right-toggle {
  display: none;
}

/* Right panel collapsed state */
.ai-interface.right-collapsed .panel-toggle-container {
  left: calc(100% - 12px);
}

.ai-interface.right-collapsed .panel-toggle-btn.right-toggle i {
  transform: rotate(180deg);
}

/* When right panel is collapsed, hide the left toggle (only show expand-right arrow) */
.ai-interface.right-collapsed .panel-toggle-btn.left-toggle {
  display: none;
}

/* Panel collapsed layouts */
.ai-interface.left-collapsed {
  grid-template-columns: 0fr 3fr;
}

.ai-interface.right-collapsed {
  grid-template-columns: 2fr 0fr;
}

.ai-interface.left-collapsed .guardrails-panel {
  opacity: 0;
  overflow: hidden;
  padding: 0;
  border: none;
  min-width: 0;
  pointer-events: none;
}

/* When left panel is collapsed, show Input and Output side by side for Prompt tab */
/* Side-by-side layout when left panel is collapsed */
.ai-interface.left-collapsed #prompt-content.active {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  grid-template-rows: 1fr auto !important;
  gap: 1rem !important;
  align-items: stretch !important;
  height: 100% !important;
}

/* Token bar spans full width and stays one row tall when left panel collapsed */
.ai-interface.left-collapsed #prompt-content.active #token-usage-bar {
  grid-row: 2 !important;
  grid-column: 1 / -1 !important;
  align-self: end !important;
  height: auto !important;
  flex: none !important;
}

/* Adjust padding on main panel when collapsed - push textareas up 20px */
.ai-interface.left-collapsed .main-panel {
  padding-top: 0 !important;
  padding-bottom: 20px !important;
}

.ai-interface.left-collapsed #prompt-content.active .input-section {
  grid-row: 1 !important;
  grid-column: 1 !important;
  max-height: none !important;
  height: 100% !important;
  display: flex !important;
  flex-direction: column !important;
}

.ai-interface.left-collapsed #prompt-content.active .output-section {
  grid-row: 1 !important;
  grid-column: 2 !important;
  display: flex !important;
  flex-direction: column !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

/* Keep headers visible but ensure they have the same height */
.ai-interface.left-collapsed #prompt-content.active .prompt-input-header,
.ai-interface.left-collapsed #prompt-content.active .output-section > .section-header {
  flex-shrink: 0 !important;
  min-height: 32px !important;
  height: 32px !important;
  display: flex !important;
  align-items: center !important;
  margin-bottom: 0.25rem !important;
}

/* Make the prompt-input-area fill all available space */
.ai-interface.left-collapsed #prompt-content.active .prompt-input-area {
  flex: 1 !important;
  display: flex !important;
  flex-direction: column !important;
  height: 100% !important;
}

/* Make textarea expand to fill space above footer */
.ai-interface.left-collapsed #prompt-content.active .prompt-input-area textarea {
  flex: 1 !important;
  height: auto !important;
  min-height: 0 !important;
  max-height: none !important;
}

/* Make response-content fill the output section */
.ai-interface.left-collapsed #prompt-content.active .response-content {
  flex: 1 1 0 !important;
  display: flex !important;
  flex-direction: column !important;
  margin-bottom: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
}

/* Make response-text (the actual text box) fill response-content with scrolling */
.ai-interface.left-collapsed #prompt-content.active .response-text {
  flex: 1 1 0 !important;
  min-height: 0 !important;
  overflow-y: auto !important;
}

.ai-interface.right-collapsed .main-panel {
  opacity: 0;
  overflow: hidden;
  padding: 0;
  min-width: 0;
  pointer-events: none;
}

/* Smooth transition for collapse/expand */
.ai-interface {
  transition: grid-template-columns 0.3s ease;
}

.guardrails-panel,
.main-panel {
  transition: opacity 0.3s ease, padding 0.3s ease;
}

/* Adjust toggle button position on smaller screens */
@media (max-width: 1200px) {
  .ai-interface:not(.left-collapsed) .panel-toggle-container {
    left: calc(40% - 12px);
  }
}

@media (max-width: 768px) {
  .panel-toggle-container {
    display: none; /* Hide on mobile since layout is stacked */
  }
}

/* Legacy support - map old class to new */
.ai-interface.panel-collapsed {
  grid-template-columns: 0fr 3fr;
}

.ai-interface.panel-collapsed .guardrails-panel {
  opacity: 0;
  overflow: hidden;
  padding: 0;
  border: none;
  min-width: 0;
  pointer-events: none;
}

.ai-interface.panel-collapsed .panel-toggle-container {
  left: 0;
}

.ai-interface.panel-collapsed .panel-toggle-btn.left-toggle i {
  transform: rotate(180deg);
}


/* Response Header Right - history and action controls */
.response-header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-left: auto;
}

/* History Toggle */
.history-toggle {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}

.history-toggle input[type="checkbox"] {
  width: 32px;
  height: 18px;
  appearance: none;
  background: var(--border-color);
  border-radius: 9px;
  position: relative;
  cursor: pointer;
  transition: background 0.2s ease;
}

.history-toggle input[type="checkbox"]::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.history-toggle input[type="checkbox"]:checked {
  background: #10b981;
}

.history-toggle input[type="checkbox"]:checked::before {
  transform: translateX(14px);
}

/* Response History Modal */
.history-modal-content {
  max-height: 60vh;
  overflow-y: auto;
}

.history-item {
  background: var(--secondary-bg);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.history-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.history-item-content {
  font-size: 0.9rem;
  max-height: 200px;
  overflow-y: auto;
}

.history-item-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

/* === RAG Documents Section === */
.rag-documents-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-color);
}

.rag-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.rag-header .section-title {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
}

#rag-documents-container {
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.35) transparent;
}

#rag-documents-container::-webkit-scrollbar {
  width: 6px;
}

#rag-documents-container::-webkit-scrollbar-track {
  background: transparent;
}

#rag-documents-container::-webkit-scrollbar-thumb {
  background-color: rgba(255,255,255,0.35);
  border-radius: 6px;
}

.rag-doc-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.25rem;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0.8rem;
}

.rag-doc-item:hover {
  border-color: var(--primary-blue);
  background: var(--hover-bg);
}

.rag-doc-item.selected {
  border-color: var(--primary-blue);
  background: rgba(13, 110, 253, 0.15);
}

.rag-doc-item.selected .rag-doc-name {
  color: var(--primary-blue);
  font-weight: 600;
}

.rag-doc-checkbox {
  width: 16px;
  height: 16px;
  accent-color: var(--primary-blue);
  cursor: pointer;
  flex-shrink: 0;
}

.rag-doc-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-primary);
}

.rag-doc-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  background: var(--primary-blue);
  color: white;
  flex-shrink: 0;
}

.rag-info {
  margin-top: 0.5rem;
  padding: 0.5rem;
  background: rgba(13, 110, 253, 0.1);
  border-radius: 4px;
  color: var(--primary-blue);
}

.rag-info small {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.rag-no-docs {
  text-align: center;
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-style: italic;
}

/* RAG Selection Bar */
.rag-selection-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.5rem;
  background: rgba(13, 110, 253, 0.1);
  border: 1px solid rgba(13, 110, 253, 0.3);
  border-radius: 6px;
}

.rag-selection-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--primary-blue);
  font-size: 0.8rem;
}

.rag-selection-info i {
  font-size: 1rem;
}

/* Selectable document rows */
.document-row.doc-selectable {
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all 0.2s ease;
}

.document-row.doc-selectable:hover {
  background: rgba(13, 110, 253, 0.05);
  border-left-color: rgba(13, 110, 253, 0.3);
}

.document-row.doc-selectable.doc-selected {
  background: rgba(13, 110, 253, 0.15);
  border-left-color: var(--primary-blue);
}

.document-row.doc-selectable.doc-selected .document-title {
  color: var(--primary-blue);
  font-weight: 600;
}

/* === Organization Selector Modal (Super Admin) === */
.org-selector-modal-content {
  position: relative;
  width: min(500px, 95vw);
  max-height: 80vh;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.4);
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.org-selector-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
}

.org-selector-header h5 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.org-selector-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0 0 1rem 0;
}

#org-list {
  max-height: 400px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#org-list .org-item {
  padding: 1rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  background: var(--secondary-bg);
}

#org-list .org-item:hover {
  border-color: var(--primary-blue);
  background: rgba(13, 110, 253, 0.1);
  transform: translateX(4px);
}

#org-list .org-item h3 {
  margin: 0 0 4px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

#org-list .org-item .org-domain {
  font-size: 0.85rem;
  color: var(--text-muted);
}

#org-list .loading-spinner,
#org-list .error-message {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
}

/* === Library Panel Styles === */
.library-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.library-header {
  padding: 0.75rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--secondary-bg);
}

.library-header h6 {
  margin: 0 0 0.5rem 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.library-header h6 i {
  color: var(--primary-blue);
}

.library-filters {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.library-filters .filter-btn {
  padding: 0.25rem 0.5rem;
  font-size: 0.7rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background: var(--card-bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.library-filters .filter-btn:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
}

.library-filters .filter-btn.active {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
  color: white;
}

.library-filters .filter-btn.uc-action-btn {
  color: var(--text-primary, #333);
}

.library-filters .filter-btn.uc-action-btn:hover {
  color: var(--primary-blue);
}

/* ── Use Case Modal ──────────────────────────────────── */
.uc-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 9998;
}
.uc-modal {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%);
  z-index: 9999; background: #fff; border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  width: min(735px, 70vw); display: flex; flex-direction: column; max-height: 92vh;
}
.uc-modal-header {
  display: flex; justify-content: space-between; align-items: center;
  gap: 10px; border-bottom: 1px solid rgba(0,0,0,.08); padding: 12px 16px;
}
.uc-modal-header h3 { margin: 0; font-size: 1rem; flex: 1; }
.uc-modal-close {
  background: transparent; border: 0; color: inherit; font-size: 1.2rem; cursor: pointer;
}
.uc-modal-body { padding: 20px; overflow: auto; flex: 1 1 auto; }
.uc-modal-footer {
  display: flex; gap: 10px; justify-content: space-between; align-items: center;
  padding: 12px 14px; border-top: 1px solid rgba(0,0,0,.08);
}

/* Mode picker cards */
.uc-mode-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 24px 16px; border: 2px solid var(--border-color, #e2e8f0); border-radius: 12px;
  background: #fff; cursor: pointer; transition: all .15s ease; text-align: center;
}
.uc-mode-card:hover { border-color: var(--primary-blue, #3b82f6); background: #f0f7ff; }
.uc-mode-card i { font-size: 2rem; color: var(--primary-blue, #3b82f6); }
.uc-mode-card-wizard i { color: #7c3aed; }
.uc-mode-card-wizard:hover { border-color: #7c3aed; background: #f5f0ff; }
.uc-mode-title { font-weight: 600; font-size: 0.95rem; color: var(--text-primary, #1e293b); }
.uc-mode-desc { font-size: 0.75rem; color: #64748b; }

/* ── Wizard progress bar ─────────────────────────────── */
.ucw-progress {
  display: flex; align-items: center; justify-content: center;
  padding: 12px 16px; background: #f8fafc; border-bottom: 1px solid rgba(0,0,0,.06);
}
.ucw-step { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ucw-circle {
  width: 30px; height: 30px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-weight: 600; border: 2px solid #cbd5e1; color: #94a3b8; background: #fff;
  transition: all .2s ease;
}
.ucw-step.active .ucw-circle { background: var(--primary-blue, #0d6efd); border-color: var(--primary-blue, #0d6efd); color: #fff; }
.ucw-step.completed .ucw-circle { background: #22c55e; border-color: #22c55e; color: #fff; }
.ucw-label { font-size: 0.6rem; color: #94a3b8; white-space: nowrap; }
.ucw-step.active .ucw-label { color: var(--primary-blue, #0d6efd); font-weight: 600; }
.ucw-step.completed .ucw-label { color: #22c55e; }
.ucw-connector { width: 24px; height: 2px; background: #e2e8f0; margin: 0 4px; margin-bottom: 18px; }

/* Wizard body */
.ucw-body { min-height: 300px; }
.ucw-title { font-size: 1.1rem; font-weight: 700; margin: 0 0 4px; color: var(--text-primary, #1e293b); }
.ucw-subtitle { font-size: 0.8rem; color: #64748b; margin: 0 0 16px; }

/* Wizard checkbox grid */
.ucw-checkbox-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.ucw-check-item {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px;
  font-size: 0.8rem; border-radius: 6px; cursor: pointer; transition: background .1s;
}
.ucw-check-item:hover { background: #f1f5f9; }

/* Wizard radio groups */
.ucw-radio-group { display: flex; flex-direction: column; gap: 6px; }
.ucw-radio-horizontal { flex-direction: row; flex-wrap: wrap; gap: 12px; }
.ucw-radio-item {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px;
  font-size: 0.8rem; border-radius: 6px; cursor: pointer; transition: background .1s;
}
.ucw-radio-item:hover { background: #f1f5f9; }

/* Wizard badges */
.ucw-badge {
  display: inline-block; padding: 1px 8px; border-radius: 4px;
  font-size: 0.7rem; font-weight: 600; color: #fff;
}
.ucw-badge-green { background: #22c55e; }
.ucw-badge-yellow { background: #f59e0b; color: #1e293b; }
.ucw-badge-red { background: #ef4444; }
.ucw-badge-dark { background: #334155; }

.library-content {
  flex: 1;
  overflow-y: auto;
  padding: 0.5rem;
}

.library-content .empty-state {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}

.library-content .empty-state i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

.library-content .empty-state p {
  margin: 0.5rem 0 0.25rem;
  font-weight: 500;
}

.library-content .empty-state small {
  font-size: 0.75rem;
}

.library-item {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.6rem;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
}

.library-item:hover {
  border-color: var(--primary-blue);
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

.library-item.expanded {
  background: rgba(13, 110, 253, 0.03);
}

.library-item-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.library-item-model {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-primary);
  background: var(--secondary-bg);
  padding: 0.15rem 0.4rem;
  border-radius: 3px;
}

.template-badge {
  font-size: 0.65rem;
  color: #d4a017;
  background: #fff8e1;
  border: 1px solid #ffe082;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.template-badge i {
  font-size: 0.6rem;
}

.library-item-status {
  font-size: 0.65rem;
  padding: 0.1rem 0.35rem;
  border-radius: 3px;
  margin-left: auto;
  text-transform: capitalize;
}

.library-item-status.status-draft {
  background: #e9ecef;
  color: #6c757d;
}

.library-item-status.status-pending {
  background: #fff3cd;
  color: #856404;
}

.library-item-status.status-approved {
  background: #d1e7dd;
  color: #155724;
}

.library-item-preview {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 0.4rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.library-item.expanded .library-item-preview {
  -webkit-line-clamp: unset;
  white-space: pre-wrap;
}

.library-item-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  flex-wrap: wrap;
}

.use-case-tag {
  background: #e3f2fd;
  color: #1565c0;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.library-item-date {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.library-item-actions {
  display: flex;
  gap: 0.35rem;
  padding-top: 0.4rem;
  border-top: 1px solid var(--border-color);
}

.library-item-actions .btn-use-prompt {
  flex: 1;
  padding: 0.3rem 0.5rem;
  font-size: 0.7rem;
  background: var(--primary-blue);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  transition: background 0.15s ease;
}

.library-item-actions .btn-use-prompt:hover {
  background: #0b5ed7;
}

.library-item-actions .btn-delete-prompt {
  padding: 0.3rem 0.5rem;
  font-size: 0.7rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.library-item-actions .btn-delete-prompt:hover {
  color: #dc3545;
  border-color: #dc3545;
  background: rgba(220, 53, 69, 0.05);
}

#org-list .error-message {
  color: var(--warning-bg);
}

/* ============================================
   Tab Guide / Walkthrough System
   ============================================ */

/* Info button for tab walkthrough */
.tab-guide-bot {
  position: fixed;
  width: 28px;
  height: 28px;
  cursor: pointer;
  z-index: 1000;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  display: none; /* Hidden by default, shown by JS */
  background-color: #2196F3;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.tab-guide-bot i {
  color: #ffffff;
  font-size: 16px;
}

.tab-guide-bot:hover {
  transform: scale(1.1);
  background-color: #1976D2;
  box-shadow: 0 3px 6px rgba(0,0,0,0.3);
}

/* Hide scrollbars during walkthrough */
body.walkthrough-active {
  overflow: hidden !important;
}

body.walkthrough-active .ai-interface,
body.walkthrough-active .main-content-area,
body.walkthrough-active .main-tab-content {
  overflow: hidden !important;
}

/* Spotlight - simple border highlight without overlay */
.guide-spotlight {
  position: fixed;
  border: 3px solid #2196F3;
  border-radius: 8px;
  z-index: 9999;
  transition: all 0.3s ease;
  pointer-events: none;
  display: none;
  background: rgba(33, 150, 243, 0.1);
}

.guide-spotlight.active {
  display: block;
}

/* Tooltip container */
.guide-tooltip {
  position: fixed;
  z-index: 10000;
  max-width: 340px;
  min-width: 280px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  display: none;
  overflow: hidden;
}

.guide-tooltip.active {
  display: block;
  animation: guideTooltipFadeIn 0.3s ease;
}

@keyframes guideTooltipFadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Tooltip header - blue gradient */
.guide-tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: #fff;
}

.guide-tooltip-title {
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
}

.guide-tooltip-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.4rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.guide-tooltip-close:hover {
  opacity: 1;
}

/* Tooltip content */
.guide-tooltip-content {
  padding: 16px;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #374151;
}

/* Tooltip footer */
.guide-tooltip-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
}

/* Progress dots */
.guide-progress {
  display: flex;
  gap: 6px;
}

.guide-progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d1d5db;
  transition: all 0.2s ease;
}

.guide-progress-dot.active {
  background: #3b82f6;
  transform: scale(1.2);
}

.guide-progress-dot.completed {
  background: #10b981;
}

/* Navigation buttons */
.guide-tooltip-actions {
  display: flex;
  gap: 8px;
}

.guide-btn-primary,
.guide-btn-secondary {
  padding: 6px 16px;
  border-radius: 6px;
  border: none;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.guide-btn-secondary {
  background: #e5e7eb;
  color: #374151;
}

.guide-btn-secondary:hover {
  background: #d1d5db;
}

.guide-btn-primary {
  background: #3b82f6;
  color: #fff;
}

.guide-btn-primary:hover {
  background: #2563eb;
}

/* AI Chat Assistant Modal */
.guide-chat-modal {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 380px;
  max-height: 500px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  z-index: 10001;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.guide-chat-modal.active {
  display: flex;
  animation: chatModalSlideIn 0.3s ease;
}

@keyframes chatModalSlideIn {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.guide-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: #fff;
}

.guide-chat-header img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
}

.guide-chat-header h5 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.guide-chat-header p {
  margin: 0;
  font-size: 12px;
  opacity: 0.8;
}

.guide-chat-header .btn-close-chat,
.guide-chat-close {
  margin-left: auto;
  background: rgba(255,255,255,0.2);
  border: none;
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.guide-chat-header .btn-close-chat:hover,
.guide-chat-close:hover {
  background: rgba(255,255,255,0.3);
}

.guide-chat-title {
  font-size: 16px;
  font-weight: 600;
  flex: 1;
}

.guide-chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
}

.guide-chat-body {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.guide-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  background: #f9f9f9;
}

.guide-chat-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.4;
}

.guide-chat-message.bot {
  background: #fff;
  align-self: flex-start;
  border: 1px solid #eee;
  border-bottom-left-radius: 4px;
}

.guide-chat-message.user {
  background: var(--primary-blue);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.guide-chat-message p {
  margin: 0;
}

.guide-chat-input {
  display: flex;
  padding: 12px;
  border-top: 1px solid #eee;
  background: #fff;
}

.guide-chat-input input {
  flex: 1;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 10px 16px;
  font-size: 14px;
  outline: none;
}

.guide-chat-input input:focus {
  border-color: var(--primary-blue);
}

.guide-chat-input button {
  background: var(--primary-blue);
  border: none;
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-left: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.guide-chat-input button:hover {
  background: #0b5ed7;
}

.guide-chat-typing {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: #fff;
  border-radius: 12px;
  align-self: flex-start;
  border: 1px solid #eee;
}

.guide-chat-typing span {
  width: 8px;
  height: 8px;
  background: #aaa;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite;
}

.guide-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.guide-chat-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typingBounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

/* =====================================================
   ALARM NOTIFICATION POPUP
   ===================================================== */

.alarm-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease-out;
    max-width: 380px;
    width: calc(100% - 40px);
}

.alarm-popup.visible {
    opacity: 1;
    transform: translateX(0);
}

.alarm-popup-content {
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a5a 100%);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(238, 90, 90, 0.4), 0 0 0 4px rgba(255, 255, 255, 0.2);
    overflow: hidden;
    animation: alarmPulse 1s ease-in-out infinite;
}

@keyframes alarmPulse {
    0%, 100% { box-shadow: 0 10px 40px rgba(238, 90, 90, 0.4), 0 0 0 4px rgba(255, 255, 255, 0.2); }
    50% { box-shadow: 0 10px 50px rgba(238, 90, 90, 0.6), 0 0 0 8px rgba(255, 255, 255, 0.3); }
}

.alarm-popup-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(0, 0, 0, 0.1);
}

.alarm-icon {
    font-size: 28px;
    color: #fff;
}

.alarm-icon.ringing {
    animation: bellRing 0.5s ease-in-out infinite;
}

@keyframes bellRing {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(15deg); }
    75% { transform: rotate(-15deg); }
}

.alarm-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    flex: 1;
}

.alarm-popup-body {
    padding: 16px 20px;
    color: #fff;
}

.alarm-message {
    font-size: 15px;
    margin: 0 0 8px 0;
    line-height: 1.4;
}

.alarm-time {
    font-size: 13px;
    opacity: 0.85;
    margin: 0;
}

.alarm-popup-actions {
    display: flex;
    gap: 10px;
    padding: 12px 20px 16px;
}

.alarm-popup-actions .btn {
    flex: 1;
    padding: 10px 16px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.alarm-snooze-btn {
    background: rgba(255, 255, 255, 0.25) !important;
    color: #fff !important;
}

.alarm-snooze-btn:hover {
    background: rgba(255, 255, 255, 0.35) !important;
}

.alarm-dismiss-btn {
    background: #fff !important;
    color: #ee5a5a !important;
}

.alarm-dismiss-btn:hover {
    background: #f0f0f0 !important;
}

/* Multiple alarms stack */
.alarm-popup:nth-of-type(2) { top: 180px; }
.alarm-popup:nth-of-type(3) { top: 340px; }
.alarm-popup:nth-of-type(4) { top: 500px; }

/* Mobile responsive */
@media (max-width: 480px) {
    .alarm-popup {
        right: 10px;
        left: 10px;
        width: auto;
        max-width: none;
    }

    .alarm-popup-content {
        border-radius: 12px;
    }

    .alarm-popup-actions {
        flex-direction: column;
    }
}

/* =====================================================
   Risk Matrix Styles
   ===================================================== */

.risk-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.risk-item .risk-title {
    margin-top: 8px;
}

.risk-item:hover {
    background: var(--hover-bg);
}

.risk-item.selected {
    border-color: var(--primary-blue);
    background: rgba(13, 110, 253, 0.05);
}

.risk-title {
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-primary);
    flex: 1;
}

.risk-matrix {
    display: inline-block;
}

.risk-matrix-table {
    border-collapse: collapse;
    border-spacing: 0;
}

.risk-matrix-table td.risk-cell {
    width: 12px;
    height: 12px;
    border: 1px solid #999;
    text-align: center;
    vertical-align: middle;
    cursor: pointer;
    transition: background-color 0.15s;
    font-size: 8px;
    background-color: #fff;
}

.risk-matrix-table td.risk-cell:hover {
    opacity: 0.7;
}

/* Only color the selected cell */
.risk-cell.selected.risk-green {
    background-color: #28a745;
}

.risk-cell.selected.risk-yellow {
    background-color: #ffc107;
}

.risk-cell.selected.risk-red {
    background-color: #dc3545;
}

.risk-cell.selected {
    border: 1px solid #000;
}

.risk-cell.selected i {
    color: #fff;
    font-size: 6px;
    text-shadow: 0 0 1px rgba(0,0,0,0.5);
}

.risk-matrix-wrapper {
    display: flex;
    align-items: center;
    gap: 1px;
}

.risk-matrix-inner {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.risk-axis-label-y {
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    font-size: 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 5px;
}

.risk-axis-label-x {
    font-size: 8px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 1px;
    margin-left: -2px;
}

/* =====================================================
   Welcome Wave Animation
   ===================================================== */

/* Welcome animation highlight effect for nav tabs */
.nav-tab.welcome-highlight,
.admin-tab.welcome-highlight {
    color: #fff !important;
    background: var(--primary-blue) !important;
    border-color: var(--primary-blue) !important;
    box-shadow: 0 0 12px rgba(13, 110, 253, 0.5);
    transform: scale(1.05);
    transition: all 0.1s ease;
}

/* =====================================================
   Gmail Integration Styles
   ===================================================== */

/* Connect Gmail View */
.email-connect-section {
    text-align: center;
    padding: 3rem 2rem;
    background: var(--secondary-bg);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.email-connect-icon {
    font-size: 4rem;
    color: var(--primary-blue);
    margin-bottom: 1rem;
}

.email-connect-section h5 {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
}

.email-connect-section p {
    margin: 0 0 1.5rem;
    font-size: 0.95rem;
}

.email-connect-info {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.email-connect-info small {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.email-compose-fallback {
    padding: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    text-align: center;
}

.email-compose-fallback h6 {
    margin: 0 0 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
}

/* Gmail Layout - Two Column */
.gmail-layout {
    display: grid !important;
    grid-template-columns: 20% 80% !important;
    flex-direction: unset !important;
    gap: 0;
    width: 100%;
    height: calc(100vh - 250px);
    min-height: 400px;
}

.email-container-panel.gmail-layout {
    display: grid !important;
    flex-direction: unset !important;
}

/* Gmail Sidebar */
.gmail-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem;
    background: #f6f8fc;
    border-right: 1px solid var(--border-color);
    border-radius: 8px 0 0 8px;
    overflow-y: auto;
}

.gmail-account {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 0.25rem;
}

.gmail-account i {
    font-size: 1.2rem;
}

.gmail-email {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
}

.btn-compose {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    font-size: 0.9rem;
    font-weight: 500;
    border-radius: 24px;
    margin-bottom: 0.5rem;
}

/* Gmail Folders */
.gmail-folders {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.gmail-folder {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
    color: var(--text-primary);
    border-radius: 0 24px 24px 0;
    cursor: pointer;
    transition: all 0.15s ease;
}

.gmail-folder:hover {
    background: var(--hover-bg);
}

.gmail-folder.active {
    background: rgba(13, 110, 253, 0.15);
    color: var(--primary-blue);
    font-weight: 500;
}

.gmail-folder i {
    width: 18px;
    text-align: center;
    font-size: 0.9rem;
}

.gmail-disconnect {
    margin-top: auto;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.gmail-disconnect .btn {
    width: 100%;
    font-size: 0.75rem;
}

/* Gmail Main Content */
.gmail-main {
    display: flex;
    flex-direction: column;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    overflow: hidden;
}

.gmail-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border-color);
    background: var(--secondary-bg);
}

.gmail-search {
    display: flex;
    flex: 1;
    max-width: 400px;
}

.gmail-search input {
    border-radius: 4px 0 0 4px;
    border-right: none;
}

.gmail-search button {
    border-radius: 0 4px 4px 0;
}

/* Gmail Message List */
.gmail-messages {
    flex: 1;
    overflow-y: auto;
}

.gmail-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--text-muted);
}

.gmail-empty i {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.gmail-message-row {
    display: grid;
    grid-template-columns: 150px 1fr 80px;
    gap: 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: background-color 0.15s;
    font-size: 0.875rem;
}

.gmail-message-row:hover {
    background: var(--hover-bg);
}

.gmail-message-row.unread {
    background: rgba(13, 110, 253, 0.03);
    font-weight: 600;
}

.gmail-message-row.unread .gmail-message-sender {
    font-weight: 600;
}

.gmail-message-sender {
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.gmail-message-content {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.gmail-message-subject {
    color: var(--text-primary);
}

.gmail-message-snippet {
    color: var(--text-muted);
}

.gmail-message-date {
    text-align: right;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Gmail Pagination */
.gmail-pagination {
    display: flex;
    justify-content: center;
    padding: 0.75rem;
    border-top: 1px solid var(--border-color);
}

/* Email Message View */
.email-message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.email-message-actions {
    display: flex;
    gap: 0.5rem;
}

.email-message-content {
    flex: 1;
    overflow-y: auto;
}

.email-message-subject {
    margin: 0 0 1rem;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
}

.email-message-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.email-message-meta > div {
    margin-bottom: 0.25rem;
}

.email-message-body {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-primary);
}

.email-message-body pre {
    white-space: pre-wrap;
    word-break: break-word;
    font-family: inherit;
    margin: 0;
}

/* Email Header */
.email-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.email-header .email-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.email-header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Connected Emails Bar */
.connected-emails-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.connected-emails-bar .bar-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.connected-email-btn {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.25rem 0.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.connected-email-btn:hover {
    border-color: var(--primary-blue);
    background: rgba(13, 110, 253, 0.05);
}

.connected-email-btn i {
    font-size: 0.85rem;
}

.add-email-btn {
    padding: 0.25rem 0.4rem !important;
    font-size: 0.7rem !important;
}

/* Email Panel Header */
.email-panel-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.email-panel-header h6 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

/* Connected Accounts Section */
.connected-accounts-section {
    margin-bottom: 1.5rem;
}

.section-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-label i {
    color: var(--primary-blue);
}

.connected-accounts-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.connected-account {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.connected-account-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.9rem;
}

.connected-account-info i {
    font-size: 1.25rem;
}

.connected-account-actions {
    display: flex;
    gap: 0.5rem;
}

/* Available Providers Section */
.available-providers-section {
    margin-bottom: 1.5rem;
}

.providers-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0.75rem;
}

.provider-btn {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.provider-btn:hover:not(.disabled) {
    border-color: var(--primary-blue);
    background: rgba(13, 110, 253, 0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.provider-btn.disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.provider-btn i {
    font-size: 1.5rem;
}

.coming-soon-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #6c757d;
    color: white;
    font-size: 0.6rem;
    padding: 0.15rem 0.4rem;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
}

/* Mobile Responsive - Gmail/Email */
@media (max-width: 768px) {
    .gmail-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .gmail-sidebar {
        flex-direction: row;
        flex-wrap: wrap;
        padding: 0.5rem;
    }

    .gmail-account {
        width: 100%;
        border-bottom: none;
        padding-bottom: 0.5rem;
    }

    .btn-compose {
        flex: 1;
    }

    .gmail-folders {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.25rem;
    }

    .gmail-folder {
        border-radius: 16px;
        padding: 0.4rem 0.6rem;
        font-size: 0.75rem;
    }

    .gmail-disconnect {
        margin-top: 0;
        padding-top: 0;
        border-top: none;
    }

    .gmail-message-row {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .gmail-message-date {
        text-align: left;
        font-size: 0.75rem;
    }

    .email-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .email-header-right {
        width: 100%;
        justify-content: space-between;
    }

    .providers-grid {
        grid-template-columns: 1fr;
    }

    .connected-emails-bar {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* AI Model Dropdown Styling */
#ai-model-select {
    border: 1px solid #6c757d !important;
    background-color: #e3f0fc !important;
}

#ai-model-select:focus {
    border-color: #2196F3 !important;
    box-shadow: 0 0 0 0.2rem rgba(33, 150, 243, 0.25) !important;
}

/* Admin-only elements: hidden by default, shown when body has is-admin class */
.admin-only-btn,
.admin-only-item {
    display: none !important;
}
body.is-admin .admin-only-btn {
    display: flex !important;
}
body.is-admin .admin-only-item {
    display: inline-flex !important;
}

/* Consistent sizing for Edit/Delete/View action buttons across all tabs */
.document-actions .btn {
    padding: 2px 6px;
    font-size: 11px;
    line-height: 1;
}

.risk-item {
    display: flex;
    align-items: center;
}

/* =====================================================================
   Governance Module - Committee Layout
   ===================================================================== */

.gov-interface {
    display: grid;
    grid-template-columns: 2fr 3fr;
    gap: 1.5rem;
    height: 100%;
    overflow: hidden;
}

.gov-left-panel {
    display: flex;
    flex-direction: column;
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 10px;
    overflow: hidden;
}

.gov-left-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    background: var(--secondary-bg, #f8f9fa);
}

.gov-left-header h6 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.gov-committees-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.gov-right-panel {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 10px;
    overflow-y: auto;
    padding: 20px;
}

/* Documents right panel: iframe fills available space */
#gov-documents .gov-right-panel {
    padding: 0 !important;
    overflow: hidden !important;
}

#gov-documents .gov-right-panel iframe {
    width: 100%;
    height: calc(100vh - 250px);
    border: none;
    display: block;
}

/* Committee Cards */
.gc-card {
    padding: 12px 14px;
    border: 2px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.gc-card:hover {
    background: #dbeafe;
    border-color: #3b82f6;
}


.gc-card.selected,
.gc-card.gc-card-active {
    background: #dbeafe;
    border-color: #2563eb;
    box-shadow: 0 0 0 1px #2563eb;
}

}

.gc-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.gc-card-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary, #333);
}

.gc-card-meta {
    display: flex;
    gap: 12px;
    font-size: 11px;
    color: var(--text-muted, #888);
}

.gc-card-meta i {
    margin-right: 3px;
}

/* Status Badges - ribbon icon style */
.gc-status-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
    background: none;
    padding: 0;
}

.gc-status-active {
    color: #166534;
}

.gc-status-inactive {
    color: #92400e;
}

.gc-status-dissolved {
    color: #991b1b;
}

/* Type Badge */
.gc-type-badge {
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
    color: #3730a3;
    background: none;
    padding: 0;
    margin-left: 8px;
}

/* Detail View */
.gc-detail-view {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.gc-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 12px;
}

.gc-detail-header h5 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
}

.gc-detail-actions {
    display: flex;
    gap: 6px;
}

.gc-detail-desc {
    font-size: 13px;
    color: var(--text-muted, #666);
    margin-bottom: 12px;
    line-height: 1.5;
}

.gc-detail-info {
    display: flex;
    gap: 20px;
    font-size: 13px;
    color: var(--text-muted, #666);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-color, #eee);
}

.gc-detail-info i {
    margin-right: 4px;
    color: #6366f1;
}

/* Committee Tabs (Members / Meetings) */
.gc-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}

.gc-tab-btn {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border-color, #ddd);
    border-radius: 8px;
    background: var(--card-bg, #fff);
    color: var(--text-muted, #666);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.15s;
}

.gc-tab-btn:hover {
    background: var(--hover-bg, #f5f5f5);
    border-color: #999;
}

.gc-tab-btn.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.gc-tab-content {
    flex: 1;
    overflow-y: auto;
}

/* Members List - v2 bordered rows */
.gc-member-row-v2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    gap: 12px;
}

/* Side-by-side panels for meetings + members */
.gc-side-panel {
    background: var(--card-bg, #fff);
    border: 1px solid var(--border-color, #e0e0e0);
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    overflow-y: auto;
    max-height: 60vh;
}

/* Committee detail tabs */
div.gc-tabs {
    display: block !important;
    border: 1px solid #d1d5db !important;
    border-radius: 8px !important;
    background: #fff !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06) !important;
    overflow: hidden !important;
}
div.gc-tab-bar {
    display: flex !important;
    flex-direction: row !important;
    background: #f1f5f9 !important;
    border-bottom: 1px solid #d1d5db !important;
    height: 36px !important;
    overflow: hidden !important;
}
div.gc-tab-bar > button.gc-tab {
    all: unset !important;
    flex: 1 1 0 !important;
    height: 36px !important;
    line-height: 36px !important;
    text-align: center !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    color: #64748b !important;
    cursor: pointer !important;
    border-right: 1px solid #d1d5db !important;
    box-sizing: border-box !important;
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
}
div.gc-tab-bar > button.gc-tab:last-child {
    border-right: none !important;
}
div.gc-tab-bar > button.gc-tab:hover {
    background: rgba(0,0,0,0.04) !important;
    color: #334155 !important;
}
div.gc-tab-bar > button.gc-tab.active {
    color: #1565c0 !important;
    background: #fff !important;
    box-shadow: inset 0 -2px 0 #1565c0 !important;
}
div.gc-tabs > div.gc-tab-panel {
    display: none !important;
    padding: 16px !important;
    overflow-y: auto !important;
    max-height: 55vh !important;
}
div.gc-tabs > div.gc-tab-panel.active {
    display: block !important;
}

/* Template toggle switch */
.gov-toggle-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    user-select: none;
}

.gov-toggle-switch {
    width: 32px;
    height: 18px;
    background: #cbd5e1;
    border-radius: 9px;
    position: relative;
    transition: background 0.2s;
}

.gov-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 14px;
    height: 14px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
}

.gov-toggle-switch.active {
    background: #2563eb;
}

.gov-toggle-switch.active::after {
    transform: translateX(14px);
}

.gov-toggle-label {
    font-size: 12px;
    color: var(--text-muted, #64748b);
}

/* Committee type group header */
.gc-type-group-header {
    padding: 6px 16px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    background: var(--secondary-bg, #f1f5f9);
    border-bottom: 1px solid var(--border-color, #e0e0e0);
    letter-spacing: 0.5px;
}

/* Template status badge */
.gc-status-template {
    color: #4338ca;
}

/* Placeholder & Empty States */
.gc-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted, #999);
    text-align: center;
}

.gc-placeholder i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.gc-placeholder p {
    font-size: 14px;
}

.gc-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted, #999);
}

.gc-empty i {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.gc-empty p {
    margin-bottom: 12px;
    font-size: 13px;
}

.gc-empty-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px;
    text-align: center;
    color: var(--text-muted, #999);
}

.gc-empty-tab p {
    margin-bottom: 12px;
    font-size: 13px;
}

/* ===== DASHBOARD FLIP CARDS ===== */

/* Click image to flip; click back or another card to unflip */
.flip-card.image-hovered .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card .flip-card-back {
  cursor: pointer;
}

/* ===== USER MANAGEMENT ===== */
.um-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.um-modal {
    background: #fff;
    border-radius: 12px;
    width: 95%;
    max-width: 1100px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.um-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    border-bottom: 1px solid #e0e0e0;
}

.um-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #1a1a2e;
}

.um-header h4 i {
    color: #2563eb;
    margin-right: 8px;
}

.um-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    border-bottom: 1px solid #f0f0f0;
    background: #fafafa;
}

.um-search-bar {
    flex: 1;
    display: flex;
    align-items: center;
    background: #fff;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    padding: 0 10px;
}

.um-search-bar i {
    color: #999;
    margin-right: 8px;
}

.um-search-bar input {
    border: none;
    outline: none;
    padding: 8px 0;
    font-size: 14px;
    width: 100%;
    background: transparent;
}

.um-toolbar select {
    padding: 8px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
}

.um-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

.um-count {
    padding: 8px 24px;
    font-size: 13px;
    color: #666;
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
    border-radius: 0 0 12px 12px;
}

.um-loading, .um-empty, .um-error {
    padding: 40px;
    text-align: center;
    color: #999;
    font-size: 15px;
}

.um-error {
    color: #dc3545;
}

.um-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.um-table thead th {
    position: sticky;
    top: 0;
    background: #f8f9fa;
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #555;
    border-bottom: 2px solid #e0e0e0;
}

.um-table tbody td {
    padding: 10px 14px;
    border-bottom: 1px solid #f0f0f0;
    vertical-align: middle;
}

.um-table tbody tr:hover {
    background: #f8f9fe;
}

.um-row-terminated {
    opacity: 0.5;
}

.um-name-cell {
    font-weight: 500;
}

.um-roles-cell {
    max-width: 220px;
}

.um-actions-cell {
    white-space: nowrap;
    display: flex;
    gap: 4px;
}

.um-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    text-transform: capitalize;
}

.um-badge-active {
    background: #d4edda;
    color: #155724;
}

.um-badge-leave {
    background: #fff3cd;
    color: #856404;
}

.um-badge-terminated {
    background: #f8d7da;
    color: #721c24;
}

.um-role-badge {
    display: inline-block;
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 11px;
    background: #e8eaf6;
    color: #3949ab;
    margin: 1px 2px;
}

/* User Form Modal */
.um-form-modal {
    background: #fff;
    border-radius: 12px;
    width: 95%;
    max-width: 650px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.um-reset-modal {
    max-width: 500px;
}

.um-form-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}

.um-form-row {
    display: flex;
    gap: 16px;
}

.um-form-row > .um-form-group {
    flex: 1;
}

.um-form-group {
    margin-bottom: 14px;
}

.um-form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: #444;
    margin-bottom: 4px;
}

.um-form-group input[type="text"],
.um-form-group input[type="email"],
.um-form-group input[type="password"],
.um-form-group select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d0d0d0;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.um-form-group input:focus,
.um-form-group select:focus {
    border-color: #2563eb;
    outline: none;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}

.um-form-section {
    margin-top: 8px;
}

.um-form-section h6 {
    font-size: 14px;
    font-weight: 600;
    color: #333;
    margin-bottom: 10px;
}

.um-form-section h6 i {
    color: #2563eb;
    margin-right: 6px;
}

.um-form-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 24px;
    border-top: 1px solid #e0e0e0;
    background: #fafafa;
    border-radius: 0 0 12px 12px;
}

.um-checkbox-label {
    display: flex !important;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-weight: 400 !important;
}

.um-checkbox-label input[type="checkbox"] {
    width: auto !important;
}

.um-password-wrapper {
    position: relative;
    display: flex;
}

.um-password-wrapper input {
    flex: 1;
    padding-right: 38px !important;
}

.um-password-toggle {
    position: absolute;
    right: 2px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #888;
    cursor: pointer;
    padding: 6px 8px;
}

.um-password-toggle:hover {
    color: #333;
}

.um-app-roles {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
}

.um-app-label {
    min-width: 140px;
    font-weight: 500;
    font-size: 13px;
    color: #333;
    padding-top: 2px;
}

.um-role-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
}

.um-roles-container {
    max-height: 200px;
    overflow-y: auto;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    padding: 8px 12px;
}

/* Admin icon in header */
#header-admin-btn {
    margin-right: 4px;
}

