/* =====================================================================
   Bopet Agent 宠物医院智能体后台 Styles
   ===================================================================== */

/* =====================================================================
   Medical Work Platform Design System
   ---------------------------------------------------------------------
   This layer adapts the Linear-style density and hairline discipline into
   a quiet clinical operations surface. The product is a medical work
   platform, so the defaults favor light surfaces, blue-green trust colors,
   readable tables, explicit semantic states, and long-session comfort.
   ===================================================================== */
:root {
    --medical-canvas: #f1f5f5;
    --medical-panel: #ffffff;
    --medical-panel-soft: #f8fbfb;
    --medical-panel-muted: #eef5f5;
    --medical-line: #d9e5e5;
    --medical-line-strong: #b8cccc;
    --medical-ink: #1f3437;
    --medical-ink-muted: #52676b;
    --medical-ink-subtle: #73878b;
    --medical-primary: #168982;
    --medical-primary-strong: #0f6f6a;
    --medical-primary-soft: #e8f7f5;
    --medical-info: #2563eb;
    --medical-info-soft: #eff6ff;
    --medical-success: #15803d;
    --medical-success-soft: #ecfdf3;
    --medical-warning: #b45309;
    --medical-warning-soft: #fffbeb;
    --medical-danger: #dc2626;
    --medical-danger-soft: #fef2f2;
    --medical-sidebar: #ffffff;
    --medical-sidebar-soft: #f4f8f8;
    --medical-radius: 2px;
    --medical-radius-sm: 2px;
    --medical-focus: 0 0 0 3px rgba(22, 137, 130, 0.18);
}

html {
    font-size: 15px;
    letter-spacing: 0;
}

body {
    background: var(--medical-canvas) !important;
    color: var(--medical-ink) !important;
    letter-spacing: 0 !important;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body, button, input, textarea, select {
    font-size: 15px;
    line-height: 1.5;
}

#app {
    background: var(--medical-canvas);
}

/* Sidebar: quiet clinical navigation tree, not a marketing dark canvas. */
#sidebar {
    width: 236px !important;
    background: var(--medical-sidebar) !important;
    color: var(--medical-ink-muted) !important;
    border-right: 1px solid var(--medical-line);
}

#sidebar .border-white\/10 {
    border-color: var(--medical-line) !important;
}

#sidebar .text-neutral-500,
#sidebar .text-neutral-400,
#sidebar .text-neutral-300 {
    color: var(--medical-ink-subtle) !important;
}

#sidebar .text-neutral-600 {
    color: #8a9da1 !important;
}

#sidebar .text-white {
    color: var(--medical-ink) !important;
}

#sidebar .bg-sky-500,
#login-overlay .bg-sky-500 {
    background: var(--medical-primary) !important;
}

.sidebar-item {
    border-radius: var(--medical-radius-sm) !important;
    min-height: 34px;
}

.sidebar-item:hover {
    background: #f3f8f8 !important;
    color: var(--medical-ink) !important;
}

.sidebar-item.active {
    background: #e8f7f5 !important;
    color: var(--medical-primary-strong) !important;
    box-shadow: inset 3px 0 0 var(--medical-primary);
}

.sidebar-item.active .item-icon {
    color: var(--medical-primary-strong) !important;
}

#main-content > header {
    height: 56px !important;
    background: #ffffff !important;
    border-bottom-color: var(--medical-line) !important;
    box-shadow: none;
    backdrop-filter: none;
}

#theme-toggle {
    display: none !important;
}

#main-content > header,
#main-content > header .text-slate-500,
#main-content > header .text-slate-600,
#main-content > header .dark\:text-slate-300,
#main-content > header .dark\:text-slate-400 {
    color: var(--medical-ink-muted) !important;
}

.dark #main-content > header {
    background: #ffffff !important;
    border-bottom-color: var(--medical-line) !important;
}

#content-area {
    background: var(--medical-canvas);
}

/* Minimum readable text sizes for clinical data screens. */
.view .text-xs,
#sidebar .text-xs,
header .text-xs,
.confirm-message,
.confirm-btn,
.session-panel,
.cfg-dropdown-selected,
.cfg-dropdown-menu,
table,
input,
select,
textarea,
button {
    font-size: 14px !important;
}

.view p,
.view td,
.view input,
.view select,
.view textarea {
    color: inherit;
}

.view h2 {
    font-size: 22px !important;
    font-weight: 650 !important;
    color: var(--medical-ink) !important;
    letter-spacing: 0 !important;
}

.view h3 {
    letter-spacing: 0 !important;
}

.view .rounded-xl,
.view .rounded-2xl,
.view .rounded-lg,
.view .rounded-md,
.view .rounded-full,
#login-overlay .rounded-xl,
#login-overlay .rounded-2xl {
    border-radius: 0 !important;
}

/* Work-surface cards and panels. */
.view .bg-white,
.session-panel,
.confirm-modal,
#login-overlay .bg-white {
    background-color: var(--medical-panel) !important;
}

.view .dark\:bg-\[\#1A1A1A\],
.view .dark\:bg-\[\#151C25\],
.view .dark\:bg-\[\#111\] {
    background-color: var(--medical-panel) !important;
}

.view .border-slate-200,
.view .dark\:border-white\/10,
.session-panel,
.confirm-modal {
    border-color: var(--medical-line) !important;
}

.view .shadow-2xl {
    box-shadow: none !important;
}

.view .shadow-lg,
.view .shadow-md,
.view .shadow-sm {
    box-shadow: none !important;
}

/* Tables: core workflow component. */
.view table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: var(--medical-panel);
}

.view thead {
    background: #eef5f5 !important;
}

.view thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #496166 !important;
    font-size: 14px !important;
    font-weight: 650 !important;
    letter-spacing: 0 !important;
    text-transform: none !important;
    border-bottom: 1px solid var(--medical-line-strong);
}

.view tbody tr {
    transition: background-color 0.12s ease;
}

.view tbody tr:hover {
    background: #f3fafa !important;
}

.view tbody td {
    color: #30474c !important;
    border-bottom: 1px solid #edf3f3;
    vertical-align: top;
}

.view .divide-slate-100 > :not([hidden]) ~ :not([hidden]) {
    border-color: #edf3f3 !important;
}

/* Form controls and filters. */
.view input,
.view select,
.view textarea,
#login-overlay input,
.cfg-dropdown-selected {
    min-height: 38px;
    border-color: var(--medical-line) !important;
    background: #fbfdfd !important;
    color: var(--medical-ink) !important;
    border-radius: var(--medical-radius-sm) !important;
}

.view textarea {
    min-height: 78px;
}

.view input:focus,
.view select:focus,
.view textarea:focus,
#login-overlay input:focus,
.cfg-dropdown.open .cfg-dropdown-selected,
.cfg-dropdown:focus .cfg-dropdown-selected {
    outline: none !important;
    border-color: var(--medical-primary) !important;
    box-shadow: var(--medical-focus) !important;
}

.view input::placeholder,
.view textarea::placeholder,
#login-overlay input::placeholder {
    color: #8aa0a4 !important;
}

/* Primary actions: deep teal, restrained. */
.view .bg-primary-400,
.view .bg-primary-500,
#login-overlay .bg-primary-500,
.confirm-btn-ok {
    background-color: var(--medical-primary) !important;
}

.view .hover\:bg-primary-500:hover,
.view .hover\:bg-primary-600:hover,
#login-overlay .hover\:bg-primary-600:hover,
.confirm-btn-ok:hover {
    background-color: var(--medical-primary-strong) !important;
}

.view .text-primary-500,
.view .text-primary-600,
.view .dark\:text-primary-300,
.view .dark\:text-primary-400,
.view .dark\:text-primary-500 {
    color: var(--medical-primary-strong) !important;
}

.view .bg-primary-50,
.view .dark\:bg-primary-900\/20,
.view .dark\:bg-primary-900\/30 {
    background-color: var(--medical-primary-soft) !important;
}

.view .border-primary-200,
.view .dark\:border-primary-900\/50 {
    border-color: #a9d8d5 !important;
}

/* Semantic colors: red only for real medical/operational risks. */
.view .bg-red-50 { background-color: var(--medical-danger-soft) !important; }
.view .text-red-500,
.view .text-red-600,
.view .text-red-700 { color: var(--medical-danger) !important; }
.view .bg-red-500,
.view .hover\:bg-red-600:hover { background-color: var(--medical-danger) !important; }

.view .bg-amber-50,
.view .bg-yellow-50\/70 { background-color: var(--medical-warning-soft) !important; }
.view .text-amber-500,
.view .text-amber-600,
.view .text-amber-700 { color: var(--medical-warning) !important; }

.view .bg-emerald-50,
.view .bg-green-50 { background-color: var(--medical-success-soft) !important; }
.view .text-emerald-500,
.view .text-emerald-600,
.view .text-emerald-700,
.view .text-green-600,
.view .text-green-700 { color: var(--medical-success) !important; }

.view .bg-blue-50,
.view .bg-sky-50 { background-color: var(--medical-info-soft) !important; }
.view .text-blue-500,
.view .text-blue-600,
.view .text-blue-700,
.view .text-sky-500,
.view .text-sky-600,
.view .text-sky-700 { color: var(--medical-info) !important; }

/* Non-semantic decorative hues are neutralized for medical screens. */
.view .bg-purple-50,
.view .bg-violet-50,
.view .bg-pink-50,
.view .bg-orange-50 {
    background-color: #f3f7f7 !important;
}

.view .text-purple-500,
.view .text-purple-600,
.view .text-purple-700,
.view .text-violet-500,
.view .text-violet-600,
.view .text-violet-700,
.view .text-pink-500,
.view .text-pink-600,
.view .text-pink-700,
.view .text-orange-500,
.view .text-orange-600,
.view .text-orange-700 {
    color: #52676b !important;
}

/* Detail drawers should read like medical charts, with clear source/time/status. */
#appointment-detail-drawer,
#pet-profile-detail-drawer,
#admin-user-create-drawer,
#admin-user-edit-drawer {
    background: var(--medical-panel) !important;
    border-left-color: var(--medical-line) !important;
}

#appointment-detail-body .rounded-lg,
#pet-profile-detail-body .rounded-lg {
    background: #f8fbfb !important;
    border-color: var(--medical-line) !important;
}

.medical-summary-card {
    background: linear-gradient(180deg, #f9fcfc 0%, #f2f8f8 100%) !important;
    border: 1px solid var(--medical-line) !important;
}

.medical-summary-metric {
    min-height: 72px;
    border: 1px solid var(--medical-line) !important;
    background: #ffffff !important;
}

.medical-queue-item {
    border: 1px solid transparent;
    background: #fbfdfd;
}

.medical-queue-item:hover {
    border-color: var(--medical-line);
    background: #f4f9f9 !important;
}

.medical-queue-item.active {
    border-color: #7fc6c1;
    background: #e8f7f5 !important;
    box-shadow: inset 3px 0 0 var(--medical-primary);
}

.medical-queue-avatar {
    border: 1px solid var(--medical-line);
    background: #ffffff !important;
    color: var(--medical-primary-strong) !important;
}

.medical-data-card {
    border: 1px solid var(--medical-line) !important;
    background: #ffffff !important;
}

.medical-data-card > .medical-data-card-head {
    background: #f7fbfb;
    border-bottom: 1px solid var(--medical-line);
}

.medical-inline-stat {
    border: 1px solid var(--medical-line) !important;
    background: #ffffff !important;
}

.medical-table-cell-label {
    display: inline-block;
    margin-bottom: 6px;
    font-size: 11px !important;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #7a9093 !important;
}

.medical-action-stack {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 6px;
}

/* Login: clinical access gate. */
#login-overlay {
    background: #edf8f9 !important;
}

#login-overlay h1 {
    color: var(--medical-ink) !important;
    letter-spacing: 0 !important;
}

/* Clinical workbench density: flatten floating cards into bordered regions. */
.view > .flex-1.overflow-y-auto.p-6 {
    padding: 16px !important;
}

.view .max-w-7xl,
.view .max-w-6xl,
.view .max-w-5xl,
.view .max-w-4xl {
    max-width: none !important;
}

.view .bg-white.border,
.view .bg-white.dark\:bg-\[\#1A1A1A\],
.view .overflow-hidden.bg-white {
    box-shadow: none !important;
    border-radius: 0 !important;
}

#view-dashboard .grid.mb-6 {
    gap: 0 !important;
    border: 1px solid var(--medical-line);
    background: var(--medical-panel);
}

#view-dashboard .grid.mb-6 > div {
    border: 0 !important;
    border-right: 1px solid var(--medical-line) !important;
    border-bottom: 1px solid var(--medical-line) !important;
    border-radius: 0 !important;
    padding: 14px 16px !important;
}

#view-dashboard .grid.mb-6 > div:last-child {
    border-right: 0 !important;
    border-bottom: 0 !important;
}

@media (min-width: 640px) {
    #view-dashboard .grid.mb-6 > div:nth-last-child(-n+2) {
        border-bottom: 0 !important;
    }
}

@media (min-width: 1280px) {
    #view-dashboard .grid.mb-6 > div {
        border-bottom: 0 !important;
    }
    #view-dashboard .grid.mb-6 > div:last-child {
        border-right: 0 !important;
    }
}

#view-dashboard .grid.mb-6 .w-12.h-12,
#view-dashboard .w-10.h-10,
#view-dashboard .w-9.h-9 {
    width: 34px !important;
    height: 34px !important;
    border-radius: 0 !important;
    background: #f4f8f8 !important;
    border: 1px solid var(--medical-line);
}

#view-dashboard .text-3xl,
#view-dashboard .text-2xl,
#view-dashboard .text-lg,
.view .text-3xl,
.view .text-2xl {
    letter-spacing: 0 !important;
}

#view-dashboard .text-3xl {
    font-size: 24px !important;
    line-height: 1.15 !important;
}

#view-dashboard .grid.grid-cols-1.xl\:grid-cols-\[minmax\(0\,1fr\)_360px\],
#view-dashboard .grid.grid-cols-1.xl\:grid-cols-\[minmax\(0\,1fr\)_360px\].mt-4 {
    gap: 12px !important;
}

#view-dashboard [id^="dashboard-"] + .divide-y,
#dashboard-recent-appointments,
#dashboard-status-board,
#dashboard-service-mix {
    background: var(--medical-panel);
}

#view-appointments .bg-white,
#view-pet_profiles .bg-white,
#view-customers .bg-white,
#view-admin_users .bg-white,
#view-service_records .bg-white,
#view-service_record_editor .bg-white,
#view-completed_visits .bg-white,
#view-doctor_workspace .bg-white,
#view-beauty_workspace .bg-white {
    border-radius: 0 !important;
}

#view-appointments .overflow-hidden,
#view-pet_profiles .overflow-hidden,
#view-customers .overflow-hidden,
#view-admin_users .overflow-hidden,
#view-service_records .overflow-hidden,
#view-service_record_editor .overflow-hidden,
#view-completed_visits .overflow-hidden {
    border-radius: 0 !important;
}

#view-appointments .flex.flex-col.lg\:flex-row,
#view-pet_profiles .flex.flex-col.lg\:flex-row {
    gap: 8px !important;
}

#view-appointments input,
#view-appointments select,
#view-pet_profiles input,
#view-pet_profiles select,
#view-service_records input,
#view-service_records select,
#view-service_records textarea,
#view-service_record_editor input,
#view-service_record_editor select,
#view-service_record_editor textarea,
#view-completed_visits input,
#view-completed_visits select,
#view-admin_users input,
#view-admin_users select,
#view-customers input,
#view-customers textarea {
    min-height: 34px !important;
    padding-top: 6px !important;
    padding-bottom: 6px !important;
}

#appointment-detail-drawer,
#pet-profile-detail-drawer,
#admin-user-create-drawer,
#admin-user-edit-drawer {
    max-width: min(760px, 100vw) !important;
    border-radius: 0 !important;
}

#appointment-detail-drawer .p-5,
#pet-profile-detail-drawer .p-5 {
    padding: 14px !important;
}

#appointment-detail-body .grid,
#pet-profile-detail-body .grid {
    gap: 8px !important;
}

#appointment-detail-body .rounded-lg,
#pet-profile-detail-body .rounded-lg,
#appointment-detail-body .rounded-xl,
#pet-profile-detail-body .rounded-xl {
    border-radius: 0 !important;
    padding: 10px !important;
}

#view-doctor_workspace .rounded-xl,
#view-doctor_workspace .rounded-lg,
#view-beauty_workspace .rounded-xl,
#view-beauty_workspace .rounded-lg {
    border-radius: 0 !important;
}

#view-doctor_workspace .bg-\[\#F7FAFA\],
#view-doctor_workspace .dark\:bg-\[\#0E141B\] {
    background: #f3f7f7 !important;
}

#view-doctor_workspace .h-\[calc\(100vh-9rem\)\] {
    border-radius: 0 !important;
}

.view button {
    border-radius: var(--medical-radius-sm) !important;
}

.view .inline-flex.items-center.px-2,
.view .inline-flex.items-center.px-2\.5 {
    border-radius: var(--medical-radius-sm) !important;
    border: 1px solid rgba(15, 69, 70, 0.08);
}

/* Animations */
@keyframes pulseDot {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
    40% { transform: scale(1); opacity: 1; }
}

/* Scrollbar */
* { scrollbar-width: thin; scrollbar-color: #94a3b8 transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }
.dark ::-webkit-scrollbar-thumb { background: #475569; }
.dark ::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* Generic Tooltip (via data-tooltip attribute) */
[data-tooltip] {
    position: relative;
}
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 8px);
    transform: translateX(-50%);
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    white-space: nowrap;
    background: #1e293b;
    color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease;
    z-index: 100;
}
[data-tooltip-pos="bottom"]::after {
    bottom: auto;
    top: calc(100% + 8px);
}
.dark [data-tooltip]::after {
    background: #334155;
    color: #f1f5f9;
}
[data-tooltip]:hover::after {
    opacity: 1;
}
[data-tooltip=""]:hover::after {
    display: none;
}

/* Sidebar */
.sidebar-item.active {
    background: rgba(255, 255, 255, 0.08);
    color: #FFFFFF;
}
.sidebar-item.active .item-icon { color: #4ABE6E; }

/* Session Panel */
.session-panel {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background: #fafafa;
    border-right: 1px solid #e5e7eb;
    height: 100vh;
    overflow: hidden;
    transition: width 0.2s ease;
}
.dark .session-panel {
    background: #111111;
    border-right-color: rgba(255, 255, 255, 0.08);
}
.session-panel.hidden { display: none; }
.session-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
}
.dark .session-panel-header { border-bottom-color: rgba(255, 255, 255, 0.08); }
.session-panel-title {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}
.dark .session-panel-title { color: #d1d5db; }
.session-panel-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    border: none;
    background: none;
    color: #9ca3af;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    font-size: 12px;
}
.session-panel-close:hover {
    background: #f3f4f6;
    color: #374151;
}
.dark .session-panel-close:hover {
    background: rgba(255, 255, 255, 0.08);
    color: #e5e5e5;
}
.session-panel-new {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 10px 12px;
    padding: 8px 14px;
    border-radius: 8px;
    border: 1px dashed #d1d5db;
    background: none;
    color: #6b7280;
    font-size: 13px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    flex-shrink: 0;
}
.session-panel-new:hover {
    border-color: #9ca3af;
    color: #374151;
    background: #f9fafb;
}
.dark .session-panel-new {
    border-color: rgba(255, 255, 255, 0.12);
    color: #9ca3af;
}
.dark .session-panel-new:hover {
    border-color: rgba(255, 255, 255, 0.25);
    color: #e5e5e5;
    background: rgba(255, 255, 255, 0.04);
}

/* Session List */
.session-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px;
    scrollbar-width: none;
}
.session-list:hover { scrollbar-width: thin; }
.session-list::-webkit-scrollbar { width: 4px; background: transparent; }
.session-list::-webkit-scrollbar-thumb { background: transparent; border-radius: 2px; }
.session-list:hover::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.2); }
.dark .session-list:hover::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); }
.session-group-label {
    padding: 10px 8px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #9ca3af;
}
.dark .session-group-label { color: #525252; }
.session-empty {
    padding: 20px 12px;
    text-align: center;
    font-size: 13px;
    color: #9ca3af;
}
.session-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    margin: 1px 0;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    color: #6b7280;
    font-size: 13px;
    position: relative;
}
.dark .session-item { color: #a3a3a3; }
.session-item:hover {
    background: #f3f4f6;
    color: #111827;
}
.dark .session-item:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e5e5e5;
}
.session-item.active {
    background: #e5e7eb;
    color: #111827;
}
.dark .session-item.active {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}
.session-icon {
    flex-shrink: 0;
    font-size: 11px;
    color: #9ca3af;
    width: 16px;
    text-align: center;
}
.dark .session-icon { color: #525252; }
.session-item.active .session-icon { color: #4ABE6E; }
.session-title {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.session-delete {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    font-size: 10px;
    color: #9ca3af;
    opacity: 0;
    transition: opacity 0.15s, color 0.15s, background 0.15s;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}
.session-item:hover .session-delete { opacity: 1; }
.session-delete:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}
.dark .session-delete:hover { background: rgba(239, 68, 68, 0.15); }

/* Context Divider */
.context-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 24px;
    color: #9ca3af;
}
.context-divider::before, .context-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #d9e5e5;
}
.dark .context-divider::before, .dark .context-divider::after {
    background: rgba(255,255,255,0.12);
}
.context-divider span {
    font-size: 12px;
    white-space: nowrap;
    color: #9ca3af;
}

/* Confirm Modal */
.confirm-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: opacity 0.2s ease;
}
.confirm-overlay.visible { opacity: 1; }
.confirm-modal {
    background: #fff;
    border-radius: 14px;
    width: 380px;
    max-width: 90vw;
    padding: 28px 24px 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.18);
    transform: scale(0.92);
    transition: transform 0.2s ease;
}
.confirm-overlay.visible .confirm-modal { transform: scale(1); }
.dark .confirm-modal {
    background: #1e1e1e;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.confirm-title {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
}
.dark .confirm-title { color: #e5e7eb; }
.confirm-message {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 24px;
}
.dark .confirm-message { color: #9ca3af; }
.confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}
.confirm-btn {
    padding: 8px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all 0.15s ease;
}
.confirm-btn-cancel {
    background: #f3f4f6;
    color: #374151;
}
.confirm-btn-cancel:hover { background: #e5e7eb; }
.dark .confirm-btn-cancel {
    background: rgba(255, 255, 255, 0.08);
    color: #d1d5db;
}
.dark .confirm-btn-cancel:hover { background: rgba(255, 255, 255, 0.14); }
.confirm-btn-ok {
    background: #ef4444;
    color: #fff;
}
.confirm-btn-ok:hover { background: #dc2626; }

/* Session panel overlay (mobile only, click to close) */
.session-panel-overlay {
    display: none;
}
@media (max-width: 768px) {
    .session-panel-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 44;
        background: rgba(0, 0, 0, 0.3);
    }
    .session-panel-overlay.hidden {
        display: none;
    }
}

/* Mobile: session panel as overlay */
@media (max-width: 768px) {
    .session-panel {
        position: fixed;
        top: 0;
        left: 0;
        z-index: 45;
        width: 220px;
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }
    .dark .session-panel {
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.4);
    }
}

/* Menu Groups */
.menu-group-items { max-height: 0; overflow: hidden; transition: max-height 0.25s ease-out; }
.menu-group.open .menu-group-items { max-height: 2000px; transition: max-height 0.35s ease-in; }
.menu-group .chevron { transition: transform 0.25s ease; }
.menu-group.open .chevron { transform: rotate(90deg); }

/* View Switching */
.view { display: none; height: 100%; }
.view.active { display: flex; flex-direction: column; }

/* Markdown Content */
.msg-content p { margin: 0.5em 0; line-height: 1.7; }
.msg-content p:first-child { margin-top: 0; }
.msg-content p:last-child { margin-bottom: 0; }
.msg-content h1, .msg-content h2, .msg-content h3,
.msg-content h4, .msg-content h5, .msg-content h6 {
    margin-top: 1.2em; margin-bottom: 0.6em; font-weight: 600; line-height: 1.3;
}
.msg-content h1 { font-size: 1.4em; }
.msg-content h2 { font-size: 1.25em; }
.msg-content h3 { font-size: 1.1em; }
.msg-content ul { margin: 0.5em 0; padding-left: 1.8em; list-style: disc; }
.msg-content ol { margin: 0.5em 0; padding-left: 1.8em; list-style: decimal; }
.msg-content li { margin: 0.25em 0; }
.msg-content pre {
    border-radius: 8px; overflow-x: auto; margin: 0.8em 0;
    background: #f1f5f9; padding: 1em;
}
.dark .msg-content pre { background: #111111; }
.msg-content code {
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.875em;
}
.msg-content :not(pre) > code {
    background: rgba(74, 190, 110, 0.1); color: #1C6B3B;
    padding: 2px 6px; border-radius: 4px;
}
.dark .msg-content :not(pre) > code {
    background: rgba(74, 190, 110, 0.15); color: #74E9A4;
}
.msg-content pre code { background: transparent; padding: 0; color: inherit; }
.msg-content blockquote {
    border-left: 3px solid #4ABE6E; padding: 0.5em 1em;
    margin: 0.8em 0; background: rgba(74, 190, 110, 0.05); border-radius: 0 6px 6px 0;
}
.dark .msg-content blockquote { background: rgba(74, 190, 110, 0.08); }
.msg-content table { border-collapse: collapse; width: 100%; margin: 0.8em 0; }
.msg-content th, .msg-content td {
    border: 1px solid #e2e8f0; padding: 8px 12px; text-align: left;
}
.dark .msg-content th, .dark .msg-content td { border-color: rgba(255,255,255,0.1); }
.msg-content th { background: #f1f5f9; font-weight: 600; }
.dark .msg-content th { background: #111111; }
.msg-content img { max-width: 100%; height: auto; border-radius: 8px; margin: 0.5em 0; }
.msg-content a { color: #35A85B; text-decoration: underline; }
.msg-content a:hover { color: #228547; }

/* Overrides for user bubble (white text on green bg) */
.user-bubble.msg-content a { color: #ffffff !important; text-decoration: underline; text-decoration-color: rgba(255,255,255,0.6); }
.user-bubble.msg-content a:hover { color: #e0f5e8 !important; text-decoration-color: #e0f5e8; }
.user-bubble.msg-content :not(pre) > code { background: rgba(255,255,255,0.2); color: #ffffff; }
.msg-content hr { border: none; height: 1px; background: #e2e8f0; margin: 1.2em 0; }
.dark .msg-content hr { background: rgba(255,255,255,0.1); }

/* SSE Streaming cursor */
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.sse-streaming::after {
    content: '▋';
    display: inline-block;
    margin-left: 2px;
    color: #4ABE6E;
    animation: blink 0.9s step-end infinite;
    font-size: 0.85em;
    vertical-align: middle;
}

/* Agent steps (thinking summaries + tool indicators) */
.agent-steps:empty { display: none; }
.agent-steps:not(:empty) {
    margin-bottom: 0.625rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.08);
}
.dark .agent-steps:not(:empty) { border-bottom-color: rgba(255, 255, 255, 0.08); }

.agent-step {
    font-size: 0.75rem;
    line-height: 1.4;
    color: #94a3b8;
    margin-bottom: 0.25rem;
}
.agent-step:last-child { margin-bottom: 0; }

/* Thinking step - collapsible */
.agent-thinking-step .thinking-header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    user-select: none;
}
.agent-thinking-step .thinking-header:hover { color: #64748b; }
.dark .agent-thinking-step .thinking-header:hover { color: #cbd5e1; }
.agent-thinking-step .thinking-header i:first-child { font-size: 0.625rem; margin-top: 1px; }
.agent-thinking-step .thinking-chevron {
    font-size: 0.5rem;
    margin-left: auto;
    transition: transform 0.2s ease;
    opacity: 0.5;
}
.agent-thinking-step.expanded .thinking-chevron { transform: rotate(90deg); }
.agent-thinking-step .thinking-full {
    display: none;
    margin-top: 0.375rem;
    margin-left: 1rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.04);
    font-size: 0.75rem;
    line-height: 1.5;
    color: #94a3b8;
    max-height: 300px;
    overflow-y: auto;
}
.dark .agent-thinking-step .thinking-full {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.04);
}
.agent-thinking-step.expanded .thinking-full { display: block; }
.agent-thinking-step .thinking-full p { margin: 0.25em 0; }
.agent-thinking-step .thinking-full p:first-child { margin-top: 0; }
.agent-thinking-step .thinking-full p:last-child { margin-bottom: 0; }
.agent-thinking-step .thinking-duration {
    font-size: 0.625rem;
    color: #b0b8c4;
    margin-bottom: 0.375rem;
}
/* Streaming reasoning: render as plain pre to avoid expensive markdown
   re-parsing on every chunk. Wrap long lines so the bubble width is
   respected and use the same font size/color as the rendered version. */
.agent-thinking-step .thinking-stream-pre {
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    font-family: inherit;
    font-size: inherit;
    line-height: 1.5;
    color: inherit;
    white-space: pre-wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

/* Content step - real text output frozen before tool calls */
.agent-content-step {
    font-size: 0.875rem;
    line-height: 1.6;
    color: inherit;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.06);
}
.dark .agent-content-step { border-bottom-color: rgba(255, 255, 255, 0.06); }
.agent-content-step .agent-content-body p { margin: 0.25em 0; }
.agent-content-step .agent-content-body p:first-child { margin-top: 0; }
.agent-content-step .agent-content-body p:last-child { margin-bottom: 0; }

/* Tool step - collapsible */
.agent-tool-step .tool-header {
    display: flex;
    align-items: center;
    gap: 0.375rem;
    cursor: pointer;
    user-select: none;
    padding: 1px 0;
    border-radius: 4px;
}
.agent-tool-step .tool-header:hover { color: #64748b; }
.dark .agent-tool-step .tool-header:hover { color: #cbd5e1; }
.agent-tool-step .tool-icon { font-size: 0.625rem; }
.agent-tool-step .tool-chevron {
    font-size: 0.5rem;
    margin-left: auto;
    transition: transform 0.2s ease;
    opacity: 0.5;
}
.agent-tool-step.expanded .tool-chevron { transform: rotate(90deg); }
.agent-tool-step .tool-time {
    font-size: 0.65rem;
    opacity: 0.6;
    margin-left: 0.25rem;
}

/* Tool detail panel */
.agent-tool-step .tool-detail {
    display: none;
    margin-top: 0.375rem;
    margin-left: 1rem;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.02);
    border-radius: 6px;
    border: 1px solid rgba(0, 0, 0, 0.04);
}
.dark .agent-tool-step .tool-detail {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.04);
}
.agent-tool-step.expanded .tool-detail { display: block; }
.tool-detail-section { margin-bottom: 0.375rem; }
.tool-detail-section:last-child { margin-bottom: 0; }
.tool-detail-label {
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.6;
    margin-bottom: 0.125rem;
}
.tool-detail-content {
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    font-size: 0.7rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 200px;
    overflow-y: auto;
    margin: 0;
    padding: 0.25rem 0;
    background: transparent;
    color: inherit;
}
.tool-error-text { color: #f87171; }

/* Log level highlighting */
.log-line { display: block; }
.log-line-debug    { color: #94a3b8; }
.log-line-info     { background-color: rgba(59, 130, 246, 0.08); }
.log-line-warning  { background-color: rgba(234, 179, 8, 0.15); color: #fde68a; }
.log-line-error    { background-color: rgba(239, 68, 68, 0.15); color: #fca5a5; }
.log-line-critical { background-color: rgba(239, 68, 68, 0.35); color: #ff4444; font-weight: bold;  }

/* Tool failed state */
.agent-tool-step.tool-failed .tool-name { color: #f87171; }

/* Config form controls */
#view-config input[type="text"],
#view-config input[type="number"],
#view-config input[type="password"] {
    height: 40px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
#view-config input:focus {
    border-color: #4ABE6E;
    box-shadow: 0 0 0 3px rgba(74, 190, 110, 0.12);
}
#view-config input[type="text"]:hover,
#view-config input[type="number"]:hover,
#view-config input[type="password"]:hover {
    border-color: #94a3b8;
}
.dark #view-config input[type="text"]:hover,
.dark #view-config input[type="number"]:hover,
.dark #view-config input[type="password"]:hover {
    border-color: #64748b;
}

/* Custom dropdown */
.cfg-dropdown {
    position: relative;
    outline: none;
}
.cfg-dropdown-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 40px;
    padding: 0 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 0.875rem;
    color: #1e293b;
    cursor: pointer;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    user-select: none;
}
.dark .cfg-dropdown-selected {
    border-color: #475569;
    background: rgba(255, 255, 255, 0.05);
    color: #f1f5f9;
}
.cfg-dropdown-selected:hover { border-color: #94a3b8; }
.dark .cfg-dropdown-selected:hover { border-color: #64748b; }
.cfg-dropdown.open .cfg-dropdown-selected,
.cfg-dropdown:focus .cfg-dropdown-selected {
    border-color: #4ABE6E;
    box-shadow: 0 0 0 3px rgba(74, 190, 110, 0.12);
}
.cfg-dropdown-arrow {
    font-size: 0.625rem;
    color: #94a3b8;
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-left: 0.5rem;
}
.cfg-dropdown.open .cfg-dropdown-arrow { transform: rotate(180deg); }
.cfg-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 50;
    max-height: 240px;
    overflow-y: auto;
    border-radius: 0.5rem;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 4px 10px -5px rgba(0, 0, 0, 0.04);
    padding: 4px;
}
.dark .cfg-dropdown-menu {
    border-color: #334155;
    background: #1e1e1e;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.4);
}
.cfg-dropdown.open .cfg-dropdown-menu { display: block; }
.cfg-dropdown-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 0.875rem;
    color: #334155;
    cursor: pointer;
    transition: background 0.15s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.dark .cfg-dropdown-item { color: #cbd5e1; }
.cfg-dropdown-item:hover { background: #f1f5f9; }
.dark .cfg-dropdown-item:hover { background: rgba(255, 255, 255, 0.08); }
.cfg-dropdown-item.active {
    background: rgba(74, 190, 110, 0.1);
    color: #228547;
    font-weight: 500;
}
.dark .cfg-dropdown-item.active {
    background: rgba(74, 190, 110, 0.15);
    color: #74E9A4;
}

/* API Key masking via CSS (avoids browser password prompts) */
.cfg-key-masked {
    -webkit-text-security: disc;
    text-security: disc;
}

/* Chat Input */
#chat-input {
    resize: none; height: 42px; max-height: 180px;
    overflow-y: hidden;
    transition: border-color 0.2s ease;
}

/* Attachment Preview Bar */
.attachment-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px 0;
}
.attachment-preview.hidden { display: none; }

.att-thumb {
    position: relative;
    width: 64px; height: 64px;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #e2e8f0;
    flex-shrink: 0;
}
.dark .att-thumb { border-color: rgba(255,255,255,0.1); }
.att-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
}

.att-chip {
    position: relative;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 28px 6px 10px;
    border-radius: 8px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    font-size: 12px;
    color: #475569;
    max-width: 180px;
}
.dark .att-chip { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.1); color: #94a3b8; }
.att-uploading { opacity: 0.6; pointer-events: none; }
.att-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.att-remove {
    position: absolute;
    top: -4px; right: -4px;
    width: 18px; height: 18px;
    border-radius: 50%;
    background: #ef4444;
    color: #fff;
    border: none;
    font-size: 12px;
    line-height: 18px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    opacity: 0;
    transition: opacity 0.15s;
}
.att-thumb:hover .att-remove,
.att-chip:hover .att-remove { opacity: 1; }

/* Drag-over highlight */
.drag-over {
    background: rgba(74, 190, 110, 0.08) !important;
    border-color: #4ABE6E !important;
}

/* User message attachments */
.user-msg-attachments {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
}
.user-msg-image {
    max-width: 200px;
    max-height: 160px;
    border-radius: 8px;
    object-fit: cover;
    cursor: pointer;
}
.user-msg-image:hover { opacity: 0.9; }
.user-msg-file {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    background: rgba(255,255,255,0.15);
    font-size: 12px;
}

/* Placeholder Cards */
.placeholder-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.placeholder-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Slash Command Menu */
.slash-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 0;
    right: 0;
    max-height: 320px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 8px 30px -6px rgba(0, 0, 0, 0.1), 0 2px 8px -2px rgba(0, 0, 0, 0.04);
    z-index: 50;
    padding: 4px;
    animation: slashMenuIn 0.15s ease-out;
}
.slash-menu.hidden { display: none; }

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

.slash-menu-header {
    padding: 6px 10px 4px;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.slash-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s ease;
}
.slash-menu-item:hover,
.slash-menu-item.active {
    background: #EDFDF3;
}
.slash-menu-item .cmd {
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, monospace;
}
.slash-menu-item.active .cmd {
    color: #228547;
}
.slash-menu-item .desc {
    font-size: 12px;
    color: #94a3b8;
    margin-left: 12px;
    white-space: nowrap;
}

/* Dark mode */
.dark .slash-menu {
    background: #1A1A1A;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 30px -6px rgba(0, 0, 0, 0.35), 0 2px 8px -2px rgba(0, 0, 0, 0.15);
}
.dark .slash-menu-header {
    color: #64748b;
}
.dark .slash-menu-item:hover,
.dark .slash-menu-item.active {
    background: rgba(74, 190, 110, 0.1);
}
.dark .slash-menu-item .cmd {
    color: #e2e8f0;
}
.dark .slash-menu-item.active .cmd {
    color: #4ABE6E;
}
.dark .slash-menu-item .desc {
    color: #64748b;
}

/* ============================================================
   Knowledge View
   ============================================================ */

/* Tab toggle */
.knowledge-tab, .memory-tab {
    color: #64748b;
}
.knowledge-tab.active, .memory-tab.active {
    background: #fff;
    color: #334155;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.dark .knowledge-tab.active, .dark .memory-tab.active {
    background: rgba(255,255,255,0.1);
    color: #e2e8f0;
}

/* File tree */
.knowledge-tree-group {
    margin-bottom: 2px;
}
.knowledge-tree-group-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border: none;
    background: none;
    transition: background 0.15s, color 0.15s;
    text-transform: capitalize;
}
.knowledge-tree-group-btn:hover {
    background: rgba(0,0,0,0.04);
    color: #334155;
}
.dark .knowledge-tree-group-btn:hover {
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
}
.knowledge-tree-group-btn i.chevron {
    font-size: 8px;
    transition: transform 0.15s;
}
.knowledge-tree-group.open > .knowledge-tree-group-btn .chevron {
    transform: rotate(90deg);
}
.knowledge-tree-group-items {
    display: none;
}
.knowledge-tree-group.open > .knowledge-tree-group-items {
    display: block;
}

.knowledge-tree-file {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px 5px 24px;
    border-radius: 6px;
    font-size: 12px;
    color: #64748b;
    cursor: pointer;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.knowledge-tree-file:hover {
    background: rgba(0,0,0,0.04);
    color: #334155;
}
.knowledge-tree-file.active {
    background: #EDFDF3;
    color: #228547;
}
.dark .knowledge-tree-file:hover {
    background: rgba(255,255,255,0.06);
    color: #e2e8f0;
}
.dark .knowledge-tree-file.active {
    background: rgba(74, 190, 110, 0.1);
    color: #4ABE6E;
}

/* Graph legend */
.knowledge-graph-legend {
    position: absolute;
    top: 12px;
    right: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11px;
    color: #64748b;
    z-index: 10;
}
.knowledge-graph-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.knowledge-graph-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

/* Graph tooltip */
.knowledge-graph-tooltip {
    position: absolute;
    padding: 6px 10px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 12px;
    color: #334155;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 20;
}
.dark .knowledge-graph-tooltip {
    background: #1A1A1A;
    border-color: rgba(255,255,255,0.1);
    color: #e2e8f0;
}

/* Config field tooltip */
.cfg-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    color: #94a3b8;
    cursor: help;
    font-size: 12px;
}
.cfg-tip:hover { color: #64748b; }
.dark .cfg-tip:hover { color: #cbd5e1; }
/* Floating tooltip portal — appended to <body> by JS so it isn't clipped
   by overflow:hidden ancestors. */
.cfg-tip-floating {
    position: fixed;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    white-space: nowrap;
    background: #1e293b;
    color: #e2e8f0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 9999;
}
.dark .cfg-tip-floating {
    background: #334155;
    color: #f1f5f9;
}
.cfg-tip-floating.show {
    opacity: 1;
}

/* Example cards: equal height via flex stretch + fixed 2-line description area */
.example-card {
    display: flex;
    flex-direction: column;
}
.example-card > p {
    flex: 1;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 2.5em;  /* ~2 lines at text-sm leading-relaxed */
}

/* =====================================================================
   Blue Operations Theme Overrides
   ---------------------------------------------------------------------
   Separate navigation/status chrome from the pale work surface and make
   actions/states visibly distinct at a glance.
   ===================================================================== */
:root {
    --ops-shell-900: #0b2f5f;
    --ops-shell-800: #0f3f7a;
    --ops-shell-700: #155ca8;
    --ops-shell-600: #1d75d1;
    --ops-shell-100: #dbeafe;
    --ops-shell-050: #eff6ff;
    --ops-action-blue: #2563eb;
    --ops-action-blue-strong: #1d4ed8;
    --ops-action-blue-soft: #e0f2fe;
    --ops-success: #16a34a;
    --ops-success-soft: #dcfce7;
    --ops-warning: #f59e0b;
    --ops-warning-soft: #fff7ed;
    --ops-danger: #dc2626;
    --ops-danger-soft: #fee2e2;
    --ops-info: #0891b2;
    --ops-info-soft: #cffafe;
}

#sidebar {
    background:
        linear-gradient(180deg, rgba(29, 117, 209, 0.16) 0%, rgba(11, 47, 95, 0) 34%),
        linear-gradient(180deg, var(--ops-shell-900) 0%, #08254b 100%) !important;
    color: #cfe0f5 !important;
    border-right: 1px solid rgba(191, 219, 254, 0.22) !important;
    box-shadow: 10px 0 28px rgba(15, 63, 122, 0.12);
}

#sidebar .border-white\/10,
#sidebar .border-neutral-800 {
    border-color: rgba(191, 219, 254, 0.18) !important;
}

#sidebar .text-neutral-500,
#sidebar .text-neutral-400,
#sidebar .text-neutral-300,
#sidebar .text-neutral-600,
#sidebar .text-xs {
    color: #a9c4e8 !important;
}

#sidebar .text-white,
#sidebar .font-bold,
#sidebar [data-i18n="admin"] {
    color: #f8fbff !important;
}

#sidebar .bg-sky-500 {
    background: linear-gradient(135deg, #38bdf8 0%, #2563eb 100%) !important;
    color: #ffffff !important;
    box-shadow: 0 8px 18px rgba(37, 99, 235, 0.28);
}

#sidebar .item-icon {
    color: #9cc8ff !important;
}

#sidebar .sidebar-item {
    color: #d7e6f9 !important;
    border: 1px solid transparent;
}

#sidebar .sidebar-item:hover {
    background: rgba(219, 234, 254, 0.12) !important;
    color: #ffffff !important;
    border-color: rgba(219, 234, 254, 0.18);
}

#sidebar .sidebar-item:hover .item-icon {
    color: #bfdbfe !important;
}

#sidebar .sidebar-item.active {
    background: linear-gradient(90deg, rgba(37, 99, 235, 0.95) 0%, rgba(14, 165, 233, 0.62) 100%) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.26);
    box-shadow: inset 4px 0 0 #7dd3fc, 0 10px 22px rgba(15, 63, 122, 0.28) !important;
}

#sidebar .sidebar-item.active .item-icon {
    color: #ffffff !important;
}

#sidebar #sidebar-version,
#sidebar .fa-circle {
    color: #93c5fd !important;
}

#main-content > header {
    background:
        linear-gradient(90deg, var(--ops-shell-800) 0%, var(--ops-shell-700) 52%, #0e7490 100%) !important;
    border-bottom: 1px solid rgba(191, 219, 254, 0.35) !important;
    box-shadow: 0 10px 24px rgba(15, 63, 122, 0.16) !important;
}

#main-content > header,
#main-content > header .text-slate-400,
#main-content > header .text-slate-500,
#main-content > header .text-slate-600,
#main-content > header .text-slate-700,
#main-content > header .dark\:text-slate-200,
#main-content > header .dark\:text-slate-300,
#main-content > header .dark\:text-slate-400 {
    color: #dbeafe !important;
}

#main-content > header #breadcrumb-page,
#main-content > header .font-medium {
    color: #ffffff !important;
}

#main-content > header .fa-chevron-right {
    color: #93c5fd !important;
}

#admin-user-badge,
#lang-toggle,
#logout-btn,
#menu-toggle {
    background: rgba(255, 255, 255, 0.14) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.20) !important;
}

#admin-user-badge i,
#lang-toggle i,
#logout-btn i,
#menu-toggle i {
    color: #bfdbfe !important;
}

#admin-user-badge:hover,
#lang-toggle:hover,
#logout-btn:hover,
#menu-toggle:hover {
    background: rgba(255, 255, 255, 0.22) !important;
}

.view .bg-primary-400,
.view .bg-primary-500,
#login-overlay .bg-primary-500,
.confirm-btn-ok {
    background-color: var(--ops-action-blue) !important;
    border-color: var(--ops-action-blue) !important;
    color: #ffffff !important;
}

.view .hover\:bg-primary-500:hover,
.view .hover\:bg-primary-600:hover,
#login-overlay .hover\:bg-primary-600:hover,
.confirm-btn-ok:hover {
    background-color: var(--ops-action-blue-strong) !important;
}

.view .text-primary-500,
.view .text-primary-600,
.view .dark\:text-primary-300,
.view .dark\:text-primary-400,
.view .dark\:text-primary-500 {
    color: var(--ops-action-blue) !important;
}

.view .bg-primary-50,
.view .dark\:bg-primary-900\/20,
.view .dark\:bg-primary-900\/30 {
    background-color: var(--ops-action-blue-soft) !important;
}

.view .border-primary-200,
.view .dark\:border-primary-900\/50 {
    border-color: #93c5fd !important;
}

.view button.border,
.view .medical-action-stack button:not(.bg-primary-500):not(.bg-red-500):not(.bg-emerald-500) {
    border-color: #bfdbfe !important;
    color: #1d4ed8 !important;
    background: #ffffff !important;
}

.view button.border:hover,
.view .medical-action-stack button:not(.bg-primary-500):not(.bg-red-500):not(.bg-emerald-500):hover {
    background: var(--ops-shell-050) !important;
    border-color: #60a5fa !important;
}

.view .bg-emerald-50,
.view .bg-green-50 {
    background-color: var(--ops-success-soft) !important;
}

.view .text-emerald-500,
.view .text-emerald-600,
.view .text-emerald-700,
.view .text-green-600,
.view .text-green-700 {
    color: var(--ops-success) !important;
}

.view .bg-emerald-500,
.view .hover\:bg-emerald-600:hover {
    background-color: var(--ops-success) !important;
    color: #ffffff !important;
}

.view .bg-amber-50,
.view .bg-yellow-50\/70 {
    background-color: var(--ops-warning-soft) !important;
}

.view .text-amber-500,
.view .text-amber-600,
.view .text-amber-700 {
    color: #c2410c !important;
}

.view .bg-red-50 {
    background-color: var(--ops-danger-soft) !important;
}

.view .text-red-500,
.view .text-red-600,
.view .text-red-700 {
    color: var(--ops-danger) !important;
}

.view .bg-red-500,
.view .hover\:bg-red-600:hover {
    background-color: var(--ops-danger) !important;
    color: #ffffff !important;
}

.view .bg-blue-50,
.view .bg-sky-50 {
    background-color: var(--ops-info-soft) !important;
}

.view .text-blue-500,
.view .text-blue-600,
.view .text-blue-700,
.view .text-sky-500,
.view .text-sky-600,
.view .text-sky-700 {
    color: var(--ops-info) !important;
}

.view .inline-flex.items-center.px-2,
.view .inline-flex.items-center.px-2\.5 {
    border-width: 1px !important;
    font-weight: 700 !important;
}

.medical-table-cell-label {
    color: #2563eb !important;
}

.medical-summary-card,
.medical-data-card > .medical-data-card-head {
    background: linear-gradient(180deg, #f8fbff 0%, #eef6ff 100%) !important;
}

.medical-queue-item.active {
    border-color: #60a5fa !important;
    background: #dbeafe !important;
    box-shadow: inset 4px 0 0 #2563eb !important;
}

/* =====================================================================
   Light Blue Shell Refinement
   ---------------------------------------------------------------------
   User preference: lighten sidebar/top bar to rgb(64, 158, 255), and hide
   explanatory subtitles in page headers so each workspace feels cleaner.
   ===================================================================== */
:root {
    --ops-shell-900: rgb(64, 158, 255);
    --ops-shell-800: rgb(64, 158, 255);
    --ops-shell-700: #58a8ff;
    --ops-shell-600: #409eff;
    --ops-shell-100: #d9ecff;
    --ops-shell-050: #f2f8ff;
    --ops-action-blue: #409eff;
    --ops-action-blue-strong: #2f86e6;
    --ops-action-blue-soft: #e8f4ff;
}

#sidebar {
    background:
        linear-gradient(180deg, rgba(255, 255, 255, 0.22) 0%, rgba(255, 255, 255, 0) 38%),
        linear-gradient(180deg, #409eff 0%, #66b7ff 100%) !important;
    color: #eef7ff !important;
    border-right: 1px solid rgba(255, 255, 255, 0.38) !important;
    box-shadow: 8px 0 22px rgba(64, 158, 255, 0.16);
}

#sidebar .text-neutral-500,
#sidebar .text-neutral-400,
#sidebar .text-neutral-300,
#sidebar .text-neutral-600,
#sidebar .text-xs {
    color: rgba(255, 255, 255, 0.82) !important;
}

#sidebar .text-white,
#sidebar .font-bold,
#sidebar [data-i18n="admin"] {
    color: #ffffff !important;
}

#sidebar .item-icon {
    color: rgba(255, 255, 255, 0.9) !important;
}

#sidebar .bg-sky-500 {
    background: rgba(255, 255, 255, 0.22) !important;
    border: 1px solid rgba(255, 255, 255, 0.34) !important;
    color: #ffffff !important;
    box-shadow: none;
}

#sidebar .sidebar-item {
    color: #ffffff !important;
}

#sidebar .sidebar-item:hover {
    background: rgba(255, 255, 255, 0.18) !important;
    border-color: rgba(255, 255, 255, 0.26);
}

#sidebar .sidebar-item.active {
    background: rgba(255, 255, 255, 0.24) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.38);
    box-shadow: inset 4px 0 0 #ffffff, 0 8px 18px rgba(32, 128, 240, 0.18) !important;
}

#sidebar .sidebar-item.active .item-icon {
    color: #ffffff !important;
}

#sidebar #sidebar-version,
#sidebar .fa-circle {
    color: #ffffff !important;
}

#main-content > header {
    background: linear-gradient(90deg, #409eff 0%, #58a8ff 100%) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.34) !important;
    box-shadow: 0 8px 18px rgba(64, 158, 255, 0.14) !important;
}

#main-content > header,
#main-content > header .text-slate-400,
#main-content > header .text-slate-500,
#main-content > header .text-slate-600,
#main-content > header .text-slate-700,
#main-content > header .dark\:text-slate-200,
#main-content > header .dark\:text-slate-300,
#main-content > header .dark\:text-slate-400 {
    color: rgba(255, 255, 255, 0.88) !important;
}

#main-content > header #breadcrumb-page,
#main-content > header .font-medium {
    color: #ffffff !important;
}

#main-content > header .fa-chevron-right {
    color: rgba(255, 255, 255, 0.72) !important;
}

#admin-user-badge,
#lang-toggle,
#logout-btn,
#menu-toggle {
    background: rgba(255, 255, 255, 0.22) !important;
    color: #ffffff !important;
    border: 1px solid rgba(255, 255, 255, 0.32) !important;
}

#admin-user-badge:hover,
#lang-toggle:hover,
#logout-btn:hover,
#menu-toggle:hover {
    background: rgba(255, 255, 255, 0.32) !important;
}

/* Hide explanatory header copy only; keep counts, table hints, form labels, and drawer subtitles. */
.view > .flex-1.overflow-y-auto.p-6 > div > .flex.items-start.justify-between p.text-sm.text-slate-500.mt-1,
.view > .flex-1.overflow-y-auto.p-6 > div > .flex.items-start.justify-between p.text-sm.dark\:text-slate-400.mt-1,
.view > .flex-1.overflow-y-auto.p-6 > div > .flex.items-start.justify-between p.text-xs.text-slate-500.mt-1,
.view > .flex-1.overflow-y-auto.p-6 > div > .flex.items-start.justify-between p.text-xs.dark\:text-slate-400.mt-1,
#doctor-current-subtitle {
    display: none !important;
}

/* =====================================================================
   Soft Clinical Shell Trial
   ---------------------------------------------------------------------
   Softer alternative to bright blue: misty blue-gray surfaces with muted
   green accents for active states and primary actions.
   ===================================================================== */
:root {
    --ops-shell-900: #e9f2f4;
    --ops-shell-800: #eef7f4;
    --ops-shell-700: #dbe9ec;
    --ops-shell-600: #b9d6dc;
    --ops-shell-100: #edf7f5;
    --ops-shell-050: #f7fbfa;
    --ops-action-blue: #2f9e8f;
    --ops-action-blue-strong: #237f74;
    --ops-action-blue-soft: #e1f4ef;
}

#sidebar {
    background:
        linear-gradient(180deg, #f5faf9 0%, #e8f3f2 100%) !important;
    color: #29484f !important;
    border-right: 1px solid #cddfe2 !important;
    box-shadow: 8px 0 20px rgba(35, 79, 87, 0.08);
}

#sidebar .text-neutral-500,
#sidebar .text-neutral-400,
#sidebar .text-neutral-300,
#sidebar .text-neutral-600,
#sidebar .text-xs {
    color: #5e7780 !important;
}

#sidebar .text-white,
#sidebar .font-bold,
#sidebar [data-i18n="admin"] {
    color: #173840 !important;
}

#sidebar .item-icon {
    color: #3f6f78 !important;
}

#sidebar .bg-sky-500 {
    background: linear-gradient(135deg, #50b7a8 0%, #2f9e8f 100%) !important;
    border: 1px solid rgba(47, 158, 143, 0.34) !important;
    color: #ffffff !important;
    box-shadow: 0 6px 14px rgba(47, 158, 143, 0.18);
}

#sidebar .sidebar-item {
    color: #29484f !important;
}

#sidebar .sidebar-item:hover {
    background: #e0f0ef !important;
    color: #173840 !important;
    border-color: #c3ddda;
}

#sidebar .sidebar-item:hover .item-icon {
    color: #237f74 !important;
}

#sidebar .sidebar-item.active {
    background: #d8eee9 !important;
    color: #16675f !important;
    border-color: #9ecfc7;
    box-shadow: inset 4px 0 0 #2f9e8f, 0 6px 14px rgba(47, 158, 143, 0.10) !important;
}

#sidebar .sidebar-item.active .item-icon {
    color: #16675f !important;
}

#sidebar #sidebar-version,
#sidebar .fa-circle {
    color: #2f9e8f !important;
}

#main-content > header {
    background: linear-gradient(90deg, #f5faf9 0%, #e7f1f4 100%) !important;
    border-bottom: 1px solid #cddfe2 !important;
    box-shadow: 0 6px 16px rgba(35, 79, 87, 0.08) !important;
}

#main-content > header,
#main-content > header .text-slate-400,
#main-content > header .text-slate-500,
#main-content > header .text-slate-600,
#main-content > header .text-slate-700,
#main-content > header .dark\:text-slate-200,
#main-content > header .dark\:text-slate-300,
#main-content > header .dark\:text-slate-400 {
    color: #4f6870 !important;
}

#main-content > header #breadcrumb-page,
#main-content > header .font-medium {
    color: #173840 !important;
}

#main-content > header .fa-chevron-right {
    color: #7b969e !important;
}

#admin-user-badge,
#lang-toggle,
#logout-btn,
#menu-toggle {
    background: #ffffff !important;
    color: #29484f !important;
    border: 1px solid #c7dce0 !important;
}

#admin-user-badge i,
#lang-toggle i,
#logout-btn i,
#menu-toggle i {
    color: #2f9e8f !important;
}

#admin-user-badge:hover,
#lang-toggle:hover,
#logout-btn:hover,
#menu-toggle:hover {
    background: #edf7f5 !important;
}

.view .bg-primary-400,
.view .bg-primary-500,
#login-overlay .bg-primary-500,
.confirm-btn-ok {
    background-color: #2f9e8f !important;
    border-color: #2f9e8f !important;
}

.view .hover\:bg-primary-500:hover,
.view .hover\:bg-primary-600:hover,
#login-overlay .hover\:bg-primary-600:hover,
.confirm-btn-ok:hover {
    background-color: #237f74 !important;
}

.view .text-primary-500,
.view .text-primary-600,
.view .dark\:text-primary-300,
.view .dark\:text-primary-400,
.view .dark\:text-primary-500 {
    color: #237f74 !important;
}

.view .bg-primary-50,
.view .dark\:bg-primary-900\/20,
.view .dark\:bg-primary-900\/30 {
    background-color: #e1f4ef !important;
}

.view .border-primary-200,
.view .dark\:border-primary-900\/50 {
    border-color: #9ecfc7 !important;
}

.view button.border,
.view .medical-action-stack button:not(.bg-primary-500):not(.bg-red-500):not(.bg-emerald-500) {
    border-color: #c7dce0 !important;
    color: #237f74 !important;
    background: #ffffff !important;
}

.view button.border:hover,
.view .medical-action-stack button:not(.bg-primary-500):not(.bg-red-500):not(.bg-emerald-500):hover {
    background: #edf7f5 !important;
    border-color: #9ecfc7 !important;
}

/* Service record editor: compact medical form layout. */
#view-service_record_editor .max-w-5xl {
    max-width: 1180px !important;
}

#view-service_record_editor .bg-white.dark\:bg-\[\#1A1A1A\].rounded-xl {
    max-width: 1120px;
    margin-right: auto;
}

#view-service_record_editor .p-4.grid.gap-4 {
    grid-template-columns: minmax(0, 1fr);
    gap: 14px !important;
    padding: 18px !important;
}

#view-service_record_editor .p-4.grid.gap-4 > .grid.grid-cols-1.md\:grid-cols-2 {
    grid-template-columns: minmax(220px, 320px) minmax(220px, 320px) !important;
    justify-content: start;
}

#service-record-binding {
    max-width: 760px;
    background: #f0faf5 !important;
    border-color: #9edfc6 !important;
    color: #28534d !important;
}

#view-service_record_editor .p-4.grid.gap-4 > .grid.grid-cols-1.md\:grid-cols-2:has(button) {
    grid-template-columns: repeat(2, minmax(180px, 260px)) !important;
}

#service-record-title {
    max-width: 760px;
}

#service-record-chief-complaint,
#service-record-diagnosis,
#service-record-treatment,
#service-record-advice {
    min-height: 96px !important;
}

#service-record-chief-complaint,
#service-record-diagnosis,
#service-record-advice {
    max-width: none;
}

#view-service_record_editor .p-4.grid.gap-4 {
    align-items: start;
}

.service-record-kind-row {
    display: none !important;
}

.service-record-kind-row #service-record-department {
    width: 100%;
}

#service-record-chief-complaint,
#service-record-diagnosis,
#service-record-treatment,
#service-record-advice {
    resize: vertical;
}

#service-record-chief-complaint,
#service-record-diagnosis,
#service-record-treatment,
#service-record-advice {
    box-shadow: inset 3px 0 0 #d7ece8;
}

#service-record-chief-complaint:focus,
#service-record-diagnosis:focus,
#service-record-treatment:focus,
#service-record-advice:focus {
    box-shadow: var(--medical-focus), inset 3px 0 0 #2f9e8f !important;
}

#view-service_record_editor .p-4.grid.gap-4 > textarea {
    width: min(100%, 760px);
}

#service-record-treatment {
    width: min(100%, 920px) !important;
}

.service-record-follow-up-panel {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    min-height: 44px;
}

.service-record-follow-up-btn {
    min-width: 170px;
    min-height: 36px;
    padding: 0 18px;
    border: 1px solid #b8d8ce;
    border-radius: 4px;
    background: #e8f5f0;
    color: #21675d;
    font-size: 14px;
    font-weight: 700;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.service-record-follow-up-btn:hover:not(:disabled) {
    background: #d2ece4;
    border-color: #8fc3b4;
    transform: translateY(-1px);
}

.service-record-follow-up-btn:disabled {
    cursor: wait;
    opacity: .68;
}

.service-record-follow-up-modal {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, .32);
}

.service-record-follow-up-modal.hidden {
    display: none !important;
}

.service-record-follow-up-dialog {
    width: min(92vw, 520px);
    overflow: hidden;
    border: 1px solid #d7e7e1;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 22px 60px rgba(30, 64, 57, .22);
}

.service-record-follow-up-dialog-head,
.service-record-follow-up-dialog-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    background: #f7fbfa;
}

.service-record-follow-up-dialog-head {
    border-bottom: 1px solid #e1ece8;
}

.service-record-follow-up-dialog-foot {
    border-top: 1px solid #e1ece8;
}

.service-record-follow-up-dialog-title {
    color: #1f312e;
    font-size: 16px;
    font-weight: 800;
}

.service-record-follow-up-dialog-subtitle {
    margin-top: 3px;
    color: #6b7f7a;
    font-size: 12px;
}

.service-record-follow-up-close {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    color: #64748b;
    font-size: 20px;
}

.service-record-follow-up-close:hover {
    background: #e8f1ee;
}

.service-record-follow-up-dialog-body {
    display: grid;
    gap: 14px;
    padding: 18px;
}

.service-record-follow-up-field {
    display: grid;
    gap: 7px;
}

.service-record-follow-up-field span {
    color: #334d49;
    font-size: 13px;
    font-weight: 700;
}

.service-record-follow-up-field input,
.service-record-follow-up-field textarea {
    width: 100%;
    border: 1px solid #cfdeda;
    border-radius: 12px;
    background: #fff;
    padding: 10px 12px;
    color: #1f312e;
    font-size: 14px;
    outline: none;
}

.follow-up-time-composer {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(170px, .8fr);
    gap: 10px;
}

.follow-up-date-card,
.follow-up-time-card {
    display: grid;
    gap: 7px;
    padding: 11px 12px;
    border: 1px solid #d5e4df;
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f7fbfa 100%);
}

.follow-up-date-card span,
.follow-up-time-card span {
    color: #6b7f7a;
    font-size: 12px;
    font-weight: 800;
}

.follow-up-date-card input,
.follow-up-time-card select {
    min-height: 34px;
    border: 0;
    border-radius: 9px;
    background: #eef7f3;
    color: #1f312e;
    font-size: 14px;
    font-weight: 700;
    outline: none;
}

.follow-up-date-card input {
    padding: 0 10px;
}

.follow-up-time-selects {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 7px;
}

.follow-up-time-selects select {
    padding: 0 8px;
}

.follow-up-time-selects b {
    color: #5d7771;
}

.follow-up-time-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.follow-up-time-shortcuts button {
    min-height: 30px;
    padding: 0 12px;
    border: 1px solid #c4ddd5;
    border-radius: 999px;
    background: #f3faf7;
    color: #2e6f63;
    font-size: 12px;
    font-weight: 800;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.follow-up-time-shortcuts button:hover {
    background: #dff2eb;
    border-color: #93c7b7;
    transform: translateY(-1px);
}

.service-record-follow-up-field input:focus,
.service-record-follow-up-field textarea:focus {
    border-color: #4aa394;
    box-shadow: 0 0 0 3px rgba(74, 163, 148, .16);
}

.service-record-follow-up-cancel,
.service-record-follow-up-submit {
    min-width: 92px;
    min-height: 38px;
    padding: 0 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 800;
}

.service-record-follow-up-cancel {
    border: 1px solid #cfdeda;
    background: #fff;
    color: #42635d;
}

.service-record-follow-up-submit {
    background: #2f9e8f;
    color: #fff;
}

.service-record-follow-up-submit:disabled {
    cursor: wait;
    opacity: .68;
}

.service-record-pet-profile-modal {
    position: fixed;
    inset: 0;
    z-index: 82;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, .34);
}

.service-record-pet-profile-modal.hidden {
    display: none !important;
}

.service-record-pet-profile-dialog {
    width: min(92vw, 760px);
    max-height: min(86vh, 760px);
    overflow: hidden;
    border: 1px solid #d7e7e1;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(30, 64, 57, .24);
}

.service-record-pet-profile-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    padding: 18px 20px;
    border-bottom: 1px solid #e1ece8;
    background: linear-gradient(135deg, #f7fbfa 0%, #eef7f3 100%);
}

.service-record-pet-profile-title {
    color: #1f312e;
    font-size: 18px;
    font-weight: 900;
}

.service-record-pet-profile-subtitle {
    margin-top: 4px;
    color: #6b7f7a;
    font-size: 13px;
}

.service-record-pet-profile-body {
    max-height: calc(min(86vh, 760px) - 78px);
    overflow-y: auto;
    padding: 18px 20px 22px;
}

.service-record-pet-profile-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.service-record-pet-profile-cell {
    min-height: 72px;
    padding: 12px;
    border: 1px solid #e1ece8;
    border-radius: 14px;
    background: #fbfefd;
}

.service-record-pet-profile-cell span {
    display: block;
    color: #6b7f7a;
    font-size: 12px;
    font-weight: 800;
}

.service-record-pet-profile-cell strong {
    display: block;
    margin-top: 7px;
    color: #1f312e;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.45;
    word-break: break-word;
}

.service-record-pet-profile-section {
    margin-top: 18px;
}

.service-record-pet-profile-section h4 {
    margin-bottom: 10px;
    color: #1f312e;
    font-size: 14px;
    font-weight: 900;
}

.service-record-pet-profile-timeline {
    display: grid;
    gap: 9px;
}

.service-record-pet-profile-timeline-item {
    padding: 12px;
    border: 1px solid #e1ece8;
    border-radius: 14px;
    background: #fff;
    color: #6b7f7a;
    font-size: 12px;
    line-height: 1.55;
}

.service-record-pet-profile-timeline-item .font-semibold {
    color: #1f312e;
    font-size: 13px;
    font-weight: 900;
}

.service-record-pet-profile-empty {
    padding: 20px;
    border: 1px dashed #cfdeda;
    border-radius: 14px;
    color: #6b7f7a;
    font-size: 13px;
    text-align: center;
}

.frontdesk-follow-ups-panel {
    margin-bottom: 16px;
    padding: 16px;
    border: 1px solid #d7e7e1;
    border-radius: 16px;
    background: linear-gradient(135deg, #f8fbfa 0%, #eef7f3 100%);
    box-shadow: 0 12px 28px rgba(42, 91, 82, .07);
}

.frontdesk-follow-ups-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.frontdesk-follow-ups-title {
    color: #223b37;
    font-size: 15px;
    font-weight: 800;
}

.frontdesk-follow-ups-subtitle {
    margin-top: 3px;
    color: #6b7f7a;
    font-size: 12px;
}

.frontdesk-follow-ups-refresh,
.frontdesk-follow-up-done {
    border: 1px solid #bdd9d0;
    border-radius: 12px;
    background: #ffffffcc;
    color: #2e6f63;
    font-size: 12px;
    font-weight: 700;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.frontdesk-follow-ups-refresh {
    padding: 8px 12px;
    white-space: nowrap;
}

.frontdesk-follow-up-done {
    padding: 7px 12px;
}

.frontdesk-follow-ups-refresh:hover,
.frontdesk-follow-up-done:hover {
    background: #dff2eb;
    border-color: #93c7b7;
    transform: translateY(-1px);
}

.frontdesk-follow-ups-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 10px;
}

.frontdesk-follow-up-card {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e1ece8;
    border-radius: 14px;
    background: #fff;
}

.frontdesk-follow-up-main {
    min-width: 0;
}

.frontdesk-follow-up-time {
    color: #2e6f63;
    font-size: 12px;
    font-weight: 800;
}

.frontdesk-follow-up-name {
    margin-top: 4px;
    color: #1f312e;
    font-size: 14px;
    font-weight: 800;
}

.frontdesk-follow-up-meta,
.frontdesk-follow-up-reason,
.frontdesk-follow-ups-empty {
    color: #6b7f7a;
    font-size: 12px;
    line-height: 1.5;
}

.frontdesk-follow-up-meta {
    margin-top: 3px;
}

.frontdesk-follow-up-reason {
    margin-top: 6px;
}

#view-service_record_editor .border-t {
    background: #f7fbfa !important;
}

#view-service_record_editor .border-t button {
    min-width: 104px;
}

@media (min-width: 1024px) {
    #view-service_record_editor .p-4.grid.gap-4 {
        grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
    }

    #view-service_record_editor .p-4.grid.gap-4 > .grid.grid-cols-1.md\:grid-cols-2:has(button),
    #service-record-title,
    #service-record-treatment,
    #service-record-form-error {
        grid-column: 1 / -1;
    }

    #view-service_record_editor .p-4.grid.gap-4 > .service-record-kind-row {
        grid-column: 1 !important;
    }

    #service-record-binding {
        grid-column: 1;
    }

    #view-service_record_editor .p-4.grid.gap-4 > .service-record-profile-actions {
        grid-column: 1;
        grid-template-columns: minmax(220px, 320px) !important;
    }

    #service-record-follow-up-panel {
        grid-column: 2;
        align-self: start;
    }

    #service-record-chief-complaint {
        grid-column: 1;
    }

    #service-record-diagnosis {
        grid-column: 2;
    }

    #service-record-treatment {
        grid-column: 1;
    }

    #service-record-advice {
        grid-column: 2;
    }
}

@media (max-width: 767px) {
    #view-service_record_editor .p-4.grid.gap-4 > .grid.grid-cols-1.md\:grid-cols-2,
    #view-service_record_editor .p-4.grid.gap-4 > .grid.grid-cols-1.md\:grid-cols-2:has(button) {
        grid-template-columns: 1fr !important;
    }

    .service-record-follow-up-panel {
        justify-content: stretch;
    }

    .service-record-follow-up-btn {
        width: 100%;
    }

    .follow-up-time-composer {
        grid-template-columns: 1fr;
    }

    .frontdesk-follow-ups-head,
    .frontdesk-follow-up-card {
        flex-direction: column;
    }
}

/* Boss business dashboard visualization */
.business-dashboard-shell {
    display: grid;
    gap: 18px;
}

.business-dashboard-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 22px;
    border: 1px solid #d5e4df;
    border-radius: 22px;
    background:
        radial-gradient(circle at 12% 20%, rgba(47, 158, 143, .16), transparent 30%),
        linear-gradient(135deg, #f8fbfa 0%, #edf6f3 58%, #eaf3f7 100%);
    box-shadow: 0 18px 40px rgba(35, 77, 70, .08);
}

.business-dashboard-eyebrow {
    color: #2f9e8f;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .12em;
}

.business-dashboard-hero h2 {
    margin: 4px 0 0;
    color: #1d332f;
    font-size: clamp(24px, 3vw, 34px);
    font-weight: 900;
}

.business-dashboard-hero p {
    margin-top: 8px;
    color: #607b75;
    font-size: 14px;
}

.business-dashboard-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.business-dashboard-actions button {
    min-height: 40px;
    padding: 0 15px;
    border: 1px solid #bdd9d0;
    border-radius: 12px;
    background: #ffffffd9;
    color: #2a665d;
    font-size: 13px;
    font-weight: 800;
}

.business-dashboard-actions button:first-child {
    background: #2f9e8f;
    color: #fff;
}

.business-dashboard-summary {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 12px;
}

.business-metric,
.business-card {
    border: 1px solid #dce8e4;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 14px 34px rgba(31, 65, 58, .06);
}

.business-metric {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-height: 124px;
    padding: 16px;
    border-radius: 18px;
}

.business-metric-icon {
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    background: #eef7f3;
    color: #2f9e8f;
}

.business-metric-value {
    margin-top: 7px;
    color: #182f2b;
    font-size: 25px;
    font-weight: 950;
}

.business-metric-label {
    color: #607b75;
    font-size: 12px;
    font-weight: 800;
}

.business-metric-sub {
    margin-top: 5px;
    color: #7f938e;
    font-size: 12px;
}

.business-metric-red .business-metric-icon { background: #fff1f2; color: #e11d48; }
.business-metric-amber .business-metric-icon { background: #fffbeb; color: #d97706; }
.business-metric-blue .business-metric-icon { background: #eff6ff; color: #2563eb; }
.business-metric-slate .business-metric-icon { background: #f1f5f9; color: #475569; }
.business-metric-green .business-metric-icon { background: #ecfdf5; color: #059669; }

.business-dashboard-main {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
    gap: 16px;
}

.business-card {
    border-radius: 20px;
    padding: 18px;
}

.business-card-wide {
    grid-column: span 1;
}

.business-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.business-card h3 {
    color: #1d332f;
    font-size: 16px;
    font-weight: 900;
}

.business-card p {
    margin-top: 4px;
    color: #718883;
    font-size: 12px;
}

.business-funnel {
    display: grid;
    gap: 13px;
}

.business-funnel-row {
    display: grid;
    gap: 7px;
}

.business-funnel-meta,
.business-bar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: #3f5d57;
    font-size: 13px;
    font-weight: 800;
}

.business-funnel-meta strong,
.business-bar-top strong {
    color: #172f2a;
    font-size: 15px;
}

.business-funnel-track,
.business-bar-track,
.business-mini-track {
    overflow: hidden;
    height: 13px;
    border-radius: 999px;
    background: #edf4f2;
}

.business-funnel-fill,
.business-bar-fill,
.business-mini-track div {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #6bc7b7, #2f9e8f);
}

.business-funnel-1 { background: linear-gradient(90deg, #93c5fd, #2563eb); }
.business-funnel-2 { background: linear-gradient(90deg, #fcd34d, #d97706); }
.business-funnel-3 { background: linear-gradient(90deg, #86efac, #059669); }

.business-funnel-sub {
    color: #7d928d;
    font-size: 12px;
}

.business-bars {
    display: grid;
    gap: 12px;
}

.business-fill-amber { background: linear-gradient(90deg, #fde68a, #d97706); }
.business-fill-blue { background: linear-gradient(90deg, #bfdbfe, #2563eb); }
.business-fill-cyan { background: linear-gradient(90deg, #a5f3fc, #0891b2); }
.business-fill-teal { background: linear-gradient(90deg, #99f6e4, #0f766e); }
.business-fill-green,
.business-fill-emerald { background: linear-gradient(90deg, #bbf7d0, #059669); }
.business-fill-slate { background: linear-gradient(90deg, #cbd5e1, #64748b); }

.business-mix-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.business-mix-card {
    padding: 13px;
    border: 1px solid #e0ebe7;
    border-radius: 15px;
    background: #f9fcfb;
}

.business-mix-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 11px;
    background: #e8f5f0;
    color: #2f9e8f;
}

.business-mix-title {
    margin-top: 9px;
    color: #526d68;
    font-size: 12px;
    font-weight: 800;
}

.business-mix-value {
    margin: 4px 0 8px;
    color: #1d332f;
    font-size: 22px;
    font-weight: 950;
}

.business-mix-sub {
    margin-top: 5px;
    color: #7b928d;
    font-size: 12px;
}

.business-table-wrap {
    overflow-x: auto;
}

.business-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 620px;
}

.business-table th,
.business-table td {
    padding: 11px 12px;
    border-bottom: 1px solid #edf3f1;
    text-align: left;
    color: #334d49;
    font-size: 13px;
}

.business-table th {
    color: #718883;
    font-size: 12px;
    font-weight: 900;
}

.business-rate-pill {
    display: inline-flex;
    padding: 4px 8px;
    border-radius: 999px;
    background: #e8f5f0;
    color: #21675d;
    font-size: 12px;
    font-weight: 900;
}

.business-list {
    display: grid;
    gap: 9px;
}

.business-list-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px;
    border: 1px solid #e1ece8;
    border-radius: 14px;
    background: #fbfefd;
    text-align: left;
}

.business-list-button:hover {
    background: #eef7f3;
}

.business-list-item strong {
    display: block;
    color: #1d332f;
    font-size: 13px;
    font-weight: 900;
}

.business-list-item span,
.business-list-item em,
.business-empty {
    color: #718883;
    font-size: 12px;
    font-style: normal;
}

.business-dashboard-error {
    grid-column: 1 / -1;
    padding: 18px;
    border: 1px solid #fecdd3;
    border-radius: 16px;
    background: #fff1f2;
    color: #be123c;
}

/* Beautician workspace: lightweight care-record console */
.beauty-workspace-layout {
    display: grid !important;
    grid-template-columns: 320px minmax(0, 1fr) !important;
    gap: 18px !important;
}

.beauty-queue-shell,
.beauty-care-panel {
    overflow: hidden;
    border: 1px solid #d9e9e4;
    border-radius: 18px;
    background: #ffffff;
    box-shadow: 0 14px 34px rgba(31, 65, 58, .06);
}

.beauty-queue-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 15px 16px;
    border-bottom: 1px solid #e5efec;
    background: linear-gradient(135deg, #f8fbfa 0%, #eef7f3 100%);
}

.beauty-queue-head h3 {
    color: #1f312e;
    font-size: 15px;
    font-weight: 900;
}

.beauty-queue-head p {
    margin-top: 3px;
    color: #6b7f7a;
    font-size: 12px;
}

.beauty-queue-head button {
    width: 34px;
    height: 34px;
    border-radius: 11px;
    color: #2f766b;
    background: #ffffffcc;
}

.beauty-queue-list {
    display: grid;
    gap: 8px;
    max-height: 620px;
    overflow-y: auto;
    padding: 10px;
}

.beauty-queue-card {
    width: 100%;
    display: grid;
    gap: 9px;
    padding: 12px;
    border: 1px solid #e1ece8;
    border-radius: 15px;
    background: #fbfefd;
    text-align: left;
    transition: background .15s ease, border-color .15s ease, transform .15s ease;
}

.beauty-queue-card:hover,
.beauty-queue-card.active {
    border-color: #8fc3b4;
    background: #eef8f4;
}

.beauty-queue-card.active {
    transform: translateY(-1px);
}

.beauty-queue-main {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.beauty-queue-avatar {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    background: #dff2eb;
    color: #21675d;
    font-size: 13px;
    font-weight: 900;
}

.beauty-queue-title {
    color: #1f312e;
    font-size: 14px;
    font-weight: 900;
}

.beauty-queue-sub,
.beauty-queue-desc,
.beauty-queue-card > span {
    color: #6b7f7a;
    font-size: 12px;
    line-height: 1.45;
}

.beauty-queue-desc {
    margin-top: 4px;
}

.beauty-empty-panel {
    min-height: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #6b7f7a;
    text-align: center;
}

.beauty-care-card {
    display: grid;
    gap: 16px;
    padding: 18px;
}

.beauty-care-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5efec;
}

.beauty-care-kicker {
    color: #2f9e8f;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: .08em;
}

.beauty-care-head h3 {
    margin-top: 4px;
    color: #1f312e;
    font-size: 22px;
    font-weight: 950;
}

.beauty-care-head p {
    margin-top: 5px;
    color: #6b7f7a;
    font-size: 13px;
}

.beauty-complete-btn,
.beauty-save-btn {
    min-height: 38px;
    padding: 0 16px;
    border-radius: 12px;
    background: #2f9e8f;
    color: #fff;
    font-size: 13px;
    font-weight: 900;
}

.beauty-care-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.beauty-care-summary div {
    padding: 12px;
    border: 1px solid #e1ece8;
    border-radius: 14px;
    background: #fbfefd;
}

.beauty-care-summary span,
.beauty-care-form span {
    display: block;
    color: #6b7f7a;
    font-size: 12px;
    font-weight: 900;
}

.beauty-care-summary strong {
    display: block;
    margin-top: 7px;
    color: #1f312e;
    font-size: 14px;
    font-weight: 800;
    line-height: 1.45;
}

.beauty-care-form {
    display: grid;
    gap: 14px;
}

.beauty-care-form label {
    display: grid;
    gap: 8px;
}

.beauty-care-form textarea {
    width: 100%;
    resize: vertical;
    border: 1px solid #cfdeda;
    border-radius: 14px;
    background: #fff;
    padding: 12px;
    color: #1f312e;
    font-size: 14px;
    outline: none;
}

.beauty-care-form textarea:focus {
    border-color: #4aa394;
    box-shadow: 0 0 0 3px rgba(74, 163, 148, .16);
}

.beauty-care-actions {
    display: flex;
    justify-content: flex-end;
}

@media (max-width: 1200px) {
    .business-dashboard-summary {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .business-dashboard-main {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767px) {
    .business-dashboard-hero {
        align-items: flex-start;
        flex-direction: column;
    }

    .business-dashboard-summary,
    .business-mix-grid {
        grid-template-columns: 1fr;
    }

    .beauty-workspace-layout,
    .beauty-care-summary {
        grid-template-columns: 1fr !important;
    }

    .beauty-care-head {
        flex-direction: column;
    }
}
