/* ========================================================================
   Medibox / MEDIBOX — Professional Healthcare Redesign
   Presentation-only layer. Existing HTML structure, routes, actions and
   application logic are intentionally preserved.
   ======================================================================== */

:root {
    --bg: #f6f8fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --surface-muted: #f1f4f8;
    --text: #1d2939;
    --muted: #667085;
    --line: #e4e9f0;
    --line-strong: #d6dde7;
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-soft: #eef2ff;
    --success: #13866f;
    --success-soft: #ecf8f4;
    --warning: #b7791f;
    --warning-soft: #fff8e8;
    --danger: #c2414b;
    --danger-soft: #fff1f2;
    --dark: #344054;
    --shadow: 0 2px 8px rgba(16, 24, 40, .045);
    --shadow-hover: 0 6px 18px rgba(16, 24, 40, .07);
    --radius: 12px;
}

html { background: var(--bg); }
body {
    color: var(--text);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4, h5, h6 { color: #1f2a3d; font-weight: 650; }
h1 { font-size: 24px; letter-spacing: -.025em; }
h2 { font-size: 18px; letter-spacing: -.015em; }
h3 { font-size: 14px; letter-spacing: -.005em; }
small { color: var(--muted); }

/* ------------------------------------------------------------------------
   Application shell / sidebar
   ------------------------------------------------------------------------ */
.sidebar {
    background: #172033;
    color: #d4dbea;
    border-right: 1px solid rgba(255,255,255,.045);
    box-shadow: none;
}
.sidebar .brand-mark,
.sidebar .brand-mark-logo {
    background: transparent;
    box-shadow: none;
    border-radius: 10px;
}
.sidebar .brand strong { font-size: 15px; font-weight: 650; letter-spacing: -.01em; }
.sidebar .nav-menu { gap: 5px; }
.sidebar .nav-item {
    color: #aeb8ca;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    transition: background-color .15s ease, color .15s ease;
}
.sidebar .nav-item:hover {
    color: #f8fafc;
    background: rgba(255,255,255,.055);
}
.sidebar .nav-item.active {
    color: #fff;
    background: rgba(99,102,241,.22);
    box-shadow: inset 3px 0 0 #818cf8;
}
.sidebar-toggle {
    border-color: rgba(255,255,255,.10);
    border-radius: 9px;
    color: #c7d2e4;
    background: rgba(255,255,255,.045);
    box-shadow: none;
}
.sidebar-toggle:hover {
    color: #fff;
    border-color: rgba(255,255,255,.18);
    background: rgba(255,255,255,.075);
}
.sidebar .user-card {
    border-color: rgba(255,255,255,.08);
    border-radius: 10px;
    background: rgba(255,255,255,.045);
}
.sidebar .user-card strong { font-weight: 600; }
.sidebar .avatar {
    border-radius: 9px;
    background: #27344b;
    font-weight: 650;
}

/* ------------------------------------------------------------------------
   Header / global search
   ------------------------------------------------------------------------ */
.topbar,
.universal-global-topbar {
    background: rgba(255,255,255,.97);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 3px rgba(16,24,40,.025);
    backdrop-filter: none;
}
.global-patient-search {
    border-color: var(--line-strong) !important;
    border-radius: 10px !important;
    background: #fff !important;
    box-shadow: none !important;
}
.global-patient-search:focus-within {
    border-color: #a5b4fc !important;
    box-shadow: 0 0 0 3px rgba(79,70,229,.08) !important;
}
.global-patient-search > .ui-icon { color: #697586; }
.global-patient-search input {
    color: #25324a;
    font-size: 12.5px;
}
.global-patient-search input::placeholder { color: #98a2b3; }
.global-patient-search kbd {
    border-color: #e5e9f0;
    border-radius: 6px;
    color: #7b8798;
    background: #f8fafc;
    box-shadow: none;
}
.global-patient-search-results {
    border: 1px solid var(--line);
    border-radius: 11px;
    box-shadow: 0 14px 34px rgba(16,24,40,.11);
}
.topbar-medibox-title,
.module-topbar-title { color: #25324a !important; font-weight: 650 !important; }

.header-practitioner-picker,
.header-practitioner-select,
.header-input-method-switch,
.topbar-notification-button,
.topbar-account-button {
    box-shadow: none !important;
}

/* ------------------------------------------------------------------------
   Main content, cards and sections
   ------------------------------------------------------------------------ */
.app-body .content,
.content { background: var(--bg); }
.card,
.reference-register-card,
.patient-profile-v2-card,
.visit-simple-card,
.visit-review-note-card,
.appointment-pro-panel,
.appointment-modal-modern,
.visit-command-modal,
.service-modal-modern {
    border-color: var(--line) !important;
    border-radius: 12px !important;
    background: #fff;
    box-shadow: var(--shadow) !important;
}
.card { padding: 18px; }
.card-header { margin-bottom: 15px; }
.stack-column { gap: 14px; }

/* ------------------------------------------------------------------------
   Buttons / actions
   ------------------------------------------------------------------------ */
.btn {
    min-height: 38px;
    padding: 8px 13px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    box-shadow: none;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.btn:hover { transform: none; }
.btn-primary {
    border-color: var(--primary);
    background: var(--primary);
    box-shadow: none;
}
.btn-primary:hover { border-color: var(--primary-dark); background: var(--primary-dark); }
.btn-light {
    color: #344054;
    border-color: var(--line-strong);
    background: #fff;
}
.btn-light:hover { border-color: #c5ceda; background: #f8fafc; }
.btn-success { background: var(--success); border-color: var(--success); }
.btn-danger-ghost { border-color: #f1c8cd; background: #fff; }
.btn-sm { min-height: 32px; padding: 6px 9px; border-radius: 7px; font-size: 11px; }
.icon-button,
.action-icon-button,
.reference-filter-button,
.reference-add-button {
    border-color: var(--line-strong);
    border-radius: 8px;
    color: #52627a;
    background: #fff;
    box-shadow: none;
}
.icon-button:hover,
.action-icon-button:hover {
    transform: none;
    color: var(--primary);
    border-color: #c7c9f7;
    background: #fafaff;
    box-shadow: none;
}
.text-link { font-weight: 600; }

/* ------------------------------------------------------------------------
   Forms
   ------------------------------------------------------------------------ */
.field > span,
.field > label,
label {
    color: #475467;
    font-weight: 600;
}
input:not([type="checkbox"]):not([type="radio"]),
select,
textarea,
.form-control,
.reference-search-control input,
.reference-select-control select,
.appointment-control,
.appointment-form-pro .patient-search-input-wrap {
    border-color: var(--line-strong) !important;
    border-radius: 8px !important;
    background-color: #fff;
    box-shadow: none !important;
}
input:not([type="checkbox"]):not([type="radio"]):focus,
select:focus,
textarea:focus,
.form-control:focus,
.reference-search-control input:focus,
.reference-select-control select:focus,
.appointment-control:focus-within,
.appointment-form-pro .patient-search-input-wrap:focus-within {
    outline: 0;
    border-color: #a5b4fc !important;
    box-shadow: 0 0 0 3px rgba(79,70,229,.08) !important;
}
input::placeholder,
textarea::placeholder { color: #98a2b3; }

/* ------------------------------------------------------------------------
   Tables / registers
   ------------------------------------------------------------------------ */
.table-wrap,
.reference-table-wrap { background: #fff; }
.data-table,
.reference-data-table { color: #344054; }
.data-table th,
.reference-data-table th {
    padding-top: 10px;
    padding-bottom: 10px;
    color: #667085;
    background: #f8fafc;
    border-bottom: 1px solid var(--line);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .025em;
    text-transform: uppercase;
}
.data-table td,
.reference-data-table td {
    border-bottom-color: #edf0f4;
    color: #344054;
    background: #fff;
    font-weight: 400;
}
.data-table tbody tr:hover,
.reference-record-row:hover td { background: #fafbfc; }
.reference-record-row:hover td:first-child { box-shadow: inset 2px 0 0 #818cf8; }
.reference-register-card { overflow: hidden; }
.reference-register-toolbar {
    min-height: 60px;
    border-bottom-color: var(--line);
    background: #fff;
}
.reference-person-avatar {
    border-color: #e0e4f7;
    border-radius: 9px;
    color: #4f46e5;
    background: #f1f3ff;
    font-weight: 650;
}
.reference-person-photo { border-radius: 9px; }
.reference-person-copy strong {
    color: #24324a;
    font-size: 12px;
    font-weight: 650;
}
.reference-person-copy small,
.reference-secondary-value {
    color: #7b8798;
    font-size: 10px;
    font-weight: 400;
}
.reference-primary-value {
    color: #3c4a60;
    font-size: 11px;
    font-weight: 500;
}
.reference-date-value strong { color: #344054; font-weight: 550; }
.reference-date-value small { font-weight: 400; }
.reference-total-count {
    border-color: var(--line-strong);
    border-radius: 8px;
    background: #f8fafc;
}
.reference-total-count strong { color: #344054; font-weight: 650; }

/* ------------------------------------------------------------------------
   Badges / statuses
   ------------------------------------------------------------------------ */
.badge,
.reference-status-badge,
.pill {
    font-weight: 600;
    box-shadow: none;
}
.badge { border-radius: 7px; }
.reference-status-badge { border-radius: 7px; }
.reference-status-badge i { box-shadow: none; }
.badge-neutral { color: #526173; background: #f0f2f5; }
.badge-info, .badge-primary { color: #4338ca; background: #eef2ff; }
.badge-success { color: #0f766e; background: #eaf7f3; }
.badge-warning { color: #996515; background: #fff7e6; }
.badge-danger { color: #b4232c; background: #fff0f1; }
.reference-status-badge.is-active { color: #0f766e; border-color: #ccebe2; background: #eef9f5; }
.reference-status-badge.is-inactive { color: #667085; border-color: #e0e5ec; background: #f7f8fa; }

/* ------------------------------------------------------------------------
   Dashboard / status cards
   ------------------------------------------------------------------------ */
.stat-card,
.topbar-status-card {
    border-color: var(--line) !important;
    border-radius: 11px !important;
    background: #fff !important;
    box-shadow: var(--shadow) !important;
}
.stat-card { min-height: 96px; }
.stat-icon,
.topbar-status-card > span {
    border-radius: 8px;
    background: var(--primary-soft);
    color: var(--primary);
}
.stat-card strong,
.topbar-status-card strong { font-weight: 650; }
.stat-emphasis {
    color: var(--text);
    border-color: #dfe3f7;
    background: #f7f7ff !important;
}
.stat-emphasis .stat-icon { color: var(--primary); background: #e8eaff; }
.stat-emphasis small { color: var(--muted); }
.topbar-status-card[aria-pressed="true"] {
    border-color: #c7c9f7 !important;
    background: #f7f7ff !important;
    box-shadow: inset 0 0 0 1px rgba(79,70,229,.08) !important;
    transform: none;
}
.topbar-status-all { border-color: var(--line) !important; background: #fff !important; }

/* ------------------------------------------------------------------------
   Patient profile / clinical workspace
   ------------------------------------------------------------------------ */
.patient-hero,
.visit-header { gap: 16px; }
.avatar-xl {
    border-radius: 12px;
    background: #eef2ff;
    color: #4f46e5;
    box-shadow: inset 0 0 0 1px #dfe3ff;
}
.details-list > div { border-bottom-color: #edf0f4; }
.details-list dt { color: #7b8798; font-size: 10px; }
.details-list dd { color: #344054; font-weight: 550; }
.alert-panel {
    border-color: #efdba7;
    border-radius: 10px;
    background: #fffbf2;
}
.critical-alert { border-color: #efc8ce; background: #fff5f6; }

.patient-profile-v2-main,
.patient-profile-v2-tabs,
.visit-appointment-strip,
.visit-review-facts,
.visit-review-note-card > header,
.visit-simple-section-header {
    border-color: var(--line) !important;
}
.patient-profile-v2-tab,
.patient-profile-visit-tabs .patient-profile-v2-tab {
    font-weight: 550 !important;
}
.patient-profile-v2-tab.is-active,
.patient-profile-v2-tab.active {
    color: var(--primary) !important;
}

.visit-appointment-strip {
    border-radius: 10px;
    box-shadow: var(--shadow);
}
.visit-appointment-strip-facts > span:not(.badge) {
    border-color: var(--line);
    border-radius: 7px;
    background: #f8fafc;
}
.visit-appointment-strip-facts > span:not(.badge) .ui-icon { color: #697586; }
.visit-appointment-strip-facts b { font-weight: 600; }
.visit-review-facts { background: #fafbfc; }
.visit-review-facts article {
    border-color: var(--line);
    border-radius: 9px;
    box-shadow: none;
}
.visit-review-facts small { color: #7b8798; font-size: 9px; font-weight: 600; }
.visit-review-facts strong { color: #344054; font-size: 11px; font-weight: 550; }
.visit-review-note-card > header { background: #fafbfc; }
.visit-review-note-card > header > span,
.visit-simple-section-header > div > span {
    border-radius: 8px;
    color: #4f46e5;
    background: #eef2ff;
}
.visit-review-note-card h3 { color: #3b485c; font-weight: 600; }
.visit-review-note-card p,
.visit-review-card-list strong { font-weight: 400; }
.visit-review-note-card textarea:focus { box-shadow: inset 0 0 0 2px rgba(79,70,229,.08); }
.visit-review-card-list article + article,
.visit-review-finance-lines p + p { border-top-color: #edf0f4; }

.visit-add-service,
.visit-service-compact-row,
.visit-tooth-card,
.visit-document-compact-list article,
.visit-finance-compact-grid article {
    border-color: var(--line);
    border-radius: 9px;
    background: #fbfcfd;
}
.visit-add-service { background: #fafbfc; }
.visit-add-service > summary { color: #475467; font-weight: 600; }
.visit-service-number {
    border-radius: 7px;
    color: #4f46e5;
    background: #eef2ff;
    font-weight: 650;
}
.visit-service-copy strong { color: #344054; font-weight: 550; }
.visit-service-copy small,
.visit-service-compact-meta > span { color: #7b8798; font-weight: 400; }
.visit-service-compact-meta > strong { color: #344054; font-weight: 600; }

/* ------------------------------------------------------------------------
   Calendar / appointments
   ------------------------------------------------------------------------ */
.calendar-shell,
.weekly-calendar,
.appointment-form-pro,
.appointment-pro-panel { border-color: var(--line) !important; }
#weeklyCalendarApp .calendar-appointment-simple {
    border: 1px solid #e6eaf0 !important;
    border-radius: 8px;
    background: #fff !important;
    box-shadow: 0 2px 6px rgba(16,24,40,.045) !important;
}
#weeklyCalendarApp .calendar-appointment-simple:hover,
#weeklyCalendarApp .calendar-appointment-simple:focus-visible {
    border-color: #d7d9f4 !important;
    box-shadow: 0 5px 12px rgba(16,24,40,.07) !important;
}
#weeklyCalendarApp .calendar-appointment-simple.needs-final-status {
    border-color: #e6eaf0 !important;
    box-shadow: 0 2px 6px rgba(16,24,40,.045) !important;
}
#weeklyCalendarApp .calendar-appointment-simple .appointment-simple-top > strong,
#weeklyCalendarApp .calendar-appointment-simple .appointment-simple-person h3 {
    color: #26344a;
    font-weight: 650;
}
#weeklyCalendarApp .calendar-appointment-simple .appointment-simple-person small {
    color: #7b8798;
    font-weight: 400;
}
#weeklyCalendarApp .calendar-appointment-simple .appointment-simple-top .badge {
    border-radius: 5px;
    font-weight: 600;
}
.calendar-appointment.is-current-time {
    border-color: #c7c9f7 !important;
    background: #fafaff !important;
    box-shadow: inset 3px 0 0 #6366f1, 0 3px 8px rgba(16,24,40,.055) !important;
    animation: none !important;
}
.appointment-reason-button,
.appointment-chair-button {
    border-color: var(--line) !important;
    border-radius: 9px !important;
    background: #fff !important;
    box-shadow: none !important;
}
.appointment-reason-button:hover,
.appointment-chair-button:hover { border-color: #c9cdf3 !important; background: #fafaff !important; }
.appointment-reason-button.is-active,
.appointment-chair-button.is-active {
    color: #4338ca !important;
    border-color: #c7c9f7 !important;
    background: #f3f4ff !important;
    box-shadow: none !important;
}

/* ------------------------------------------------------------------------
   Services / materials / finance
   ------------------------------------------------------------------------ */
.code-chip {
    border-radius: 6px;
    color: #526173;
    background: #f1f3f6;
    font-weight: 500;
}
.finance-patient-name,
.finance-patient-name strong { font-weight: 650; }
.summary-success { color: #0f766e !important; background: #eef9f5 !important; }
.summary-danger { color: #b4232c !important; background: #fff2f3 !important; }

/* ------------------------------------------------------------------------
   Modals
   ------------------------------------------------------------------------ */
.modal-dialog,
.appointment-modal-modern,
.visit-command-modal,
.service-modal-modern {
    border: 1px solid var(--line) !important;
    border-radius: 14px !important;
    box-shadow: 0 18px 48px rgba(16,24,40,.18) !important;
}
.modal-dialog::backdrop,
.appointment-modal-modern::backdrop,
.visit-command-modal::backdrop,
.service-modal-modern::backdrop {
    background: rgba(16,24,40,.46);
    backdrop-filter: none;
}
.modal-header,
.modal-footer,
.appointment-modal-header-modern {
    border-color: var(--line) !important;
    background: #fff !important;
}
.modal-header h2,
.appointment-modal-modern .modal-header h2 { font-weight: 650; }
.modal-body { background: #fff; }
.calculated-total {
    border: 1px solid #dde1f9;
    border-radius: 9px;
    color: #4338ca;
    background: #f5f5ff;
}

/* ------------------------------------------------------------------------
   Empty states and small UI polish
   ------------------------------------------------------------------------ */
.empty-state,
.empty-state-card { color: #667085; }
hr { border: 0; border-top: 1px solid var(--line); }
::selection { color: #1e1b4b; background: #e0e7ff; }

/* ------------------------------------------------------------------------
   Responsive refinements — preserve existing behavior
   ------------------------------------------------------------------------ */
@media (max-width: 980px) {
    .sidebar { box-shadow: 14px 0 32px rgba(16,24,40,.18); }
}
@media (max-width: 720px) {
    body { font-size: 14px; }
    h1 { font-size: 22px; }
    h2 { font-size: 18px; }
    .card { border-radius: 10px !important; }
}
