/* ==========================================================
   SSO Portal — professional enterprise theme
   Typography: Inter · 15px base · slate text hierarchy
   Accent: #1570ef · hairline borders · soft elevation
   ========================================================== */

:root {
    /* Text */
    --ink: #101828;            /* primary text      */
    --ink-soft: #344054;       /* secondary text    */
    --muted: #667085;          /* tertiary text     */
    --faint: #98a2b3;          /* placeholder-grade */

    /* Brand */
    --navy: #0f1f38;           /* card header gradient start */
    --navy-deep: #081226;      /* card header gradient end   */
    --accent: #1570ef;
    --accent-hover: #1158c4;
    --accent-soft: rgba(21, 112, 239, 0.08);
    --accent-ring: rgba(21, 112, 239, 0.18);

    /* Surfaces */
    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-alt: #f9fafb;
    --line: #e6e9ef;
    --line-strong: #d0d5dd;
}

html {
    font-size: 14.4px;              /* 90% of 16px — uniform text scale-down */
    position: relative;
    min-height: 100%;
}

body {
    background-color: var(--bg);
    color: var(--ink);
    font-family: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", system-ui, sans-serif;
    font-size: 0.9375rem;              /* 15px — enterprise standard */
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

::selection {
    background: rgba(21, 112, 239, 0.15);
}

a {
    color: var(--accent);
    text-decoration: none;
    transition: color 0.12s ease;
}

a:hover {
    color: var(--accent-hover);
    text-decoration: none;
}

/* Accessible focus ring everywhere. */
a:focus-visible,
.btn:focus-visible,
.form-control:focus-visible,
.form-select:focus-visible,
.form-check-input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--ink);
    font-weight: 600;
    letter-spacing: -0.01em;
}

/* ---------- Buttons ---------- */

.btn {
    --bs-btn-border-radius: 8px;
    align-items: center;
    display: inline-flex;
    font-weight: 500;
    font-size: 0.875rem;
    gap: 0.45rem;
    justify-content: center;
    letter-spacing: 0.005em;
    transition: background-color 0.12s ease, border-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.btn svg {
    flex-shrink: 0;
}

.btn-primary {
    --bs-btn-bg: var(--accent);
    --bs-btn-border-color: var(--accent);
    --bs-btn-hover-bg: var(--accent-hover);
    --bs-btn-hover-border-color: var(--accent-hover);
    --bs-btn-active-bg: var(--accent-hover);
    --bs-btn-active-border-color: var(--accent-hover);
    --bs-btn-disabled-bg: var(--accent);
    --bs-btn-disabled-border-color: var(--accent);
    --bs-btn-focus-shadow-rgb: 21, 112, 239;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

.btn-primary:hover {
    box-shadow: 0 2px 4px rgba(16, 24, 40, 0.12);
}

.btn-outline-secondary {
    --bs-btn-color: var(--ink-soft);
    --bs-btn-border-color: var(--line-strong);
    --bs-btn-hover-bg: var(--surface-alt);
    --bs-btn-hover-border-color: var(--line-strong);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-active-bg: var(--surface-alt);
    --bs-btn-active-color: var(--ink);
    --bs-btn-active-border-color: var(--line-strong);
}

.btn-link {
    --bs-btn-color: var(--accent);
    --bs-btn-hover-color: var(--accent-hover);
    font-weight: 500;
    text-decoration: none;
}

/* Quiet row-level action buttons (tables, detail footers). */
.btn-row {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 7px;
    color: var(--ink-soft);
    display: inline-flex;
    font-size: 0.8125rem;
    font-weight: 500;
    gap: 0.3rem;
    padding: 0.28rem 0.6rem;
    text-decoration: none;
    transition: background-color 0.12s ease, color 0.12s ease;
    white-space: nowrap;
}

.btn-row svg {
    flex-shrink: 0;
    opacity: 0.75;
}

.btn-row:hover {
    background-color: var(--accent-soft);
    color: var(--accent-hover);
}

.btn-row:hover svg {
    opacity: 1;
}

.btn-row-danger:hover {
    background-color: #fef3f2;
    color: #b42318;
}

.btn-row.disabled,
.btn-row:disabled {
    color: var(--faint);
    opacity: 1;
    pointer-events: none;
}

/* ---------- Forms ---------- */

.form-control,
.form-select {
    border-color: var(--line-strong);
    border-radius: 8px;
    color: var(--ink);
    font-size: 0.9375rem;
    padding: 0.45rem 0.75rem;
    transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

.form-control::placeholder {
    color: var(--faint);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-ring);
}

.form-label {
    color: var(--ink-soft);
    font-size: 0.8125rem;
    font-weight: 550;
    margin-bottom: 0.375rem;
}

.form-text {
    color: var(--muted);
    font-size: 0.8125rem;
}

.form-check-input {
    border-color: var(--line-strong);
}

.form-check-input:checked {
    background-color: var(--accent);
    border-color: var(--accent);
}

/* ---------- Navbar ---------- */

.app-navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    padding-block: 0.7rem;
}

.app-navbar .navbar-brand {
    color: var(--ink);
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.brand-accent {
    color: var(--accent);
    font-weight: 650;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    color: #ffffff;
    background: linear-gradient(135deg, #3b8bff, #1570ef);
    box-shadow: 0 1px 3px rgba(21, 112, 239, 0.35);
}

.app-navbar .nav-link {
    color: var(--ink-soft);
    font-size: 0.875rem;
    font-weight: 550;
    padding-inline: 0.9rem;
    transition: color 0.12s ease-in-out;
}

.app-navbar .nav-link:hover,
.app-navbar .nav-link:focus {
    color: var(--ink);
}

.app-navbar .nav-account {
    padding-inline: 0.5rem 0.75rem;
}

.nav-user-name {
    color: var(--ink);
    font-size: 0.875rem;
    font-weight: 550;
    white-space: nowrap;
}

.btn-nav-outline {
    --bs-btn-color: var(--ink-soft);
    --bs-btn-border-color: var(--line-strong);
    --bs-btn-hover-bg: var(--surface-alt);
    --bs-btn-hover-border-color: var(--line-strong);
    --bs-btn-hover-color: var(--ink);
    --bs-btn-active-bg: var(--surface-alt);
    --bs-btn-active-color: var(--ink);
    font-size: 0.8125rem;
    font-weight: 600;
}

/* ---------- Page heading ---------- */

.page-heading {
    margin-bottom: 1.5rem;
}

.eyebrow {
    display: inline-block;
    text-transform: uppercase;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.page-title {
    color: var(--ink);
    font-size: 1.375rem;                /* 22px — restrained, professional */
    font-weight: 600;
    letter-spacing: -0.015em;
    margin-bottom: 0.375rem;
}

.page-subtitle {
    color: var(--muted);
    font-size: 0.9375rem;
    max-width: 36rem;
    margin: 0 auto;
}

/* ---------- Panels ---------- */

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 1.375rem 1.625rem;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
}

.search-panel {
    margin-bottom: 1.375rem;
}

.search-panel .form-label {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
}

.search-panel .input-group-text {
    background-color: var(--surface-alt);
    border-color: var(--line-strong);
    color: var(--muted);
}

.search-panel .form-control {
    border-color: var(--line-strong);
}

.search-panel .form-text {
    color: var(--muted);
    font-size: 0.8125rem;
    margin-top: 0.5rem;
}

/* ---------- Alerts ---------- */

.alert-app {
    align-items: flex-start;
    border: 1px solid transparent;
    border-left-width: 3px;
    border-radius: 10px;
    display: flex;
    font-size: 0.875rem;
    gap: 0.625rem;
    margin-bottom: 1rem;
    padding: 0.875rem 1.125rem;
}

.alert-app svg {
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.alert-app-danger {
    background-color: #fef3f2;
    border-color: #fecdca;
    border-left-color: #d92d20;
    color: #912018;
}

.alert-app-warning {
    background-color: #fffaeb;
    border-color: #fedf89;
    border-left-color: #f79009;
    color: #7a2e0e;
}

.alert-app-success {
    background-color: #ecfdf3;
    border-color: #abefc6;
    border-left-color: #17b26a;
    color: #085d3a;
}

.alert-app-info {
    background-color: #eff4ff;
    border-color: #c7d9f5;
    border-left-color: var(--accent);
    color: #1a4bad;
}

.detail-flag {
    color: #c2410c;
    margin-left: 0.45rem;
    vertical-align: -0.2rem;
}

/* ---------- Employee result card ---------- */

.employee-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06), 0 1px 2px rgba(16, 24, 40, 0.04);
    overflow: hidden;
}

.employee-card-header {
    align-items: center;
    background: linear-gradient(120deg, var(--navy), var(--navy-deep));
    color: #ffffff;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1.375rem 1.625rem;
}

.avatar {
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 50%;
    display: flex;
    font-size: 1.05rem;
    font-weight: 700;
    height: 54px;
    justify-content: center;
    letter-spacing: 0.04em;
    width: 54px;
}

.employee-name {
    color: #ffffff;   /* sits on the navy card-header gradient */
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 0;
}

.employee-role {
    color: rgba(255, 255, 255, 0.68);
    font-size: 0.8438rem;
    margin-top: 0.15rem;
}

.status-badge {
    border-radius: 999px;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 0.35rem 0.75rem;
    text-transform: uppercase;
}

.status-active {
    background-color: rgba(23, 178, 106, 0.18);
    border: 1px solid rgba(110, 226, 173, 0.35);
    color: #75e0a7;
}

.status-inactive {
    background-color: rgba(152, 162, 179, 0.16);
    border: 1px solid rgba(203, 213, 225, 0.28);
    color: #cbd5e1;
}

.status-locked {
    background-color: rgba(217, 45, 32, 0.22);
    border: 1px solid rgba(253, 205, 202, 0.4);
    color: #fecdc9;
}

.status-pending {
    background-color: rgba(247, 144, 9, 0.2);
    border: 1px solid rgba(254, 223, 137, 0.45);
    color: #fdd27d;
}

.employee-card-body {
    padding: 1.375rem 1.625rem 1.5rem;
}

/* Neutralize Bootstrap .row negative margins inside the card body. */
.detail-grid {
    margin-inline: 0;
    row-gap: 0.25rem;
}

.detail-col-left {
    flex: 0 0 44%;
    max-width: 44%;
    padding-right: 1.25rem;
}

.detail-col-right {
    flex: 0 0 56%;
    max-width: 56%;
    padding-left: 1.25rem;
}

@media (max-width: 767.98px) {
    .detail-col-left,
    .detail-col-right {
        flex: 0 0 100%;
        max-width: 100%;
        padding-inline: 0;
    }
}

.detail-item {
    border-bottom: 1px solid var(--surface-alt);
    padding: 0.5rem 0.5rem;
}

.detail-col-left .detail-item:last-child,
.detail-col-right .detail-item:last-child {
    border-bottom: none;
}

.detail-label {
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    margin-bottom: 0.25rem;
    text-transform: uppercase;
}

.detail-value {
    color: var(--ink);
    font-size: 0.875rem;
    font-weight: 500;
    overflow-wrap: anywhere;
}

.status-label {
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.6875rem;
    font-weight: 650;
    letter-spacing: 0.07em;
    text-transform: uppercase;
}

/* ---------- System access ---------- */

.employee-card-footer {
    background-color: var(--surface-alt);
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: flex-end;
    padding: 0.9rem 1.625rem;
}

.access-panel-header {
    align-items: flex-start;
    border-bottom: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 1.125rem;
}

.access-employee-name {
    font-size: 1rem;
    font-weight: 600;
}

.access-employee-code {
    color: var(--muted);
    font-size: 0.8125rem;
    margin-top: 0.15rem;
}

.access-list-label {
    margin-bottom: 0.5rem;
}

.system-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    list-style: none;
    margin: 0;
    padding: 0;
}

.system-chip {
    align-items: center;
    background-color: var(--accent-soft);
    border: 1px solid rgba(21, 112, 239, 0.22);
    border-radius: 999px;
    color: var(--accent-hover);
    display: inline-flex;
    font-size: 0.75rem;
    font-weight: 500;
    gap: 0.4rem;
    letter-spacing: 0.02em;
    padding: 0.4rem 0.8rem;
}

.system-chip svg {
    color: #17b26a;
}

/* ---------- Footer ---------- */

.app-footer {
    background: var(--surface);
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.8125rem;
    padding: 1rem 0;
}

.app-footer a {
    color: var(--muted);
    text-decoration: none;
}

.app-footer a:hover {
    color: var(--accent);
}

/* ---------- Role badges & status pills ---------- */

.role-badge {
    border-radius: 999px;
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    padding: 0.25rem 0.55rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.role-admin {
    background-color: rgba(21, 112, 239, 0.1);
    border: 1px solid rgba(21, 112, 239, 0.3);
    color: var(--accent-hover);
}

.role-user {
    background-color: rgba(102, 112, 133, 0.1);
    border: 1px solid rgba(102, 112, 133, 0.25);
    color: var(--ink-soft);
}

.app-navbar .role-admin {
    background-color: rgba(21, 112, 239, 0.14);
    border-color: rgba(21, 112, 239, 0.4);
    color: var(--accent);
}

.app-navbar .role-user {
    background-color: rgba(102, 112, 133, 0.12);
    border-color: rgba(102, 112, 133, 0.3);
    color: var(--ink-soft);
}

.pill {
    border-radius: 999px;
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.01em;
    padding: 0.25rem 0.65rem;
    white-space: nowrap;
}

.pill-active {
    background-color: #ecfdf3;
    border: 1px solid #abefc6;
    color: #085d3a;
}

.pill-inactive {
    background-color: #f9fafb;
    border: 1px solid var(--line);
    color: var(--ink-soft);
}

.pill-locked {
    background-color: #fef3f2;
    border: 1px solid #fecdca;
    color: #912018;
}

.pill-expired {
    background-color: #f9fafb;
    border: 1px solid var(--line);
    color: var(--muted);
}

.pill-pending {
    background-color: #fffaeb;
    border: 1px solid #fedf89;
    color: #7a2e0e;
}

.pill-warning {
    background-color: #fffaeb;
    border: 1px solid #fedf89;
    color: #7a2e0e;
}

/* ---------- Users table ---------- */

.panel.table-responsive,
.table-users {
    --bs-table-bg: transparent;
}

.table-users {
    --bs-table-border-color: var(--line);
    --bs-table-hover-bg: var(--surface-alt);
    margin-bottom: 0;
}

.table-users thead th {
    background-color: var(--surface-alt);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    padding: 0.55rem 0.875rem;
    text-transform: uppercase;
    white-space: nowrap;
}

.table-users thead th:first-child {
    padding-left: 1.25rem;
}

.table-users thead th:last-child {
    padding-right: 1.25rem;
}

.table-users tbody td {
    border-bottom: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 0.875rem;
    padding: 0.65rem 0.875rem;
    vertical-align: middle;
}

.table-users tbody td:first-child {
    padding-left: 1.25rem;
}

.table-users tbody td:last-child {
    padding-right: 1rem;
}

.table-users tbody tr:hover td {
    background-color: var(--surface-alt);
}

.table-users tbody tr:last-child td {
    border-bottom: none;
}

.user-cell-name {
    color: var(--ink);
    font-weight: 550;
}

.user-cell-sub {
    color: var(--muted);
    font-size: 0.8125rem;
}

/* ---------- Forms & panels ---------- */

/* Password field with a show/hide (eye) toggle sitting inside the control's
   right edge, so the input keeps its full width and border. */
.password-field {
    position: relative;
}

.password-field > .form-control {
    padding-right: 2.75rem;
}

/* Suppress the browser's built-in "show password" affordance so it doesn't double
   up with our custom eye toggle. Chrome/Edge render their eye via the Blink/WebKit
   shadow-DOM decoration container; IE and legacy Edge use -ms-reveal. */
.password-field > .form-control::-webkit-textfield-decoration-container,
.password-field > .form-control::-ms-reveal,
.password-field > .form-control::-ms-clear {
    display: none;
    -webkit-appearance: none;
    appearance: none;
}

.password-field-toggle {
    position: absolute;
    top: 50%;
    right: 0.375rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.password-field-toggle:hover {
    color: var(--accent);
    background-color: var(--surface-alt);
}

/* Matches the accessible focus-ring convention applied to .btn / .form-control. */
.password-field-toggle:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 1px;
}

.auth-panel {
    margin-inline: auto;
    max-width: 26rem;
}

.form-panel .form-label {
    color: var(--ink-soft);
    font-size: 0.8125rem;
    font-weight: 600;
}

.form-actions {
    border-top: 1px solid var(--line);
    display: flex;
    gap: 0.625rem;
    margin-top: 1.375rem;
    padding-top: 1.25rem;
}

.back-link {
    color: var(--muted);
    display: inline-block;
    font-size: 0.8438rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    text-decoration: none;
}

.back-link:hover {
    color: var(--accent);
}

/* ---------- Pagination ---------- */

.pagination {
    --bs-pagination-border-width: 0;
    --bs-pagination-border-radius: 8px;
    --bs-pagination-color: var(--ink-soft);
    --bs-pagination-font-size: 0.8125rem;
    --bs-pagination-padding-x: 0.7rem;
    --bs-pagination-padding-y: 0.3rem;
    --bs-pagination-bg: transparent;
    --bs-pagination-hover-bg: var(--surface-alt);
    --bs-pagination-hover-color: var(--ink);
    --bs-pagination-focus-bg: var(--surface-alt);
    --bs-pagination-focus-color: var(--accent);
    --bs-pagination-focus-box-shadow: 0 0 0 3px var(--accent-ring);
    --bs-pagination-active-bg: var(--accent);
    --bs-pagination-active-border-color: var(--accent);
    --bs-pagination-disabled-bg: transparent;
    --bs-pagination-disabled-color: var(--faint);
    gap: 0.25rem;
    margin-bottom: 0;
}

.page-link {
    border-radius: 8px;
    font-weight: 500;
}

/* Hide empty validation summaries that carry the alert styling. */
.validation-summary-valid {
    display: none;
}

/* ---------- Employee Number autocomplete ---------- */

.autocomplete-suggestions {
    background-color: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 24px -8px rgba(16, 24, 40, 0.14), 0 2px 6px rgba(16, 24, 40, 0.06);
    left: 0;
    margin-top: 0.25rem;
    max-height: 16rem;
    overflow-y: auto;
    position: absolute;
    right: 0;
    top: 100%;
    z-index: 1050;
}

.autocomplete-suggestions .list-group-item {
    border-color: var(--line);
    color: var(--ink-soft);
    font-size: 0.875rem;
}

.autocomplete-suggestions .list-group-item.active {
    background-color: var(--accent-soft);
    border-color: var(--line);
    color: var(--accent-hover);
}

/* ---------- AI Query Agent ---------- */

.ai-chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 280px);
    min-height: 400px;
    max-height: 700px;
}

.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.ai-welcome-message {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--muted);
}

.ai-welcome-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 16px;
    background: var(--accent-soft);
    color: var(--accent);
    margin-bottom: 1rem;
}

.ai-welcome-message h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: 0.5rem;
}

.ai-welcome-message p {
    margin-bottom: 0.75rem;
}

.ai-welcome-message ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.ai-welcome-message li {
    background: var(--surface-alt);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.625rem 1rem;
    font-size: 0.875rem;
    color: var(--ink-soft);
    cursor: pointer;
    transition: all 0.15s ease;
}

.ai-welcome-message li:hover {
    background: var(--accent-soft);
    border-color: var(--accent-ring);
    color: var(--accent-hover);
}

.ai-message {
    display: flex;
    gap: 0.75rem;
    max-width: 100%;
}

.ai-message-user {
    justify-content: flex-end;
}

.ai-message-user .ai-message-content {
    background: var(--accent);
    color: white;
    border-radius: 16px 16px 4px 16px;
    padding: 0.75rem 1rem;
    max-width: 70%;
    font-size: 0.9375rem;
}

.ai-message-ai {
    justify-content: flex-start;
}

.ai-message-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: var(--accent-soft);
    color: var(--accent);
    flex-shrink: 0;
}

.ai-message-ai .ai-message-content {
    background: var(--surface-alt);
    border: 1px solid var(--line);
    border-radius: 4px 16px 16px 16px;
    padding: 1rem;
    max-width: 85%;
    flex: 1;
}

.ai-sql-block {
    background: #1e293b;
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin-bottom: 0.75rem;
    overflow-x: auto;
}

.ai-sql-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    margin-bottom: 0.5rem;
}

.ai-sql-block pre {
    margin: 0;
    font-family: 'SF Mono', 'Monaco', 'Consolas', monospace;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-break: break-word;
}

.ai-sql-block code {
    font-family: inherit;
}

.ai-result-table-wrapper {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-bottom: 0.5rem;
}

.ai-result-table {
    width: 100%;
    font-size: 0.8125rem;
    border-collapse: collapse;
}

.ai-result-table th {
    background: var(--surface-alt);
    font-weight: 600;
    text-align: left;
    padding: 0.625rem 0.75rem;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
    color: var(--ink-soft);
}

.ai-result-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ai-result-table tbody tr:last-child td {
    border-bottom: none;
}

.ai-result-table tbody tr:hover {
    background: var(--surface-alt);
}

.null-value {
    color: var(--faint);
    font-style: italic;
}

.ai-result-count {
    font-size: 0.75rem;
    color: var(--muted);
    text-align: right;
}

.ai-no-results {
    padding: 1rem;
    text-align: center;
    color: var(--muted);
    background: var(--surface-alt);
    border-radius: 8px;
}

.ai-error {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: #fef3f2;
    border: 1px solid #fecdca;
    border-radius: 8px;
    color: #b42318;
    font-size: 0.875rem;
}

.ai-error svg {
    flex-shrink: 0;
    margin-top: 0.125rem;
}

.ai-loading {
    display: flex;
    gap: 4px;
    padding: 0.5rem 0;
}

.ai-loading-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    animation: ai-loading-bounce 1.4s infinite ease-in-out both;
}

.ai-loading-dot:nth-child(1) { animation-delay: -0.32s; }
.ai-loading-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes ai-loading-bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.ai-chat-input-area {
    border-top: 1px solid var(--line);
    padding: 1rem 1.5rem;
    background: var(--surface);
}

.ai-query-form {
    margin-bottom: 0.5rem;
}

.ai-input-wrapper {
    display: flex;
    gap: 0.5rem;
}

.ai-input {
    flex: 1;
    border-radius: 10px !important;
    padding: 0.75rem 1rem !important;
    font-size: 0.9375rem !important;
}

.ai-input:focus {
    box-shadow: 0 0 0 3px var(--accent-ring) !important;
}

.ai-submit-btn {
    border-radius: 10px;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    min-width: 80px;
}

.ai-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.ai-disclaimer {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    font-size: 0.75rem;
    color: var(--muted);
}

.ai-disclaimer svg {
    flex-shrink: 0;
}

/* Mobile adjustments */
@media (max-width: 576px) {
    .ai-chat-container {
        height: calc(100vh - 320px);
    }

    .ai-message-user .ai-message-content,
    .ai-message-ai .ai-message-content {
        max-width: 90%;
    }

    .ai-input-wrapper {
        flex-direction: column;
    }

    .ai-submit-btn {
        width: 100%;
    }
}
