/* =================================================================
   iCare – Orthopaedic Emergency Shift Manager  |  v1.0.1
   Alexia Technology Sdn Bhd
   ================================================================= */

:root {
    --ic-primary:   #1a73e8;
    --ic-primary-d: #1557b0;
    --ic-danger:    #d93025;
    --ic-success:   #1e8e3e;
    --ic-warning:   #f9ab00;
    --ic-purple:    #7c3aed;
    --ic-teal:      #00796b;
    --ic-orange:    #e65100;
    --ic-gray:      #5f6368;
    --ic-border:    #dadce0;
    --ic-bg:        #f8f9fa;
    --ic-card:      #ffffff;
    --ic-text:      #202124;
    --ic-text2:     #5f6368;
    --ic-shadow:    0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
    --ic-shadow-md: 0 4px 12px rgba(0,0,0,.12);
    --ic-r:         8px;
    --ic-r-sm:      5px;
}

/* ---- Reset & wrap ---- */
.icare-wrap * { box-sizing: border-box; }
.icare-wrap {
    max-width: 1100px;
    padding: 0 16px 60px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    color: var(--ic-text);
    font-size: 14px;
}

/* ---- Header ---- */
.icare-header {
    display: flex;
    align-items: center;
    padding: 14px 0 12px;
    border-bottom: 2px solid var(--ic-primary);
    margin-bottom: 18px;
}
.icare-logo { display: flex; align-items: center; gap: 8px; }
.icare-logo-icon { font-size: 26px; }
.icare-logo-text {
    font-size: 22px;
    font-weight: 800;
    color: var(--ic-primary);
    letter-spacing: -0.5px;
}
.icare-logo-sub {
    font-size: 12px;
    color: var(--ic-text2);
    border-left: 1px solid var(--ic-border);
    padding-left: 10px;
    margin-left: 4px;
}

/* ---- No shift ---- */
.icare-no-shift {
    text-align: center;
    padding: 80px 20px;
    background: var(--ic-card);
    border-radius: var(--ic-r);
    box-shadow: var(--ic-shadow);
}
.icare-no-shift-icon { font-size: 64px; margin-bottom: 16px; }
.icare-no-shift h2 { font-size: 22px; color: var(--ic-text); margin-bottom: 8px; }
.icare-no-shift p  { color: var(--ic-text2); margin-bottom: 24px; }

/* ---- Shift bar ---- */
.icare-shift-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--ic-card);
    border: 1px solid var(--ic-border);
    border-radius: var(--ic-r);
    padding: 12px 16px;
    margin-bottom: 14px;
    box-shadow: var(--ic-shadow);
    flex-wrap: wrap;
    gap: 10px;
}
.icare-shift-info { font-size: 13px; }
.icare-shift-actions { display: flex; gap: 8px; }
.icare-shift-badge {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .5px;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    margin-right: 6px;
}
.icare-shift-badge.active { background: #e6f4ea; color: #1e8e3e; }
.icare-shift-badge.closed { background: #f1f3f4; color: #5f6368; }

/* ---- Stats row ---- */
.icare-stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 8px;
    margin-bottom: 14px;
    width: 100%;
}
.icare-stat-card {
    background: var(--ic-card);
    border-radius: var(--ic-r);
    padding: 10px 8px;
    text-align: center;
    box-shadow: var(--ic-shadow);
    border-top: 3px solid transparent;
    min-width: 0;

    cursor: default;
    transition: transform .15s;
}
.icare-stat-card:hover { transform: translateY(-2px); box-shadow: var(--ic-shadow-md); }
.icare-stat-value { font-size: 26px; font-weight: 800; line-height: 1; margin-bottom: 3px; }
.icare-stat-label { font-size: 10px; color: var(--ic-text2); text-transform: uppercase; letter-spacing: .3px; }

.icare-stat-blue   { border-color: var(--ic-primary); } .icare-stat-blue   .icare-stat-value { color: var(--ic-primary); }
.icare-stat-red    { border-color: var(--ic-danger);  } .icare-stat-red    .icare-stat-value { color: var(--ic-danger);  }
.icare-stat-red2   { border-color: #b71c1c;           } .icare-stat-red2   .icare-stat-value { color: #b71c1c;           }
.icare-stat-orange { border-color: var(--ic-orange);  } .icare-stat-orange .icare-stat-value { color: var(--ic-orange);  }
.icare-stat-gray   { border-color: var(--ic-gray);    } .icare-stat-gray   .icare-stat-value { color: var(--ic-gray);    }
.icare-stat-green  { border-color: var(--ic-success); } .icare-stat-green  .icare-stat-value { color: var(--ic-success); }
.icare-stat-teal   { border-color: var(--ic-teal);    } .icare-stat-teal   .icare-stat-value { color: var(--ic-teal);    }
.icare-stat-yellow { border-color: var(--ic-warning); } .icare-stat-yellow .icare-stat-value { color: #b06000; }
.icare-stat-purple { border-color: var(--ic-purple);  } .icare-stat-purple .icare-stat-value { color: var(--ic-purple);  }

/* ---- Toolbar ---- */
.icare-toolbar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}
.icare-filter-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.icare-filter-tab {
    background: none;
    border: 1px solid var(--ic-border);
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    cursor: pointer;
    color: var(--ic-text2);
    transition: all .15s;
    font-family: inherit;
}
.icare-filter-tab.active,
.icare-filter-tab:hover {
    background: var(--ic-primary);
    border-color: var(--ic-primary);
    color: #fff;
}

/* ---- Patient list ---- */
.icare-patient-list { display: flex; flex-direction: column; gap: 7px; }

.icare-patient-row {
    display: grid;
    grid-template-columns: 48px 1fr 100px;
    align-items: stretch;
    background: var(--ic-card);
    border-radius: var(--ic-r);
    border: 1px solid var(--ic-border);
    box-shadow: var(--ic-shadow);
    overflow: hidden;
    transition: box-shadow .15s;
}
.icare-patient-row:hover { box-shadow: var(--ic-shadow-md); }

.icare-patient-cat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    font-size: 14px;
    flex-shrink: 0;
    margin-bottom: 3px;
}
.icare-cat-red    { background: #fce8e6; }
.icare-cat-orange { background: #fef3e2; }
.icare-cat-gray   { background: #f1f3f4; }

.icare-patient-middle {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    gap: 3px;
    min-width: 0;
    overflow: hidden;
}
.icare-patient-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.icare-patient-header {
    display: flex;
    align-items: center;
    gap: 5px;
    flex-wrap: wrap;
    margin-bottom: 3px;
}
.icare-patient-name { font-size: 14px; font-weight: 700; color: var(--ic-text); }
.icare-patient-time { font-size: 11px; color: var(--ic-text2); margin-left: auto; white-space: nowrap; }
.icare-patient-meta { font-size: 11px; color: var(--ic-text2); margin-bottom: 2px; }
.icare-patient-dx   { font-size: 12px; color: var(--ic-text); margin-bottom: 1px; }
.icare-patient-plan { font-size: 11px; }

.icare-patient-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    border-left: 1px solid var(--ic-border);
    background: #FAFAFA;
    overflow: hidden;
}
.icare-img-badge {
    font-size: 10px;
    color: var(--ic-text2);
    background: var(--ic-bg);
    padding: 2px 4px;
    border-radius: 4px;
}

.icare-empty-list {
    text-align: center;
    padding: 50px 20px;
    color: var(--ic-text2);
    background: var(--ic-card);
    border-radius: var(--ic-r);
    border: 2px dashed var(--ic-border);
}
.icare-empty-list span { font-size: 40px; display: block; margin-bottom: 10px; }

/* ---- Badges ---- */
.icare-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: .2px;
    white-space: nowrap;
}
.icare-badge-green  { background: #e6f4ea; color: #1e8e3e; }
.icare-badge-yellow { background: #fef7e0; color: #b06000; }
.icare-badge-red    { background: #fce8e6; color: #c5221f; }
.icare-badge-blue   { background: #e8f0fe; color: #1a73e8; }
.icare-badge-purple { background: #f3e8fd; color: #6d28d9; }
.icare-badge-teal   { background: #e0f5f5; color: #00796b; }
.icare-badge-orange { background: #fff3e0; color: #e65100; }
.icare-badge-gray   { background: #f1f3f4; color: #5f6368; }

/* ---- Buttons ---- */
.icare-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 8px 16px;
    border-radius: var(--ic-r-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: none;
    transition: all .15s;
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
    line-height: 1.4;
}
.icare-btn:focus { outline: 2px solid var(--ic-primary); outline-offset: 2px; }

.icare-btn-primary   { background: var(--ic-primary);   color: #fff; }
.icare-btn-primary:hover { background: var(--ic-primary-d); color: #fff; }

.icare-btn-secondary { background: #fff; color: var(--ic-text); border: 1px solid var(--ic-border); }
.icare-btn-secondary:hover { background: var(--ic-bg); }

.icare-btn-danger    { background: var(--ic-danger); color: #fff; }
.icare-btn-danger:hover { background: #b71c1c; }

.icare-btn-sm   { padding: 5px 12px; font-size: 12px; }
.icare-btn-xs   { padding: 3px 7px;  font-size: 11px; }
.icare-btn-lg   { padding: 12px 24px; font-size: 15px; }
.icare-btn-full { width: 100%; }

/* ---- Card ---- */
.icare-card {
    background: var(--ic-card);
    border-radius: var(--ic-r);
    padding: 22px;
    box-shadow: var(--ic-shadow);
    margin-bottom: 18px;
}
.icare-card h2 { margin-top: 0; font-size: 18px; }

/* ---- Form ---- */
.icare-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.icare-form-full { grid-column: 1 / -1; }
.icare-form-group { display: flex; flex-direction: column; gap: 4px; }
.icare-form-group label {
    font-size: 11px;
    font-weight: 700;
    color: var(--ic-text2);
    text-transform: uppercase;
    letter-spacing: .3px;
}
.req { color: var(--ic-danger); }
.icare-input {
    padding: 9px 11px;
    border: 1px solid var(--ic-border);
    border-radius: var(--ic-r-sm);
    font-size: 14px;
    color: var(--ic-text);
    background: #fff;
    width: 100%;
    transition: border-color .15s;
    font-family: inherit;
}
.icare-input:focus {
    outline: none;
    border-color: var(--ic-primary);
    box-shadow: 0 0 0 3px rgba(26,115,232,.12);
}
select.icare-input { appearance: auto; }
.icare-textarea     { min-height: 76px; resize: vertical; }
.icare-autoresize   { overflow: hidden; resize: none; }

/* ---- Modal ---- */
.icare-modal {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    padding-bottom: 76px; /* clear the 60px bottom nav + 16px gap */
}
.icare-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,.55);
    backdrop-filter: blur(2px);
}
.icare-modal-box {
    position: relative;
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 620px;
    max-height: 90vh;
    overflow: hidden;          /* clip border-radius only — body is the sole scroller */
    box-shadow: 0 24px 48px rgba(0,0,0,.25);
    display: flex;
    flex-direction: column;
}
.icare-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid var(--ic-border);
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
    border-radius: 12px 12px 0 0;
}
.icare-modal-header h3 { margin: 0; font-size: 16px; }
.icare-modal-close {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: var(--ic-text2);
    padding: 4px 6px;
    border-radius: 4px;
    font-family: inherit;
}
.icare-modal-close:hover { background: var(--ic-bg); }
.icare-modal-body { padding: 18px; flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; padding-bottom: 24px; }
.icare-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 18px;
    border-top: 1px solid var(--ic-border);
    background: var(--ic-bg);
    border-radius: 0 0 12px 12px;
    flex-shrink: 0;             /* never pushed off-screen by body content */
}

/* ---- OCR section ---- */
.icare-progress-bar {
    background: #c5d9f8;
    border-radius: 10px;
    height: 5px;
    overflow: hidden;
    margin-bottom: 5px;
}
.icare-progress-fill {
    height: 100%;
    background: var(--ic-primary);
    border-radius: 10px;
    width: 0%;
    transition: width .3s;
}
/* ---- Image section ---- */
.icare-image-section {
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--ic-border);
}
.icare-section-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--ic-text2);
    text-transform: uppercase;
    letter-spacing: .3px;
    margin-bottom: 8px;
}
.icare-image-gallery { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.icare-image-thumb {
    width: 76px;
    height: 76px;
    object-fit: cover;
    border-radius: var(--ic-r-sm);
    border: 2px solid var(--ic-border);
    cursor: pointer;
    transition: border-color .15s;
}
.icare-image-thumb:hover { border-color: var(--ic-primary); }
.icare-image-note { font-size: 11px; color: var(--ic-text2); margin-top: 6px; }

/* ---- Export modal ---- */
.icare-export-tabs {
    display: flex;
    border-bottom: 1px solid var(--ic-border);
    margin-bottom: 14px;
}
.icare-export-tab {
    padding: 7px 14px;
    border: none;
    background: none;
    font-size: 13px;
    color: var(--ic-text2);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all .15s;
    font-family: inherit;
}
.icare-export-tab.active { color: var(--ic-primary); border-bottom-color: var(--ic-primary); font-weight: 600; }
.icare-export-hint { font-size: 12px; color: var(--ic-text2); margin-bottom: 8px; }
.icare-export-textarea {
    width: 100%;
    height: 260px;
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 12px;
    line-height: 1.6;
    padding: 12px;
    border: 1px solid var(--ic-border);
    border-radius: var(--ic-r-sm);
    resize: vertical;
    background: var(--ic-bg);
    margin-bottom: 10px;
    color: var(--ic-text);
}

/* ---- Table ---- */
.icare-table-wrap { overflow-x: auto; }
.icare-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.icare-table th {
    text-align: left;
    padding: 9px 12px;
    border-bottom: 2px solid var(--ic-border);
    color: var(--ic-text2);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .3px;
    white-space: nowrap;
}
.icare-table td { padding: 9px 12px; border-bottom: 1px solid var(--ic-border); }
.icare-table tr:last-child td { border-bottom: none; }
.icare-table tr:hover td { background: var(--ic-bg); }

/* ---- Alerts ---- */
.icare-alert {
    padding: 10px 14px;
    border-radius: var(--ic-r-sm);
    font-size: 13px;
    line-height: 1.5;
}
.icare-alert-success { background: #e6f4ea; color: #1e8e3e; border: 1px solid #b3dfbd; }
.icare-alert-error   { background: #fce8e6; color: #c5221f; border: 1px solid #f5c6c3; }
.icare-alert-info    { background: #e8f0fe; color: #1a73e8; border: 1px solid #c5d9f8; }

/* ---- Settings ---- */
.icare-settings-box {
    background: var(--ic-bg);
    border-radius: var(--ic-r-sm);
    padding: 16px;
    font-size: 14px;
    line-height: 1.8;
}
.icare-settings-box p { margin: 0; }

/* ---- Spinner ---- */
.icare-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid var(--ic-border);
    border-top-color: var(--ic-primary);
    border-radius: 50%;
    animation: ic-spin .6s linear infinite;
    vertical-align: middle;
}
@keyframes ic-spin { to { transform: rotate(360deg); } }

/* ---- Responsive ---- */
@media (max-width: 782px) {
    .icare-logo-sub { display: none; }
    .icare-stats-row { grid-template-columns: repeat(4, 1fr); }
    .icare-shift-bar { flex-direction: column; align-items: flex-start; }
    .icare-modal { align-items: flex-end; padding: 0; padding-bottom: 64px; } /* 64px = bottom nav height + gap */
    .icare-modal-box { max-width: 100%; border-radius: 16px 16px 0 0; max-height: calc(92vh - 64px); overflow: hidden; }
    .icare-patient-header { gap: 4px; }
}
@media (max-width: 540px) {
    .icare-form-grid { grid-template-columns: 1fr; }
    .icare-form-full { grid-column: 1; }
    .icare-stats-row { grid-template-columns: repeat(3, 1fr); }
    .icare-wrap { padding: 0 10px 60px; }
    .icare-card { padding: 16px; }
}

/* ================================================================
   iCare CSS additions v1.1.0 — census panel, flags, new zones
   ================================================================ */

/* Census Panel */
.icare-census-panel {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 10px;
    margin-bottom: 20px;
    overflow: hidden;
}
.icare-census-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: #1a73e8;
    background: #f8f9ff;
    border-bottom: 1px solid #e8eaed;
    user-select: none;
}
.icare-census-header:hover { background: #eef2ff; }
.icare-census-chevron { font-size: 11px; transition: transform .2s; }
.icare-census-chevron.open { transform: rotate(180deg); }

.icare-census-body { padding: 16px; }
.icare-census-section { margin-bottom: 16px; }
.icare-census-section:last-child { margin-bottom: 0; }
.icare-census-section-title {
    font-size: 12px;
    font-weight: 700;
    color: #5f6368;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 10px;
}
.icare-census-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
}
.icare-census-field label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #5f6368;
    margin-bottom: 4px;
}
.icare-census-input { text-align: center; padding: 6px 8px !important; }

/* Flag toggle buttons on patient row */
.icare-flag-group {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}
.icare-flag-btn {
    background: #f1f3f4;
    border: 1px solid #dadce0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    padding: 3px 6px;
    line-height: 1;
    transition: all .15s;
    opacity: .45;
}
.icare-flag-btn:hover { opacity: .75; border-color: #1a73e8; }
.icare-flag-btn.active {
    background: #e8f0fe;
    border-color: #1a73e8;
    opacity: 1;
    box-shadow: 0 0 0 2px rgba(26,115,232,.15);
}

/* Flag checkboxes in modal */
.icare-flag-section {
    margin: 16px 0 0;
    padding: 12px 14px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e8eaed;
}
.icare-flag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 8px;
}
.icare-flag-check {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    cursor: pointer;
    user-select: none;
}
.icare-flag-check input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

/* Small textarea for contact */
.icare-textarea-sm { min-height: 60px !important; }

/* Export modal actions row */
.icare-export-actions {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}
.icare-export-actions .icare-btn { flex: 1; }

/* 4-tab export tab bar */
.icare-export-tabs { flex-wrap: wrap; }
.icare-export-tab {
    font-size: 12px;
    padding: 7px 10px;
}

/* Badge color for new zones */
.icare-badge-orange { background: #fff3e0; color: #e65100; border: 1px solid #ffcc80; }

/* Ward group visibility tweak */
#icare-ward-group, #icare-ward-bed-group { transition: opacity .2s; }

/* ================================================================
   Location management (Settings page) — v1.1.0
   ================================================================ */

.icare-add-location-form {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #e8eaed;
}

.icare-location-form-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    margin-top: 16px;
}

/* Zebra stripe for location table */
#icare-location-table tbody tr:nth-child(even) { background: #f8f9fa; }
#icare-location-table tbody tr:hover { background: #eef2ff; }
#icare-location-table td { vertical-align: middle; }

/* Badge orange — already in existing CSS but ensure it's there */
.icare-badge-teal    { background: #e6f4ea; color: #137333; border: 1px solid #a8d5b5; }

/* ================================================================
   v1.1.5 — prominent Add Patient button
   ================================================================ */

.icare-btn-add-patient {
    font-size: 15px !important;
    padding: 10px 22px !important;
    font-weight: 700 !important;
    letter-spacing: .3px;
    box-shadow: 0 2px 8px rgba(26,115,232,.35);
    border-radius: 10px !important;
    width: 100%;
    display: block;
}
.icare-btn-add-patient:hover {
    box-shadow: 0 4px 14px rgba(26,115,232,.45);
    transform: translateY(-1px);
}

/* ================================================================
   v1.1.7 — clickable patient row
   ================================================================ */

.icare-patient-row {
    cursor: pointer;
    transition: background .12s, box-shadow .12s;
}
.icare-patient-row:hover {
    background: #f0f4ff;
    box-shadow: inset 3px 0 0 #1a73e8;
}
/* Action area — not clickable as a row */
.icare-patient-actions {
    cursor: default;
}

/* ================================================================
   v1.2.1 — drag-to-reorder patient rows
   ================================================================ */

.icare-drag-handle {
    cursor: grab;
    font-size: 18px;
    color: #c0c8d8;
    padding: 0 6px 0 0;
    line-height: 1;
    flex-shrink: 0;
    align-self: center;
    user-select: none;
    transition: color .15s;
}
.icare-drag-handle:hover { color: #1a73e8; }
.icare-drag-handle:active { cursor: grabbing; }

/* Row being dragged */
.icare-patient-row.dragging {
    opacity: .4;
    background: #e8f0fe !important;
    border: 2px dashed #1a73e8 !important;
}

/* Drop target indicator */
.icare-patient-row.drag-over {
    border-top: 3px solid #1a73e8 !important;
    margin-top: -1px;
}

/* ================================================================
   v1.2.3 — numbered sequence + up/down reorder buttons
   ================================================================ */

/* Remove old drag styles */
.icare-drag-handle { display: none; }

.icare-seq-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
    min-width: 32px;
}

.icare-seq-num {
    font-size: 13px;
    font-weight: 800;
    color: #1a73e8;
    line-height: 1;
    min-width: 20px;
    text-align: center;
}

.icare-seq-btns {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.icare-seq-btn {
    background: #f1f3f4;
    border: 1px solid #dadce0;
    border-radius: 4px;
    cursor: pointer;
    font-size: 9px;
    line-height: 1;
    padding: 2px 5px;
    color: #5f6368;
    transition: all .12s;
}
.icare-seq-btn:hover:not(:disabled) {
    background: #e8f0fe;
    border-color: #1a73e8;
    color: #1a73e8;
}
.icare-seq-btn:disabled {
    opacity: .3;
    cursor: default;
}

/* ================================================================
   v1.2.5 — image lightbox + thumbnail delete button
   ================================================================ */

/* Thumbnail wrapper — position:relative for delete overlay */
.icare-img-thumb-wrap {
    position: relative;
    display: inline-block;
    flex-shrink: 0;
}

/* Delete button on thumbnail — always visible on touch, hover on desktop */
.icare-img-del-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(0,0,0,.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 11px;
    line-height: 22px;
    text-align: center;
    cursor: pointer;
    padding: 0;
    opacity: 1;               /* always visible */
    transition: background .15s;
}
.icare-img-del-btn:hover { background: #d93025; }

/* Lightbox */
#icare-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 200000;
    background: rgba(0,0,0,.92);
    align-items: center;
    justify-content: center;
    flex-direction: column;
}
#icare-lightbox.flex-display { display: flex; }

#icare-lb-overlay {
    position: absolute;
    inset: 0;
}

#icare-lb-content {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: 92vw;
    max-height: 80vh;
    z-index: 1;
}

#icare-lb-img {
    max-width: 92vw;
    max-height: 76vh;
    object-fit: contain;
    border-radius: 8px;
    user-select: none;
    -webkit-user-drag: none;
}

#icare-lb-counter {
    margin-top: 10px;
    color: rgba(255,255,255,.7);
    font-size: 13px;
    letter-spacing: .5px;
}

/* Nav buttons */
#icare-lb-prev, #icare-lb-next {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    font-size: 36px;
    line-height: 1;
    padding: 12px 16px;
    cursor: pointer;
    border-radius: 8px;
    z-index: 2;
    transition: background .15s;
}
#icare-lb-prev { left: 12px; }
#icare-lb-next { right: 12px; }
#icare-lb-prev:hover, #icare-lb-next:hover { background: rgba(255,255,255,.3); }

/* Close button */
#icare-lb-close {
    position: fixed;
    top: 14px;
    right: 14px;
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    font-size: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    z-index: 2;
    transition: background .15s;
}
#icare-lb-close:hover { background: rgba(255,255,255,.3); }

/* Delete button */
#icare-lb-delete {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: #d93025;
    border: none;
    color: #fff;
    font-size: 14px;
    padding: 9px 20px;
    border-radius: 8px;
    cursor: pointer;
    z-index: 2;
    transition: background .15s;
}
#icare-lb-delete:hover { background: #b3261e; }

/* ================================================================
   v1.2.7 — clerked toggle button on patient card
   ================================================================ */

.icare-clerked-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    border-radius: 20px;
    border: 2px solid #dadce0;
    background: #f8f9fa;
    color: #5f6368;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
    font-family: inherit;
}
.icare-clerked-btn:hover {
    border-color: #1a73e8;
    color: #1a73e8;
    background: #e8f0fe;
}
.icare-clerked-btn.clerked {
    background: #e6f4ea;
    border-color: #34a853;
    color: #137333;
}
.icare-clerked-btn.clerked:hover {
    background: #d2edd8;
    border-color: #137333;
}

/* ================================================================
   v1.2.2 — Insurance / SOCSO section
   ================================================================ */

.icare-insurance-section {
    margin: 16px 0 0;
    padding: 12px 14px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e8eaed;
}

.icare-ins-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    background: #e8f0fe;
    color: #1557b0;
    border: 1px solid #c5d9f8;
    border-radius: 20px;
    padding: 2px 10px;
}

.icare-patient-insurance {
    margin-top: 5px;
}

/* ================================================================
   v1.2.8 — Status filter tabs row
   ================================================================ */

.icare-status-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 0 12px;
    border-bottom: 1px solid #e8eaed;
    margin-bottom: 12px;
}

.icare-status-tab {
    background: #f1f3f4;
    border: 1px solid #dadce0;
    border-radius: 20px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    color: #3c4043;
    white-space: nowrap;
    transition: all .15s;
    font-family: inherit;
}

.icare-status-tab:hover {
    background: #e8eaed;
    border-color: #bdc1c6;
}

.icare-status-tab.active {
    background: #1a73e8;
    color: #fff;
    border-color: #1a73e8;
    font-weight: 600;
}

/* ================================================================
   v1.3.3 — compact referral time field
   ================================================================ */

.icare-ref-time-group {
    max-width: 160px !important;
    min-width: 120px;
}
.icare-ref-time-input {
    max-width: 140px !important;
    padding-left: 8px !important;
    padding-right: 4px !important;
}

/* ================================================================
   v1.2.3 — image section actions (Add + Download buttons)
   ================================================================ */

.icare-image-section-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

/* ================================================================
   v1.2.5 — inline image row inside patient card body
   ================================================================ */

.icare-patient-images-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.icare-patient-images-row .icare-img-badge {
    font-size: 12px;
    color: #5f6368;
    background: #f1f3f4;
    border-radius: 6px;
    padding: 2px 8px;
    border: 1px solid #e0e0e0;
}

/* ================================================================
   v1.2.6 — S/B SP label + filter tabs
   ================================================================ */

/* S/B SP label below flag buttons */
.icare-sbsp-label {
    font-size: 10px;
    font-weight: 700;
    color: #1a73e8;
    letter-spacing: .3px;
    min-height: 14px;
    text-align: center;
    margin-top: 2px;
}

/* SP filter tab row */
.icare-sp-filter-tabs {
    margin-top: 0;
}
.icare-sp-filter-tab {
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    color: #5f6368;
    transition: all .15s;
    white-space: nowrap;
    font-family: inherit;
}
.icare-sp-filter-tab:hover {
    background: #f1f3f4;
    border-color: #bdc1c6;
}
.icare-sp-filter-tab.active {
    background: #e8f0fe;
    border-color: #1a73e8;
    color: #1a73e8;
    font-weight: 600;
}
/* Pending tab — orange accent when active */
.icare-sp-filter-tab[data-sp-filter="pending"].active {
    background: #fff3e0;
    border-color: #e65100;
    color: #e65100;
}

/* ================================================================
   v1.2.7 — prominent Export WhatsApp button
   ================================================================ */

.icare-btn-export-main {
    background: #25D366 !important;         /* WhatsApp green */
    color: #fff !important;
    border: none !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    padding: 9px 18px !important;
    border-radius: 10px !important;
    box-shadow: 0 2px 8px rgba(37,211,102,.4);
    letter-spacing: .2px;
}
.icare-btn-export-main:hover {
    background: #1ebe5d !important;
    box-shadow: 0 4px 14px rgba(37,211,102,.5);
    transform: translateY(-1px);
    color: #fff !important;
}

/* ================================================================
   v1.2.13 — prominent Export button (green, distinct from Add Patient)
   ================================================================ */

.icare-btn-export {
    background: #1e8c45 !important;
    border-color: #1e8c45 !important;
    color: #fff !important;
    font-weight: 700 !important;
    letter-spacing: .2px;
    box-shadow: 0 2px 8px rgba(30,140,69,.35);
}
.icare-btn-export:hover {
    background: #166d36 !important;
    border-color: #166d36 !important;
    box-shadow: 0 4px 12px rgba(30,140,69,.45);
    transform: translateY(-1px);
}

/* ================================================================
   v1.2.19 — IC age badge
   ================================================================ */

.icare-age-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 3px 10px;
    background: #e8f0fe;
    color: #1a73e8;
    border: 1px solid #c5d8fd;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .3px;
}

/* ================================================================
   v1.1.6 — S/B SP larger tap target + callback button styling
   ================================================================ */

/* S/B SP — larger, easier to tap */
.icare-flag-btn-sp {
    font-size: 18px !important;
    padding: 5px 9px !important;
    min-width: 40px;
    min-height: 36px;
    border-radius: 8px !important;
}
.icare-flag-btn-sp.active {
    background: #e8f0fe !important;
    border-color: #1a73e8 !important;
    box-shadow: 0 0 0 2px rgba(26,115,232,.25) !important;
    opacity: 1 !important;
}

/* Callback — orange tint when active to stand out as urgent */
.icare-flag-btn-callback {
    font-size: 16px !important;
}
.icare-flag-btn-callback.active {
    background: #fff3e0 !important;
    border-color: #e65100 !important;
    box-shadow: 0 0 0 2px rgba(230,81,0,.2) !important;
    opacity: 1 !important;
}

/* ================================================================
   v1.1.7 — Plan Done button
   ================================================================ */

/* Plan Done — green tint, prominent, first in flag group */
.icare-flag-btn-plan {
    font-size: 16px !important;
    padding: 4px 9px !important;
    min-width: 36px;
    min-height: 34px;
    border-radius: 8px !important;
    font-weight: 700;
}
.icare-flag-btn-plan.active {
    background: #e6f4ea !important;
    border-color: #137333 !important;
    box-shadow: 0 0 0 2px rgba(19,115,51,.2) !important;
    opacity: 1 !important;
}
/* Inactive state — slightly amber to indicate pending */
.icare-flag-btn-plan:not(.active) {
    background: #fffde7 !important;
    border-color: #f9a825 !important;
    opacity: 0.75;
}
.icare-flag-btn-plan:not(.active):hover {
    opacity: 1;
    border-color: #137333 !important;
}

/* ================================================================
   v1.1.9 — Plan Done button on its own line
   ================================================================ */

.icare-flag-group {
    flex-direction: column;
    align-items: flex-start;
    gap: 5px;
}

.icare-flag-btn-plan {
    width: 100%;
    text-align: left;
    padding-left: 10px !important;
    font-size: 13px !important;
    letter-spacing: .2px;
}

.icare-flag-btn-plan::after {
    content: ' Plan Done';
    font-size: 12px;
    font-weight: 600;
}

.icare-flag-group-secondary {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

/* ================================================================
   v1.2.0 — Request Scans + Call Back Pt button styling
   ================================================================ */

/* Request Scans — teal/blue tint when active */
.icare-flag-btn-scans.active {
    background: #e0f7fa !important;
    border-color: #00838f !important;
    box-shadow: 0 0 0 2px rgba(0,131,143,.2) !important;
    opacity: 1 !important;
}

/* Callback label suffix */
.icare-flag-btn-callback::after {
    content: ' Call Back Pt';
    font-size: 11px;
    font-weight: 600;
}

/* Scans label suffix */
.icare-flag-btn-scans::after {
    content: ' Req. Scans';
    font-size: 11px;
    font-weight: 600;
}

/* Make callback + scans full-width like plan_done */
.icare-flag-btn-callback,
.icare-flag-btn-scans {
    width: 100%;
    text-align: left;
    padding-left: 10px !important;
}

/* ================================================================
   v1.2.2 — Add Patient button below patient list
   ================================================================ */

.icare-add-patient-bottom {
    margin: 14px 0 4px;
    text-align: center;
}
.icare-add-patient-bottom .icare-btn-add-patient {
    width: 100%;
    max-width: 360px;
}

/* ================================================================
   v1.2.3 — Flag buttons: 2-column grid, equal width
   ================================================================ */

/* Override previous flex/column layout */
.icare-flag-group {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
    width: 100%;
    flex-direction: unset !important;
    align-items: unset !important;
}

/* All flag buttons equal width, consistent height */
.icare-flag-group .icare-flag-btn {
    width: 100% !important;
    text-align: left;
    padding: 6px 8px !important;
    font-size: 13px !important;
    min-height: 34px;
    display: flex;
    align-items: center;
    gap: 5px;
    border-radius: 7px !important;
}

/* Remove ::after text — use explicit labels in button via CSS content on span instead */
.icare-flag-btn-plan::after    { content: ' Plan Done';    font-size: 11px; font-weight: 600; }
.icare-flag-btn-sp::after      { content: ' S/B Sp';       font-size: 11px; font-weight: 600; }
.icare-flag-btn-callback::after{ content: ' Call Back';    font-size: 11px; font-weight: 600; }
.icare-flag-btn-scans::after   { content: ' Req. Scans';   font-size: 11px; font-weight: 600; }

/* Reset overrides from earlier rules that broke grid */
.icare-flag-btn-plan,
.icare-flag-btn-callback,
.icare-flag-btn-scans {
    width: 100% !important;
    padding-left: 8px !important;
    font-size: 13px !important;
}

/* SP button — normalise size to match grid peers */
.icare-flag-btn-sp {
    font-size: 13px !important;
    min-width: unset;
    min-height: 34px;
    padding: 6px 8px !important;
}

/* ================================================================
   v1.2.6 — Narrower action flag buttons
   ================================================================ */

.icare-flag-group {
    grid-template-columns: 1fr 1fr !important;
    max-width: 220px;
    gap: 4px !important;
}

.icare-flag-group .icare-flag-btn {
    padding: 4px 6px !important;
    font-size: 12px !important;
    min-height: 28px;
    gap: 3px;
}

.icare-flag-btn-plan::after    { font-size: 10px !important; }
.icare-flag-btn-sp::after      { font-size: 10px !important; }
.icare-flag-btn-callback::after{ font-size: 10px !important; }
.icare-flag-btn-scans::after   { font-size: 10px !important; }

/* ================================================================
   v1.2.7 — Even narrower action flag buttons
   ================================================================ */

.icare-flag-group {
    max-width: 160px !important;
    gap: 3px !important;
}

.icare-flag-group .icare-flag-btn {
    padding: 3px 5px !important;
    font-size: 11px !important;
    min-height: 24px;
    gap: 2px;
}

.icare-flag-btn-plan::after,
.icare-flag-btn-sp::after,
.icare-flag-btn-callback::after,
.icare-flag-btn-scans::after { font-size: 9px !important; }

/* ================================================================
   v1.2.8 — Black text on action flag buttons
   ================================================================ */

.icare-flag-group .icare-flag-btn,
.icare-flag-group .icare-flag-btn::after {
    color: #000 !important;
}

/* ================================================================
   v1.2.9 — Patient age badge
   ================================================================ */

.icare-patient-age {
    font-size: 11px;
    font-weight: 600;
    color: #5f6368;
    background: #f1f3f4;
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: 5px;
    vertical-align: middle;
    white-space: nowrap;
}

/* ================================================================
   v1.3.0 — Even smaller action flag buttons
   ================================================================ */

.icare-flag-group {
    max-width: 120px !important;
    gap: 2px !important;
}

.icare-flag-group .icare-flag-btn {
    padding: 2px 4px !important;
    font-size: 10px !important;
    min-height: 20px;
    gap: 2px;
    line-height: 1.2;
}

.icare-flag-btn-plan::after,
.icare-flag-btn-sp::after,
.icare-flag-btn-callback::after,
.icare-flag-btn-scans::after {
    font-size: 8px !important;
    font-weight: 700;
}

/* ================================================================
   v1.3.1 — Flag filter bar
   ================================================================ */

.icare-flag-filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    margin: 8px 0 10px;
    padding: 8px 10px;
    background: #f8f9fa;
    border: 1px solid #e8eaed;
    border-radius: 8px;
}

.icare-flag-filter-label {
    font-size: 11px;
    font-weight: 700;
    color: #5f6368;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-right: 2px;
}

.icare-flag-filter-btn {
    background: #fff;
    border: 1px solid #dadce0;
    border-radius: 20px;
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #3c4043;
    cursor: pointer;
    transition: all .15s;
    white-space: nowrap;
}
.icare-flag-filter-btn:hover {
    border-color: #1a73e8;
    color: #1a73e8;
    background: #e8f0fe;
}
.icare-flag-filter-btn.active {
    background: #1a73e8;
    border-color: #1a73e8;
    color: #fff !important;
    box-shadow: 0 1px 4px rgba(26,115,232,.35);
}
.icare-flag-filter-clear {
    color: #d93025 !important;
    border-color: #f5c6c2 !important;
    background: #fce8e6 !important;
    margin-left: auto;
}
.icare-flag-filter-clear:hover {
    background: #d93025 !important;
    border-color: #d93025 !important;
    color: #fff !important;
}

/* ================================================================
   v1.3.8 — Patient name search bar
   ================================================================ */

.icare-search-bar {
    position: relative;
    width: 100%;
    max-width: 340px;
    margin-bottom: 8px;
}

.icare-search-input {
    width: 100%;
    padding-right: 32px !important;
    border-radius: 20px !important;
    font-size: 13px !important;
}

.icare-search-clear {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #80868b;
    cursor: pointer;
    font-size: 13px;
    line-height: 1;
    display: none;
    padding: 2px;
}
.icare-search-clear:hover { color: #d93025; }

/* ================================================================
   v1.3.9 — Bottom search bar spacing
   ================================================================ */

.icare-search-bar-bottom {
    margin-top: 12px;
    margin-bottom: 4px;
}

/* ================================================================
   v1.5.3 — Location table drag-to-reorder
   ================================================================ */

.icare-drag-handle { cursor: grab !important; }
.icare-drag-handle:active { cursor: grabbing !important; }

#icare-location-tbody .ui-sortable-helper {
    background: #e8f0fe !important;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    display: table;
    width: 100%;
}

.icare-sort-placeholder {
    background: #f1f3f4;
    border: 2px dashed #1a73e8;
    height: 44px;
    visibility: visible !important;
}

/* ================================================================
   v1.5.4 — Location ▲▼ reorder buttons
   ================================================================ */

.icare-loc-up,
.icare-loc-down {
    font-size: 10px !important;
    padding: 2px 5px !important;
    min-width: 24px;
}
.icare-loc-up:disabled,
.icare-loc-down:disabled {
    opacity: 0.25;
    cursor: default;
}

/* ================================================================
   v1.6.0 — Patient Registry: Passover button + Duplicate alert
   ================================================================ */

/* Passover button */
.icare-btn-passover {
    display: block;
    width: 100%;
    text-align: left;
    padding: 4px 8px !important;
    font-size: 11px !important;
    font-weight: 700;
    color: #000 !important;
    background: #fff8e1;
    border: 1px solid #ffe082;
    border-radius: 6px !important;
    margin-top: 4px;
    transition: all .15s;
}
.icare-btn-passover:hover {
    background: #fff3cd;
    border-color: #ffc107;
}
.icare-btn-passover.active {
    background: #fff3cd !important;
    border-color: #e65100 !important;
    box-shadow: 0 0 0 2px rgba(230,81,0,.2);
    color: #e65100 !important;
}

/* Duplicate patient alert */
.icare-dup-alert {
    background: #fff8e1;
    border: 1.5px solid #ffc107;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 12px;
    font-size: 13px;
}
.icare-dup-inner strong { color: #e65100; }
.icare-dup-row {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid #ffe082;
}
.icare-dup-name { font-weight: 700; color: #1a1a1a; }

/* ================================================================
   v1.6.1 — Passover button: grey/turquoise, flag-group size
   ================================================================ */

/* Override the old full-width standalone passover style */
.icare-btn-passover {
    display: inline-flex !important;
    width: 100% !important;
    font-size: 10px !important;
    padding: 2px 4px !important;
    min-height: 20px;
    margin-top: 0 !important;
    text-align: left;
    background: #f1f3f4 !important;
    border: 1px solid #dadce0 !important;
    color: #000 !important;
    opacity: 0.55;
    border-radius: 7px !important;
}
.icare-btn-passover::after { content: ' Passover'; font-size: 8px; font-weight: 700; }
.icare-btn-passover:hover  { opacity: 0.85; border-color: #00acc1 !important; }

/* Passover inside flag group */
.icare-flag-btn-passover {
    background: #f1f3f4 !important;
    border-color: #b0bec5 !important;
    color: #000 !important;
    opacity: 0.55;
}
.icare-flag-btn-passover::after { content: ' Passover'; font-size: 8px; font-weight: 700; }
.icare-flag-btn-passover:hover  { opacity: 0.85; border-color: #00acc1 !important; }
.icare-flag-btn-passover.active {
    background: #e0f7fa !important;   /* light turquoise */
    border-color: #00acc1 !important;
    box-shadow: 0 0 0 2px rgba(0,172,193,.2) !important;
    color: #006064 !important;
    opacity: 1 !important;
}

/* ================================================================
   v1.6.5 — Patient name autocomplete suggestions dropdown
   ================================================================ */

.icare-suggestions-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #fff;
    border: 1.5px solid #1a73e8;
    border-radius: 0 0 8px 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,.15);
    max-height: 280px;
    overflow-y: auto;
}

.icare-suggestion-row {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #f1f3f4;
    line-height: 1.4;
    transition: background .1s;
}
.icare-suggestion-row:last-child { border-bottom: none; }
.icare-suggestion-row:hover { background: #e8f0fe; }

.icare-sug-ic    { color: #5f6368; margin-left: 6px; font-size: 12px; }
.icare-sug-visits{ color: #1a73e8; font-weight: 700; margin-left: 8px; font-size: 12px; }
.icare-sug-date  { color: #80868b; font-size: 11px; margin-left: 6px; }
.icare-sug-dx    { color: #5f6368; font-size: 11px; margin-top: 2px; }

.icare-suggestion-new {
    color: #137333;
    font-weight: 600;
    background: #f8fdf9;
    border-top: 1px solid #e8eaed;
}
.icare-suggestion-new:hover { background: #e6f4ea; }

/* ================================================================
   v1.7.1 — Notification bell + header layout
   ================================================================ */

.icare-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.icare-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.icare-notif-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid #e0e0e0;
    text-decoration: none;
    transition: all .15s;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.icare-notif-bell:hover {
    border-color: #1a73e8;
    box-shadow: 0 2px 8px rgba(26,115,232,.2);
}

.icare-bell-icon { font-size: 18px; line-height: 1; }

.icare-bell-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    background: #d93025;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
    border: 2px solid #fff;
    animation: icare-bell-pulse 2s infinite;
}

@keyframes icare-bell-pulse {
    0%, 100% { transform: scale(1); }
    50%       { transform: scale(1.15); }
}

/* ================================================================
   v1.8.0 — Unified flag button sizing: all same width & height
   ================================================================ */

/* Make flag group a single column */
.icare-flag-group {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 4px !important;
    width: 100%;
}

/* All five action buttons: Plan Done, S/B SP, Call Back, Req Scans, Passover */
.icare-flag-btn,
.icare-flag-btn-passover {
    display: flex !important;
    align-items: center !important;
    width: 100% !important;
    min-height: 28px !important;
    padding: 4px 10px !important;
    font-size: 12px !important;
    text-align: left !important;
    box-sizing: border-box !important;
    white-space: nowrap;
    overflow: hidden;
}

/* Remove any ::after content size differences */
.icare-flag-btn::after,
.icare-flag-btn-passover::after {
    font-size: 11px !important;
    font-weight: 600 !important;
    margin-left: 3px;
}

/* Passover label suffix */
.icare-flag-btn-passover::after {
    content: ' Passover' !important;
}

/* ================================================================
   v1.8.1 — Smaller action button text
   ================================================================ */

.icare-flag-btn,
.icare-flag-btn-passover {
    font-size: 10px !important;
    min-height: 24px !important;
    padding: 3px 8px !important;
}

.icare-flag-btn::after,
.icare-flag-btn-passover::after {
    font-size: 10px !important;
}

/* ================================================================
   v1.8.2 — Even smaller action button text
   ================================================================ */

.icare-flag-btn,
.icare-flag-btn-passover {
    font-size: 8px !important;
    min-height: 20px !important;
    padding: 2px 6px !important;
    line-height: 1.2 !important;
}

.icare-flag-btn::after,
.icare-flag-btn-passover::after {
    font-size: 8px !important;
}

/* ================================================================
   v1.8.3 — Tighten emoji + text gap in action buttons
   ================================================================ */

.icare-flag-btn::after,
.icare-flag-btn-passover::after {
    margin-left: 1px !important;
}

/* ================================================================
   v1.8.5 — Bottom navigation bar
   ================================================================ */

.icare-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1000001; /* above ALL modals (modal=100000, lightbox=999999) */
    display: flex;
    align-items: stretch;
    background: #ffffff;
    border-top: 1.5px solid #e0e0e0;
    box-shadow: 0 -2px 12px rgba(0,0,0,.10);
    height: 60px;
}

.icare-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    text-decoration: none;
    color: #80868b;
    font-size: 10px;
    font-weight: 600;
    padding: 6px 4px;
    transition: all .15s;
    border: none;
    background: none;
}
.icare-nav-btn:hover  { color: #00897B; background: #F0FDFA; text-decoration: none; }
.icare-nav-btn.active { color: #00897B; }
.icare-nav-btn.active .icare-nav-icon { transform: scale(1.15); }

.icare-nav-home {
    border-left:  1px solid #f0f0f0;
    border-right: 1px solid #f0f0f0;
}
.icare-nav-home .icare-nav-icon { font-size: 24px !important; }
.icare-nav-home.active .icare-nav-icon {
    background: #1a73e8;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px !important;
}

.icare-nav-icon  { font-size: 19px; line-height: 1; }
.icare-nav-label { font-size: 9px; letter-spacing: .1px; white-space: nowrap; }

/* Push content up so it's not hidden behind the nav */
.icare-frontend-wrap { padding-bottom: 76px !important; }

/* ================================================================
   Patient Search results
   ================================================================ */

.icare-ps-result-card {
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
}
.icare-ps-result-header {
    padding: 12px 14px;
    background: #f8f9fa;
    cursor: pointer;
    user-select: none;
}
.icare-ps-result-header:hover { background: #e8f0fe; }
.icare-ps-ic { color: #5f6368; font-size: 12px; margin-left: 6px; }
.icare-ps-history { padding: 0 14px; }
.icare-ps-visit {
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}
.icare-ps-visit:last-child { border-bottom: none; }
.icare-ps-visit-header { font-size: 13px; margin-bottom: 4px; }
.icare-ps-dx   { color: #d32f2f; font-size: 12px; margin-top: 2px; }
.icare-ps-plan { color: #5f6368; font-size: 12px; margin-top: 2px; }

/* ================================================================
   v1.8.7 — Locum page: modern minimalist redesign
   ================================================================ */

/* Wrap */
.icare-locum-wrap {
    max-width: 560px;
    margin: 0 auto;
    padding: 8px 0 20px;
}

/* Hero */
.icare-locum-hero {
    text-align: center;
    padding: 32px 16px 24px;
}
.icare-locum-hero-pill {
    display: inline-block;
    background: #e8f0fe;
    color: #1a73e8;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    padding: 4px 12px;
    border-radius: 20px;
    margin-bottom: 12px;
}
.icare-locum-hero-title {
    font-size: 28px;
    font-weight: 800;
    color: #0d1117;
    margin: 0 0 8px;
    letter-spacing: -.5px;
    line-height: 1.1;
}
.icare-locum-hero-title span { color: #1a73e8; }
.icare-locum-hero-sub {
    color: #5f6368;
    font-size: 13px;
    line-height: 1.5;
    margin: 0;
}

/* Section */
.icare-locum-section {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 12px;
}
.icare-locum-section-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: #80868b;
    margin-bottom: 16px;
}

/* Fields */
.icare-locum-field {
    margin-bottom: 14px;
}
.icare-locum-field:last-child { margin-bottom: 0; }
.icare-locum-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: #3c4043;
    letter-spacing: .3px;
    text-transform: uppercase;
    margin-bottom: 6px;
}
.icare-locum-req      { color: #d93025; }
.icare-locum-optional { color: #80868b; font-weight: 400; font-size: 10px; text-transform: none; }
.icare-locum-input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    color: #0d1117;
    background: #fafafa;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    box-sizing: border-box;
}
.icare-locum-input:focus {
    border-color: #1a73e8;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(26,115,232,.1);
}

/* Credential cards */
.icare-locum-cred-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.icare-locum-cred-card {
    background: #f8f9fa;
    border: 1px solid #e8eaed;
    border-radius: 10px;
    padding: 14px;
}
.icare-locum-cred-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}
.icare-locum-cred-badge {
    background: #1a73e8;
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .5px;
    padding: 3px 8px;
    border-radius: 5px;
    flex-shrink: 0;
}
.icare-locum-cred-badge--apc { background: #0d7a5f; }
.icare-locum-cred-title {
    font-size: 10px;
    color: #5f6368;
    line-height: 1.3;
}

/* File upload */
.icare-locum-file-input { display: none; }
.icare-locum-file-label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    background: #fff;
    border: 1.5px dashed #c0c5cc;
    border-radius: 8px;
    cursor: pointer;
    transition: border-color .15s;
    font-size: 11px;
    color: #5f6368;
}
.icare-locum-file-label:hover { border-color: #1a73e8; color: #1a73e8; }
.icare-locum-file-icon { font-size: 14px; flex-shrink: 0; }
.icare-locum-file-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Submit button */
.icare-locum-submit-btn {
    display: block;
    width: 100%;
    padding: 14px;
    background: #0d1117;
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: .3px;
    transition: background .15s, transform .1s;
    margin-top: 12px;
}
.icare-locum-submit-btn:hover   { background: #1a73e8; }
.icare-locum-submit-btn:active  { transform: scale(.98); }
.icare-locum-submit-btn:disabled{ opacity: .55; cursor: not-allowed; }

/* Success state */
.icare-locum-success {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: #e6f4ea;
    border: 1.5px solid #ceead6;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 16px;
}
.icare-locum-success-icon { font-size: 24px; flex-shrink: 0; }
.icare-locum-success strong { display: block; color: #137333; margin-bottom: 2px; }
.icare-locum-success p { color: #5f6368; font-size: 13px; margin: 0; }

/* Status card */
.icare-locum-status-card {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 20px;
    border-radius: 14px;
    border: 1.5px solid #e0e0e0;
    background: #fafafa;
    margin-bottom: 12px;
}
.icare-locum-status-icon { font-size: 28px; flex-shrink: 0; }
.icare-locum-status-title { font-weight: 800; font-size: 16px; margin-bottom: 4px; }
.icare-locum-status-msg   { font-size: 13px; color: #5f6368; line-height: 1.4; }
.icare-locum-status--pending  { border-color: #ffd54f; background: #fffde7; }
.icare-locum-status--approved { border-color: #a8dab5; background: #e6f4ea; }
.icare-locum-status--rejected { border-color: #f5c6c4; background: #fce8e6; }
.icare-locum-status--pending  .icare-locum-status-title { color: #e65100; }
.icare-locum-status--approved .icare-locum-status-title { color: #137333; }
.icare-locum-status--rejected .icare-locum-status-title { color: #c5221f; }

/* Login section */
.icare-locum-login-section {
    background: #fff;
    border: 1px solid #e8eaed;
    border-radius: 14px;
    padding: 28px 20px;
    margin-top: 16px;
    text-align: center;
}
.icare-locum-login-divider {
    position: relative;
    margin-bottom: 16px;
}
.icare-locum-login-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0; right: 0;
    height: 1px;
    background: #e8eaed;
}
.icare-locum-login-divider span {
    position: relative;
    background: #fff;
    padding: 0 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #80868b;
}
.icare-locum-login-sub {
    color: #5f6368;
    font-size: 13px;
    margin-bottom: 16px;
}
.icare-locum-login-btn {
    display: block;
    padding: 13px 20px;
    background: #0d1117;
    color: #fff !important;
    border-radius: 10px;
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    transition: background .15s;
    margin-bottom: 12px;
}
.icare-locum-login-btn:hover { background: #1a73e8; color: #fff !important; text-decoration: none; }
.icare-locum-register-link { font-size: 12px; color: #80868b; margin: 0; }
.icare-locum-register-link a { color: #1a73e8; text-decoration: none; font-weight: 600; }

/* ================================================================
   v1.8.8 — iLocum coming-soon banner + search surgeon/plan styling
   ================================================================ */

.icare-locum-coming-soon {
    display: inline-block;
    background: #fff8e1;
    border: 1.5px solid #ffd54f;
    color: #e65100;
    font-size: 12px;
    font-weight: 600;
    padding: 8px 14px;
    border-radius: 8px;
    margin-top: 12px;
    line-height: 1.4;
}

.icare-ps-plan {
    color: #1a73e8;
    font-size: 12px;
    margin-top: 3px;
}

.icare-ps-surgeon {
    color: #137333;
    font-size: 12px;
    margin-top: 2px;
    font-weight: 600;
}

/* ================================================================
   v1.9.3 — Smaller bottom nav, iCare home button unchanged
   ================================================================ */

.icare-bottom-nav {
    height: 44px !important;
}

/* Side buttons — Locum & Search — smaller */
.icare-nav-btn {
    padding: 4px 2px !important;
    font-size: 8px !important;
    gap: 1px !important;
}
.icare-nav-icon  { font-size: 14px !important; }
.icare-nav-label { font-size: 8px !important; }

/* iCare home button stays the same visual size */
.icare-nav-home .icare-nav-icon  { font-size: 22px !important; }
.icare-nav-home .icare-nav-label { font-size: 9px  !important; font-weight: 700; }
.icare-nav-home.active .icare-nav-icon {
    width: 32px  !important;
    height: 32px !important;
    font-size: 16px !important;
}

/* Reduce content bottom padding to match new nav height */
.icare-frontend-wrap { padding-bottom: 52px !important; }

/* ================================================================
   v1.9.4 — iLocum: stack MMC/APC vertically on mobile
   ================================================================ */

@media (max-width: 520px) {
    .icare-locum-cred-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ================================================================
   v1.9.5 — Tighten icon-to-label gap in bottom nav
   ================================================================ */

.icare-nav-btn {
    gap: 0px !important;
    line-height: 1 !important;
}

/* ================================================================
   v2.0.1 — Frontend header notification bell
   ================================================================ */

.icare-frontend-bell {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #fff;
    border: 1.5px solid #e0e0e0;
    text-decoration: none !important;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    transition: border-color .15s, box-shadow .15s;
}
.icare-frontend-bell:hover {
    border-color: #1a73e8;
    box-shadow: 0 2px 8px rgba(26,115,232,.2);
    text-decoration: none !important;
}
.icare-frontend-bell .icare-bell-icon { font-size: 15px; line-height: 1; }
.icare-frontend-bell .icare-bell-badge {
    position: absolute;
    top: -3px;
    right: -3px;
    min-width: 16px;
    height: 16px;
    background: #d93025;
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    border: 2px solid #fff;
    animation: icare-bell-pulse 2s infinite;
}

/* ================================================================
   v2.0.4 — For Consent action button
   ================================================================ */

.icare-flag-btn-consent::after {
    content: ' For Consent' !important;
    font-size: 8px !important;
    font-weight: 700 !important;
    margin-left: 1px;
}
.icare-flag-btn-consent.active {
    background: #fff3e0 !important;
    border-color: #f57c00 !important;
    box-shadow: 0 0 0 2px rgba(245,124,0,.2) !important;
    color: #e65100 !important;
    opacity: 1 !important;
}

/* ================================================================
   v2.0.6 — Search result card: clickable to open shift
   ================================================================ */

.icare-ps-clickable {
    cursor: pointer;
    transition: border-color .15s, box-shadow .15s, transform .1s;
}
.icare-ps-clickable:hover {
    border-color: #1a73e8 !important;
    box-shadow: 0 3px 12px rgba(26,115,232,.15);
    transform: translateY(-1px);
}
.icare-ps-clickable:active { transform: translateY(0); }

/* ================================================================
   v2.0.7 — Visit history rows: clickable to open shift
   ================================================================ */

.icare-ps-visit-link {
    cursor: pointer;
    transition: background .12s;
}
.icare-ps-visit-link:hover {
    background: #e8f0fe;
    border-radius: 6px;
}

/* ================================================================
   v2.1.1 — Shift actions: two-row button layout
   ================================================================ */

.icare-shift-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-items: flex-end;
}
.icare-shift-actions-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ================================================================
   v2.2.0 — EMR: ICD-10, Medications, DDI, Referral
   ================================================================ */

/* ── ICD-10 section ──────────────────────────────────────────── */
.icare-emr-icd10-section {
    margin-top: 10px;
    background: #f8f9ff;
    border: 1px solid #d0d7ff;
    border-radius: 10px;
    padding: 10px 12px;
}
.icare-emr-icd10-bar {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 8px;
}
.icare-emr-icd10-bar span {
    font-size: 11px; font-weight: 700; letter-spacing: .6px;
    color: #3949ab; text-transform: uppercase;
}
.icare-icd10-suggestions { display: flex; flex-direction: column; gap: 5px; margin-bottom: 8px; }
.icare-icd10-chip-suggestion {
    text-align: left; background: #fff; border: 1.5px solid #c5cae9;
    border-radius: 8px; padding: 7px 10px; font-size: 12px; cursor: pointer;
    transition: background .12s;
}
.icare-icd10-chip-suggestion:hover { background: #e8eaf6; border-color: #3949ab; }
.icare-icd10-chip-suggestion.selected { background: #e8eaf6; color: #5f6368; cursor: default; }
.icare-icd10-chips { display: flex; flex-wrap: wrap; gap: 5px; min-height: 20px; }
.icare-icd10-chip {
    display: inline-flex; align-items: center; gap: 6px;
    background: #e8eaf6; border: 1px solid #c5cae9;
    border-radius: 20px; padding: 3px 10px; font-size: 12px; color: #283593;
}
.icare-icd10-chip-remove {
    border: none; background: none; cursor: pointer; color: #9fa8da;
    font-size: 14px; line-height: 1; padding: 0; margin: 0;
}
.icare-icd10-chip-remove:hover { color: #c62828; }

/* ── Medications section ─────────────────────────────────────── */
.icare-emr-med-section {
    margin-top: 12px;
    border: 1px solid #e0f2f1;
    border-radius: 10px;
    overflow: hidden;
}
.icare-emr-med-header {
    display: flex; align-items: center; justify-content: space-between;
    background: #e0f2f1; padding: 8px 12px;
    font-size: 13px; font-weight: 700; color: #00695c;
}
.icare-med-body { padding: 10px 12px; }
.icare-med-list { margin-bottom: 10px; }
.icare-med-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 7px 10px; background: #f8f9fa; border-radius: 8px;
    margin-bottom: 5px; font-size: 12px; border: 1px solid #e8eaed;
}
.icare-med-info { flex: 1; }
.icare-med-add-form { display: flex; flex-direction: column; gap: 6px; }
.icare-btn-teal {
    background: #00897b; color: #fff; border: none;
    border-radius: 8px; padding: 8px 14px; font-size: 12px; font-weight: 700;
    cursor: pointer; transition: background .15s;
}
.icare-btn-teal:hover { background: #00695c; }

/* ── DDI Alert ───────────────────────────────────────────────── */
.icare-ddi-alert {
    margin-top: 10px; border-radius: 10px; overflow: hidden;
    border: 1.5px solid #e53935;
}
.icare-ddi-alert-inner { padding: 12px 14px; background: #fff8f8; }
.icare-ddi-alert-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 10px; font-weight: 700; font-size: 13px; color: #b71c1c;
}
.icare-ddi-severity {
    font-size: 10px; font-weight: 800; padding: 2px 8px;
    border-radius: 4px; letter-spacing: .5px;
}
.icare-ddi-severity--mild          { background: #fff8e1; color: #e65100; }
.icare-ddi-severity--moderate      { background: #fff3e0; color: #bf360c; }
.icare-ddi-severity--major         { background: #ffebee; color: #c62828; }
.icare-ddi-severity--contraindicated{ background: #000; color: #fff; }
.icare-ddi-interaction {
    background: #fff; border: 1px solid #ffcdd2; border-radius: 6px;
    padding: 8px 10px; margin-bottom: 8px; font-size: 12px;
}
.icare-ddi-interaction-text { color: #5f6368; margin-top: 3px; }
.icare-ddi-rec { color: #e65100; font-size: 11px; margin-top: 3px; font-style: italic; }
.icare-ddi-warn { color: #e65100; font-size: 12px; padding: 6px 0; }
.icare-ddi-override-area { margin-top: 10px; border-top: 1px solid #ffcdd2; padding-top: 10px; }

/* ── Referral modal ──────────────────────────────────────────── */
#icare-referral-modal { max-width: 680px !important; }
#icare-referral-letter {
    width: 100%; min-height: 340px;
    font-family: 'Courier New', monospace;
    font-size: 12px; line-height: 1.7;
    color: #1a1a1a; background: #fafafa;
    border: 1px solid #e0e0e0; border-radius: 8px;
    padding: 16px; resize: vertical;
}
.icare-referral-btn { color: #0288d1 !important; }

/* ================================================================
   v3.0.2 — ICD-10 auto-link dropdown (live search as you type)
   ================================================================ */

/* Dropdown container */
.icare-icd10-dropdown {
    border: 1.5px solid #c5cae9;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 4px 16px rgba(57,73,171,.15);
    overflow: hidden;
    margin-top: 4px;
}

.icare-icd10-dropdown-hint {
    padding: 6px 12px;
    background: #e8eaf6;
    font-size: 10px;
    font-weight: 700;
    color: #3949ab;
    letter-spacing: .4px;
    text-transform: uppercase;
}

/* Each suggestion row */
.icare-icd10-chip-suggestion {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    text-align: left;
    background: #fff;
    border: none;
    border-bottom: 1px solid #f0f0f0;
    padding: 9px 12px;
    font-size: 13px;
    cursor: pointer;
    transition: background .1s;
}
.icare-icd10-chip-suggestion:last-child { border-bottom: none; }
.icare-icd10-chip-suggestion:hover  { background: #e8eaf6; }
.icare-icd10-chip-suggestion.selected { background: #f3f4f9; color: #5f6368; cursor: default; }

.icare-icd10-code {
    font-weight: 800;
    color: #3949ab;
    font-size: 12px;
    min-width: 62px;
    flex-shrink: 0;
    font-family: monospace;
}
.icare-icd10-desc { flex: 1; color: #0d1117; font-size: 12px; }
.icare-icd10-added { color: #137333; font-weight: 700; font-size: 12px; flex-shrink: 0; }

/* Selected chips stay the same */
.icare-icd10-chips { margin-top: 6px; }

/* ================================================================
   v3.1.1 — Scan Investigation button + modal
   ================================================================ */

.icare-scan-btn { color: #7b1fa2 !important; }

/* 4-button nav on patient dashboard */
.icare-pd-nav--4 .icare-pd-nav-btn { font-size: 8px; }
.icare-pd-nav--4 .icare-pd-nav-icon { font-size: 17px; }
.icare-pd-nav--4 .icare-pd-nav-home .icare-pd-nav-icon { font-size: 21px; }
.icare-pd-nav--4 .icare-pd-nav-home.active .icare-pd-nav-icon {
    width: 34px; height: 34px; font-size: 17px;
}

/* ================================================================
   v3.2.0 — Dedicated Case Note View Modal
   ================================================================ */

/* Modal container — full-page overlay */
.icare-cn-modal {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: #F0F2F5;
    z-index: 100010;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    font-family: 'Segoe UI', system-ui, sans-serif;
}

/* Top bar */
.icare-cn-topbar {
    background: #0B2D4E;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 2px solid #00897B;
    flex-shrink: 0;
}
.icare-cn-topbar-logo {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.3px;
}
.icare-cn-topbar-logo span { color: #00BFA5; }
.icare-cn-topbar-logo small {
    font-size: 11px;
    font-weight: 400;
    color: #8BAABB;
    margin-left: 8px;
    letter-spacing: .3px;
}
.icare-cn-topbar-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Patient header */
.icare-cn-pt-header {
    background: #0B2D4E;
    padding: 14px 20px 12px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 3px solid #00897B;
    flex-shrink: 0;
}
.icare-cn-pt-label {
    font-size: 10px;
    font-weight: 700;
    color: #00BFA5;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 4px;
}
.icare-cn-pt-name {
    font-size: 22px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.3px;
    margin-bottom: 6px;
}
.icare-cn-pt-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 12px;
    color: #8BAABB;
}
.icare-cn-pt-meta span { color: #C0D8E8; font-weight: 600; }
.icare-cn-pt-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 6px;
}
.icare-cn-zone-badge {
    background: #00897B;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 20px;
    letter-spacing: .5px;
    text-transform: uppercase;
}
.icare-cn-flags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
}
.icare-cn-flag {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    background: rgba(255,255,255,.1);
    color: #C0D8E8;
    border: 1px solid rgba(255,255,255,.15);
}
.icare-cn-recorded {
    font-size: 11px;
    color: #5A7A8A;
    text-align: right;
}

/* Tabs */
.icare-cn-tabs {
    display: flex;
    gap: 2px;
    padding: 0 20px;
    background: #fff;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
}
.icare-cn-tab {
    font-size: 12px;
    font-weight: 500;
    padding: 9px 14px;
    cursor: pointer;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    color: #6B7280;
    transition: all .15s;
}
.icare-cn-tab:hover { color: #0B2D4E; }
.icare-cn-tab.active {
    color: #00897B;
    border-bottom-color: #00897B;
    font-weight: 700;
}

/* Body */
.icare-cn-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 20px;
    -webkit-overflow-scrolling: touch;
}
.icare-cn-tab-panel { display: none; }
.icare-cn-tab-panel.active { display: block; }

/* Two-column layout */
.icare-cn-two-col {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 14px;
    align-items: start;
}
.icare-cn-col-main { display: flex; flex-direction: column; gap: 12px; }
.icare-cn-col-side  { display: flex; flex-direction: column; gap: 12px; }

/* Sections / cards */
.icare-cn-section {
    background: #fff;
    border-radius: 10px;
    border: 1px solid #E5E7EB;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.icare-cn-section-title {
    padding: 9px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: #6B7280;
    background: #FAFBFC;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    align-items: center;
    gap: 7px;
}
.icare-cn-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #00897B;
    flex-shrink: 0;
}

/* Diagnosis */
.icare-cn-dx {
    padding: 12px 14px 8px;
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    line-height: 1.5;
}
.icare-cn-icd-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 14px 12px;
}
.icare-cn-icd-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #EEF2FF;
    border: 1px solid #C7D2FE;
    border-radius: 20px;
    padding: 3px 10px 3px 5px;
    font-size: 12px;
    color: #3730A3;
}
.icare-cn-icd-code {
    font-family: monospace;
    font-weight: 700;
    font-size: 11px;
    background: #3730A3;
    color: #fff;
    padding: 1px 6px;
    border-radius: 10px;
}

/* Note box */
.icare-cn-note-box {
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.7;
    color: #374151;
    white-space: pre-wrap;
}

/* Medication rows */
.icare-cn-med-item {
    padding: 10px 14px;
    border-bottom: 1px solid #F3F4F6;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}
.icare-cn-med-item:last-child { border-bottom: none; }
.icare-cn-med-name { font-weight: 600; font-size: 13px; color: #111827; margin-bottom: 2px; }
.icare-cn-med-detail { font-size: 12px; color: #6B7280; }
.icare-cn-ddi-badge {
    font-size: 10px;
    font-weight: 700;
    color: #D97706;
    background: #FFFBEB;
    border: 1px solid #FDE68A;
    padding: 2px 8px;
    border-radius: 10px;
    white-space: nowrap;
    flex-shrink: 0;
}

/* Referral */
.icare-cn-referral-box {
    padding: 12px 14px;
    font-size: 12px;
    line-height: 1.6;
    color: #166534;
    background: #F0FDF4;
}
.icare-cn-referral-to { font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.icare-cn-referral-sent { font-size: 11px; color: #16A34A; margin-top: 5px; }

/* DDI override */
.icare-cn-ddi-item {
    padding: 10px 14px;
    font-size: 12px;
    border-bottom: 1px solid #FEF3C7;
    background: #FFFBEB;
}
.icare-cn-ddi-item:last-child { border-bottom: none; }
.icare-cn-ddi-drug { font-weight: 600; color: #92400E; margin-bottom: 2px; }
.icare-cn-ddi-reason { color: #78350F; }
.icare-cn-ddi-meta { color: #D97706; font-size: 11px; margin-top: 3px; }

/* Scan cards */
.icare-cn-scan-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    margin-bottom: 10px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.icare-cn-scan-card:last-child { margin-bottom: 0; }
.icare-cn-scan-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #FAFBFC;
    border-bottom: 1px solid #E5E7EB;
}
.icare-cn-scan-type { font-weight: 700; font-size: 13px; color: #111827; }
.icare-cn-scan-date { font-size: 12px; color: #6B7280; margin-top: 2px; }
.icare-cn-scan-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 10px;
}
.icare-cn-scan-badge--upcoming  { background: #EFF6FF; color: #1D4ED8; }
.icare-cn-scan-badge--completed { background: #F0FDF4; color: #16A34A; }
.icare-cn-scan-body { padding: 10px 14px; font-size: 12px; color: #6B7280; line-height: 1.6; }
.icare-cn-scan-result {
    margin-top: 8px;
    padding: 10px 12px;
    background: #F0FDF4;
    border-radius: 8px;
    border: 1px solid #BBF7D0;
    font-size: 12px;
    color: #166534;
}
.icare-cn-scan-prep {
    margin-top: 8px;
    padding: 10px 12px;
    background: #FFFBEB;
    border-radius: 8px;
    border: 1px solid #FDE68A;
    font-size: 12px;
    color: #78350F;
}
.icare-cn-scan-result-label,
.icare-cn-scan-prep-label {
    font-weight: 700;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 4px;
}
.icare-cn-scan-result-label { color: #16A34A; }
.icare-cn-scan-prep-label   { color: #D97706; }

/* History */
.icare-cn-hist-item {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 8px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
}
.icare-cn-hist-date {
    font-size: 11px;
    font-weight: 700;
    color: #9CA3AF;
    min-width: 65px;
    font-family: monospace;
    padding-top: 2px;
}
.icare-cn-hist-dx { font-weight: 600; font-size: 13px; color: #111827; margin-bottom: 3px; }
.icare-cn-hist-sub { font-size: 12px; color: #6B7280; }
.icare-cn-hist-icd {
    display: inline-block;
    margin-top: 4px;
    font-size: 10px;
    font-family: monospace;
    background: #EEF2FF;
    color: #4338CA;
    padding: 1px 7px;
    border-radius: 8px;
    font-weight: 700;
}
.icare-cn-hist-current {
    border-left: 3px solid #00897B;
    background: #F0FDF4;
}

/* Empty state */
.icare-cn-empty { font-size: 13px; color: #9CA3AF; padding: 12px 14px; font-style: italic; }

/* Loading */
.icare-cn-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    flex-direction: column;
    gap: 12px;
    color: #9CA3AF;
    font-size: 13px;
}

/* Print */
/* ================================================================
   CASE NOTE — PRINT STYLESHEET
   Produces a clean, professional printed case note matching app design
   ================================================================ */
@media print {
    /* ── Hide everything except the print document ── */
    body > *:not(#icare-cn-print-doc) { display: none !important; }
    #icare-cn-print-doc              { display: block !important; }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
        color-adjust: exact !important;
    }

    @page {
        size: A4 portrait;
        margin: 15mm 15mm 18mm 15mm;
    }

    /* ── Print document shell ── */
    #icare-cn-print-doc {
        font-family: 'Segoe UI', Arial, sans-serif;
        font-size: 10pt;
        color: #1a1a2e;
        background: #fff;
        line-height: 1.5;
        width: 100%;
    }

    /* ── Letterhead ── */
    .cn-print-letterhead {
        display: flex;
        align-items: center;
        justify-content: space-between;
        border-bottom: 3px solid #00897B;
        padding-bottom: 10px;
        margin-bottom: 14px;
    }
    .cn-print-logo {
        font-size: 22pt;
        font-weight: 900;
        color: #0B2D4E;
        letter-spacing: -1px;
    }
    .cn-print-logo span { color: #00897B; }
    .cn-print-hospital {
        font-size: 9pt;
        color: #546E7A;
        text-align: right;
        line-height: 1.4;
    }
    .cn-print-hospital strong { color: #0B2D4E; font-size: 10pt; }

    /* ── Document title ── */
    .cn-print-doc-title {
        font-size: 8pt;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 1.5px;
        color: #00897B;
        margin-bottom: 2px;
    }

    /* ── Patient header bar ── */
    .cn-print-pt-header {
        background: #0B2D4E !important;
        border-radius: 8px;
        padding: 12px 16px;
        margin-bottom: 14px;
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        page-break-inside: avoid;
    }
    .cn-print-pt-name {
        font-size: 16pt;
        font-weight: 800;
        color: #fff !important;
        margin-bottom: 6px;
    }
    .cn-print-pt-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
        font-size: 8.5pt;
        color: #B0C8D8 !important;
    }
    .cn-print-pt-meta span { color: #E0F0F8 !important; font-weight: 600; }
    .cn-print-pt-right {
        text-align: right;
    }
    .cn-print-zone {
        background: #00897B !important;
        color: #fff !important;
        font-size: 8pt;
        font-weight: 700;
        padding: 3px 10px;
        border-radius: 12px;
        text-transform: uppercase;
        display: inline-block;
        margin-bottom: 5px;
    }
    .cn-print-flags {
        display: flex;
        gap: 4px;
        flex-wrap: wrap;
        justify-content: flex-end;
        margin-top: 4px;
    }
    .cn-print-flag {
        font-size: 7.5pt;
        padding: 1px 7px;
        border-radius: 8px;
        background: rgba(255,255,255,0.15) !important;
        color: #C0D8E8 !important;
        border: 1px solid rgba(255,255,255,0.2);
        font-weight: 600;
    }
    .cn-print-recorded {
        font-size: 8pt;
        color: #7A9AAA !important;
        margin-top: 6px;
    }

    /* ── Section cards ── */
    .cn-print-section {
        border: 1.5px solid #E5E7EB;
        border-radius: 8px;
        margin-bottom: 10px;
        page-break-inside: avoid;
        overflow: hidden;
    }
    .cn-print-section-title {
        background: #F4F6F8 !important;
        padding: 6px 12px;
        font-size: 8pt;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .8px;
        color: #546E7A !important;
        border-bottom: 1px solid #E5E7EB;
        display: flex;
        align-items: center;
        gap: 6px;
    }
    .cn-print-dot {
        width: 7px; height: 7px;
        border-radius: 50%;
        background: #00897B !important;
        display: inline-block;
        flex-shrink: 0;
    }
    .cn-print-section-body {
        padding: 10px 12px;
    }

    /* ── Two column layout ── */
    .cn-print-two-col {
        display: grid;
        grid-template-columns: 1fr 210pt;
        gap: 10px;
        margin-bottom: 10px;
    }

    /* ── Diagnosis ── */
    .cn-print-dx {
        font-size: 11pt;
        font-weight: 700;
        color: #111827 !important;
        margin-bottom: 8px;
        line-height: 1.4;
    }
    .cn-print-icd-chips {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        margin-top: 6px;
    }
    .cn-print-icd-chip {
        display: inline-flex;
        align-items: center;
        gap: 5px;
        background: #EEF2FF !important;
        border: 1px solid #C7D2FE;
        border-radius: 12px;
        padding: 2px 8px 2px 4px;
        font-size: 8.5pt;
        color: #3730A3 !important;
    }
    .cn-print-icd-code {
        font-family: 'Courier New', monospace;
        font-weight: 700;
        font-size: 8pt;
        background: #3730A3 !important;
        color: #fff !important;
        padding: 1px 5px;
        border-radius: 8px;
    }

    /* ── Note boxes ── */
    .cn-print-note {
        font-size: 9.5pt;
        color: #374151 !important;
        line-height: 1.7;
        background: #F9FAFB !important;
        border: 1px solid #E5E7EB;
        border-radius: 6px;
        padding: 8px 10px;
        white-space: pre-wrap;
    }

    /* ── Medications ── */
    .cn-print-med-row {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        padding: 6px 0;
        border-bottom: 1px solid #F3F4F6;
        font-size: 9pt;
    }
    .cn-print-med-row:last-child { border-bottom: none; padding-bottom: 0; }
    .cn-print-med-name { font-weight: 700; color: #111827 !important; }
    .cn-print-med-detail { color: #6B7280 !important; font-size: 8.5pt; margin-top: 1px; }
    .cn-print-ddi-warn {
        font-size: 7.5pt;
        color: #D97706 !important;
        background: #FFFBEB !important;
        border: 1px solid #FDE68A;
        padding: 1px 6px;
        border-radius: 8px;
        display: inline-block;
        margin-top: 2px;
    }

    /* ── Referral box ── */
    .cn-print-referral {
        background: #F0FDF4 !important;
        border: 1.5px solid #BBF7D0;
        border-radius: 6px;
        padding: 8px 10px;
        font-size: 9pt;
        color: #166534 !important;
    }
    .cn-print-referral-to { font-weight: 700; color: #14532D !important; margin-bottom: 3px; }

    /* ── Scan cards ── */
    .cn-print-scan-card {
        border: 1.5px solid #E5E7EB;
        border-radius: 8px;
        margin-bottom: 8px;
        page-break-inside: avoid;
        overflow: hidden;
    }
    .cn-print-scan-head {
        background: #F9FAFB !important;
        padding: 7px 10px;
        border-bottom: 1px solid #E5E7EB;
        display: flex;
        justify-content: space-between;
        align-items: center;
    }
    .cn-print-scan-type { font-weight: 700; font-size: 9.5pt; color: #111827 !important; }
    .cn-print-scan-date { font-size: 8.5pt; color: #6B7280 !important; margin-top: 1px; }
    .cn-print-scan-badge {
        font-size: 7.5pt;
        font-weight: 700;
        padding: 2px 8px;
        border-radius: 10px;
    }
    .cn-print-scan-badge--completed { background: #F0FDF4 !important; color: #16A34A !important; border: 1px solid #BBF7D0; }
    .cn-print-scan-badge--upcoming  { background: #EFF6FF !important; color: #1D4ED8 !important; border: 1px solid #BFDBFE; }
    .cn-print-scan-body { padding: 8px 10px; font-size: 8.5pt; color: #6B7280 !important; line-height: 1.6; }
    .cn-print-scan-result {
        margin-top: 5px;
        padding: 7px 9px;
        background: #F0FDF4 !important;
        border-radius: 5px;
        border: 1px solid #BBF7D0;
        font-size: 8.5pt;
        color: #166534 !important;
    }
    .cn-print-scan-prep {
        margin-top: 5px;
        padding: 7px 9px;
        background: #FFFBEB !important;
        border-radius: 5px;
        border: 1px solid #FDE68A;
        font-size: 8.5pt;
        color: #78350F !important;
    }
    .cn-print-label {
        font-weight: 700;
        font-size: 7.5pt;
        text-transform: uppercase;
        letter-spacing: .4px;
        margin-bottom: 2px;
    }
    .cn-print-label--green { color: #16A34A !important; }
    .cn-print-label--amber { color: #D97706 !important; }

    /* ── History table ── */
    .cn-print-hist-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 8.5pt;
    }
    .cn-print-hist-table th {
        background: #F4F6F8 !important;
        padding: 5px 8px;
        text-align: left;
        font-size: 7.5pt;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: .5px;
        color: #546E7A !important;
        border-bottom: 1.5px solid #E5E7EB;
    }
    .cn-print-hist-table td {
        padding: 6px 8px;
        border-bottom: 1px solid #F3F4F6;
        color: #374151 !important;
        vertical-align: top;
    }
    .cn-print-hist-current td { background: #F0FDF4 !important; }
    .cn-print-icd-inline {
        font-family: 'Courier New', monospace;
        font-size: 8pt;
        font-weight: 700;
        color: #4338CA !important;
        background: #EEF2FF !important;
        padding: 1px 5px;
        border-radius: 4px;
    }

    /* ── Page footer ── */
    .cn-print-footer {
        position: fixed;
        bottom: 0;
        left: 0; right: 0;
        border-top: 1.5px solid #E5E7EB;
        padding-top: 5px;
        display: flex;
        justify-content: space-between;
        font-size: 7.5pt;
        color: #9CA3AF !important;
    }

    /* ── Section page breaks ── */
    .cn-print-section { page-break-inside: avoid; }
    .cn-print-section--break-before { page-break-before: always; }

    /* ── DDI override log ── */
    .cn-print-ddi-item {
        background: #FFFBEB !important;
        border: 1px solid #FDE68A;
        border-radius: 6px;
        padding: 7px 9px;
        margin-bottom: 5px;
        font-size: 8.5pt;
    }
    .cn-print-ddi-drug { font-weight: 700; color: #92400E !important; }
    .cn-print-ddi-meta { color: #D97706 !important; font-size: 8pt; margin-top: 2px; }
}

@media (max-width: 768px) {
    .icare-cn-two-col { grid-template-columns: 1fr; }
    .icare-cn-col-main { order: 1; }
    .icare-cn-col-side { order: 2; }
    .icare-cn-pt-header { flex-direction: column; gap: 10px; }
    .icare-cn-pt-right { align-items: flex-start; flex-direction: row; flex-wrap: wrap; }
    .icare-cn-body { padding: 10px; }
}

/* Button colour */
.icare-casenote-btn { color: #0B2D4E !important; }

/* ================================================================
   v3.4.1 — Case Note Inline Editing
   ================================================================ */

/* Editable fields — hover to reveal */
.icare-cn-editable {
    cursor: text;
    border-radius: 6px;
    position: relative;
    min-height: 32px;
}

/* Edit hint label */
.icare-cn-edit-hint {
    font-size: 9px;
    font-weight: 400;
    color: #00897B;
    text-transform: none;
    letter-spacing: 0;
    margin-left: 6px;
    opacity: .7;
    display: none;
}

/* Active edit state — the textarea */
.icare-cn-inline-editor {
    width: 100%;
    min-height: 110px;
    padding: 10px 12px;
    border: 2px solid #00897B;
    border-radius: 8px;
    font-size: 13px;
    font-family: inherit;
    line-height: 1.7;
    color: #1a1a2e;
    background: #FAFFFE;
    resize: vertical;
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,137,123,.12);
    transition: border-color .15s;
}
.icare-cn-inline-editor:focus {
    border-color: #00695C;
    box-shadow: 0 0 0 4px rgba(0,137,123,.18);
}

/* Save/Cancel action bar */
.icare-cn-inline-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 6px;
    padding: 0 2px;
}
.icare-cn-inline-save {
    background: #00897B;
    color: #fff;
    border: none;
    border-radius: 7px;
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: background .15s;
}
.icare-cn-inline-save:hover    { background: #00695C; }
.icare-cn-inline-save:disabled { background: #9CA3AF; cursor: not-allowed; }
.icare-cn-inline-cancel {
    background: none;
    color: #6B7280;
    border: 1.5px solid #E5E7EB;
    border-radius: 7px;
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}
.icare-cn-inline-cancel:hover { border-color: #9CA3AF; color: #374151; }
.icare-cn-inline-shortcut {
    font-size: 11px;
    color: #9CA3AF;
    margin-left: 4px;
}

/* Save status flash */
.icare-cn-saved-badge {
    font-size: 11px;
    color: #137333;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
    animation: icare-fade-in .2s ease;
}
@keyframes icare-fade-in {
    from { opacity: 0; transform: translateY(-3px); }
    to   { opacity: 1; transform: translateY(0); }
}
.icare-cn-save-error {
    font-size: 11px;
    color: #DC2626;
    font-weight: 600;
}

/* Section title with save status */
.icare-cn-section-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

/* ================================================================
   v3.4.3 — Case Note Audit Log
   ================================================================ */

.icare-cn-audit-entry {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 8px;
    transition: border-color .15s;
}
.icare-cn-audit-entry--latest {
    border-color: #00897B;
    border-left: 3px solid #00897B;
}
.icare-cn-audit-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 8px;
    gap: 10px;
}
.icare-cn-audit-who {
    display: flex;
    align-items: center;
    gap: 10px;
}
.icare-cn-audit-avatar {
    width: 32px;
    height: 32px;
    background: #0B2D4E;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
}
.icare-cn-audit-doctor {
    font-size: 13px;
    font-weight: 700;
    color: #0B2D4E;
}
.icare-cn-audit-meta {
    font-size: 11px;
    color: #6B7280;
    margin-top: 1px;
}
.icare-cn-audit-time {
    text-align: right;
    font-size: 11px;
    color: #9CA3AF;
    flex-shrink: 0;
}
.icare-cn-audit-latest-badge {
    display: inline-block;
    background: #00897B;
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 8px;
    margin-bottom: 3px;
    letter-spacing: .3px;
    text-transform: uppercase;
}
.icare-cn-audit-field {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .6px;
    color: #9CA3AF;
    margin-bottom: 4px;
}
.icare-cn-audit-preview {
    font-size: 12px;
    color: #374151;
    line-height: 1.5;
    background: #F9FAFB;
    border-radius: 6px;
    padding: 7px 10px;
    border: 1px solid #E5E7EB;
    white-space: pre-wrap;
}

/* ================================================================
   Case Note — Surgeon-in-Charge badge
   ================================================================ */

.icare-cn-surgeon-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #0B2D4E 0%, #1A4A70 100%);
    color: #fff;
    border-radius: 10px;
    padding: 7px 14px;
    margin: 6px 0 10px;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(11,45,78,.18);
}

.icare-cn-surgeon-icon {
    font-size: 16px;
    line-height: 1;
}

.icare-cn-surgeon-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .8px;
    color: #8BAABB;
    white-space: nowrap;
}

.icare-cn-surgeon-name {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    white-space: nowrap;
}

/* ================================================================
   OT Awaiting badge — shown on patient card when posted to OT
   ================================================================ */

.icare-ot-awaiting-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    letter-spacing: .3px;
    animation: icare-ot-pulse 2s ease-in-out infinite;
}

.icare-ot-awaiting-badge--emot {
    background: #FEF2F2;
    color: #991B1B;
    border: 1.5px solid #FECACA;
}

.icare-ot-awaiting-badge--laot {
    background: #EFF6FF;
    color: #1E40AF;
    border: 1.5px solid #BFDBFE;
}

@keyframes icare-ot-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: .65; }
}

/* ================================================================
   Mobile — Shift Dashboard portrait layout
   ================================================================ */

/* Prevent horizontal overflow globally on iCare admin pages */
.icare-wrap {
    overflow-x: hidden;
    box-sizing: border-box;
}

@media (max-width: 768px) {

    /* Patient card row */
    .icare-patient-row {
        flex-direction: column;
        gap: 8px;
        padding: 10px 12px;
    }

    /* Zone pill + patient info horizontal */
    .icare-patient-left {
        display: flex;
        align-items: center;
        gap: 10px;
        width: 100%;
    }

    .icare-patient-main { flex: 1; }

    .icare-patient-name { font-size: 14px; }
    .icare-patient-meta { font-size: 11px; flex-wrap: wrap; }

    /* Status + flags row */
    .icare-patient-right {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        align-items: center;
    }

    /* Flag buttons — larger touch targets */
    .icare-flag-btn {
        min-width: 36px;
        min-height: 36px;
        font-size: 16px;
    }

    /* Action buttons */
    .icare-patient-actions {
        width: 100%;
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
    }
    .icare-patient-actions .icare-btn {
        flex: 1;
        justify-content: center;
        min-width: 60px;
        font-size: 11px;
        padding: 7px 8px;
    }

    /* OT awaiting badge */
    .icare-ot-awaiting-badge {
        font-size: 11px;
        padding: 5px 10px;
    }

    /* Surgeon badge in case note */
    .icare-cn-surgeon-badge {
        flex-wrap: wrap;
    }
    .icare-cn-surgeon-name { font-size: 13px; }

    /* Shift dashboard header */
    .icare-shift-header {
        flex-direction: column;
        gap: 8px;
    }
    .icare-shift-header-right {
        width: 100%;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    /* Stats row */
    .icare-stats-row {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }

    /* Zone pills — smaller text */
    .icare-zone-pill { font-size: 10px; padding: 2px 6px; }
}

@media (max-width: 480px) {
    .icare-stats-row { grid-template-columns: repeat(3, 1fr); }
    .icare-patient-name { font-size: 13px; }
    .icare-patient-actions .icare-btn { font-size: 10px; padding: 6px 6px; }
}

/* ================================================================
   Patient card 3-column grid layout
   ================================================================ */

/* COL 1 — Sequence number + arrows */
.icare-seq-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 4px;
    border-right: 1px solid var(--ic-border);
    background: #F8FAFC;
    flex-shrink: 0;
}
.icare-seq-num {
    font-size: 16px;
    font-weight: 800;
    color: #0B2D4E;
    line-height: 1;
}
.icare-seq-btns {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.icare-seq-btn {
    background: none;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    width: 24px;
    height: 20px;
    font-size: 9px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    transition: all .12s;
}
.icare-seq-btn:hover:not(:disabled) { background: #E5E7EB; color: #0B2D4E; }
.icare-seq-btn:disabled { opacity: .3; cursor: not-allowed; }

/* COL 2 — Patient details + flags */
.icare-patient-middle {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    gap: 4px;
    min-width: 0; /* prevent overflow */
    overflow: hidden;
}

/* Category dot — small inline pill */
.icare-patient-cat {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 6px;
    font-size: 13px;
    flex-shrink: 0;
    margin-bottom: 2px;
}

/* Patient main block */
.icare-patient-main {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}
.icare-patient-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 5px;
}
.icare-patient-name {
    font-size: 14px;
    font-weight: 700;
    color: #0B2D4E;
    word-break: break-word;
}
.icare-patient-age {
    font-size: 12px;
    color: #6B7280;
    font-weight: 400;
}
.icare-patient-meta {
    font-size: 11px;
    color: #6B7280;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.icare-patient-dx {
    font-size: 12.5px;
    color: #111827;
    line-height: 1.4;
    word-break: break-word;
}
.icare-patient-plan {
    font-size: 12px;
    color: #374151;
    line-height: 1.5;
    word-break: break-word;
}

/* Flag group — inside col 2, wraps naturally */
.icare-flag-group {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 6px;
}
.icare-flag-btn,
.icare-flag-btn-passover {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
    border: 1.5px solid #E5E7EB;
    background: #F9FAFB;
    color: #374151;
    cursor: pointer;
    transition: all .12s;
    white-space: nowrap;
    font-family: inherit;
}
.icare-flag-btn:hover,
.icare-flag-btn-passover:hover { border-color: #9CA3AF; background: #F3F4F6; }
.icare-flag-btn.active { background: #DCFCE7; border-color: #16A34A; color: #15803D; }
.icare-flag-btn-sp.active    { background: #DBEAFE; border-color: #2563EB; color: #1D4ED8; }
.icare-flag-btn-callback.active { background: #FEF9C3; border-color: #CA8A04; color: #A16207; }
.icare-flag-btn-consent.active  { background: #FEF3C7; border-color: #D97706; color: #B45309; }
.icare-flag-btn-scans.active    { background: #EDE9FE; border-color: #7C3AED; color: #6D28D9; }
.icare-flag-btn-passover.active { background: #FFE4E6; border-color: #E11D48; color: #BE123C; }

/* COL 3 — Action buttons stacked */
.icare-patient-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 6px;
    border-left: 1px solid var(--ic-border);
    background: #FAFAFA;
    flex-shrink: 0;
}
.icare-action-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1.5px solid #E5E7EB;
    background: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .12s;
    padding: 0;
}
.icare-action-btn:hover { border-color: #9CA3AF; background: #F3F4F6; }
.icare-action-btn--danger { border-color: #FECACA; background: #FEF2F2; }
.icare-action-btn--danger:hover { border-color: #DC2626; background: #FEE2E2; }

/* OT awaiting badge inside col 2 */
.icare-ot-awaiting-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    white-space: nowrap;
    margin-top: 4px;
    animation: icare-ot-pulse 2s ease-in-out infinite;
}
.icare-ot-awaiting-badge--emot {
    background: #FEF2F2; color: #991B1B; border: 1.5px solid #FECACA;
}
.icare-ot-awaiting-badge--laot {
    background: #EFF6FF; color: #1E40AF; border: 1.5px solid #BFDBFE;
}
@keyframes icare-ot-pulse { 0%,100%{opacity:1} 50%{opacity:.65} }

/* Mobile — keep grid but compress col 1 and 3 */
@media (max-width: 640px) {
    .icare-patient-row { grid-template-columns: 40px 1fr 44px; }
    .icare-seq-num { font-size: 14px; }
    .icare-patient-middle { padding: 8px 10px; }
    .icare-action-btn { width: 32px; height: 32px; font-size: 15px; }
    .icare-flag-btn,
    .icare-flag-btn-passover { font-size: 10.5px; padding: 3px 8px; }
    .icare-patient-name { font-size: 13px; }
}

/* ================================================================
   v3.9.5 — Flags moved to col 3
   ================================================================ */

/* Widen col 3 to fit flags + actions */
.icare-patient-row {
    grid-template-columns: 48px 1fr 100px;
}

/* Col 3 inner layout — flags on top, divider, actions on bottom */
.icare-patient-actions {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    padding: 0;
    gap: 0;
    border-left: 1px solid var(--ic-border);
    background: #FAFAFA;
}

/* Flag section */
.icare-flag-col {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px 5px 4px;
    flex: 1;
}

/* Individual flag button — icon + label stacked */
.icare-flag-icon {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 5px;
    width: 100%;
    background: none;
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    padding: 5px 7px;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    color: #6B7280;
    cursor: pointer;
    transition: all .12s;
    text-align: left;
    line-height: 1.2;
}
.icare-flag-icon span {
    font-size: 10px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.icare-flag-icon:hover {
    border-color: #9CA3AF;
    background: #F3F4F6;
    color: #374151;
}

/* Active states per flag */
.icare-flag-icon[data-flag="seen_by_sp"].active,
.icare-flag-icon.icare-flag-btn-sp.active {
    background: #DBEAFE; border-color: #2563EB; color: #1D4ED8;
}
.icare-flag-icon[data-flag="callback"].active {
    background: #FEF9C3; border-color: #CA8A04; color: #A16207;
}
.icare-flag-icon.icare-flag-btn-passover.active {
    background: #FFE4E6; border-color: #E11D48; color: #BE123C;
}
.icare-flag-icon[data-flag="for_consent"].active {
    background: #FEF3C7; border-color: #D97706; color: #B45309;
}
.icare-flag-icon[data-flag="request_scans"].active {
    background: #EDE9FE; border-color: #7C3AED; color: #6D28D9;
}

/* Divider between flags and actions */
.icare-action-divider {
    height: 1px;
    background: var(--ic-border);
    margin: 0 5px;
    flex-shrink: 0;
}

/* Action buttons section */
.icare-action-col {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 4px;
    padding: 5px 5px 6px;
}

.icare-action-btn {
    width: 30px;
    height: 30px;
    border-radius: 7px;
    border: 1.5px solid #E5E7EB;
    background: #fff;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .12s;
    padding: 0;
}
.icare-action-btn:hover { border-color: #9CA3AF; background: #F3F4F6; }
.icare-action-btn--danger { border-color: #FECACA; background: #FEF2F2; }
.icare-action-btn--danger:hover { border-color: #DC2626; background: #FEE2E2; }

/* Mobile — compress gracefully */
@media (max-width: 640px) {
    .icare-patient-row { grid-template-columns: 40px 1fr 88px; }
    .icare-flag-icon { font-size: 10px; padding: 4px 5px; }
    .icare-flag-icon span { font-size: 9px; }
    .icare-action-btn { width: 27px; height: 27px; font-size: 13px; }
}

/* ================================================================
   ICD-10 Auto-Detection UI
   ================================================================ */

.icare-dx-wrap { position: relative; }

/* Chip row — shows added codes */
.icare-icd10-chips-row {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 5px;
    min-height: 0;
}

.icare-icd10-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: #EFF6FF;
    border: 1.5px solid #BFDBFE;
    border-radius: 20px;
    padding: 3px 8px 3px 10px;
    font-size: 11px;
    font-weight: 600;
    color: #1D4ED8;
}
.icare-icd10-chip-code {
    font-family: monospace;
    font-size: 11px;
    font-weight: 700;
}
.icare-icd10-chip-desc {
    font-weight: 500;
    color: #374151;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.icare-icd10-chip-remove {
    background: none;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    font-size: 11px;
    padding: 0 1px;
    line-height: 1;
    flex-shrink: 0;
}
.icare-icd10-chip-remove:hover { color: #DC2626; }

/* Suggest panel */
.icare-icd10-suggest-row {
    background: #fff;
    border: 1.5px solid #E5E7EB;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(11,45,78,.12);
    margin-top: 4px;
    overflow: hidden;
    z-index: 999;
    position: relative;
}

.icare-icd10-searching,
.icare-icd10-none {
    display: block;
    padding: 10px 12px;
    font-size: 12px;
    color: #9CA3AF;
    font-style: italic;
}

/* Result rows */
.icare-icd10-result-row {
    display: grid;
    grid-template-columns: 80px 1fr auto;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-bottom: 1px solid #F3F4F6;
    transition: background .1s;
}
.icare-icd10-result-row:last-child { border-bottom: none; }
.icare-icd10-result-row:hover { background: #F8FAFC; }
.icare-icd10-result-row.added { opacity: .6; }

.icare-icd10-code {
    font-family: monospace;
    font-size: 11px;
    font-weight: 700;
    background: #EFF6FF;
    color: #1D4ED8;
    border-radius: 6px;
    padding: 2px 6px;
    white-space: nowrap;
}
.icare-icd10-desc {
    font-size: 12px;
    color: #374151;
    line-height: 1.3;
}
.icare-icd10-reason {
    font-size: 10px;
    color: #7C3AED;
    grid-column: 2;
    margin-top: -4px;
    font-style: italic;
}
.icare-icd10-add-btn {
    background: #0B2D4E;
    border: none;
    color: #fff;
    border-radius: 6px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
    transition: background .12s;
}
.icare-icd10-add-btn:hover { background: #1A4A70; }
.icare-icd10-added-lbl {
    font-size: 11px;
    color: #059669;
    font-weight: 700;
    white-space: nowrap;
}

/* AI button */
.icare-icd10-ai-btn {
    display: block;
    width: calc(100% - 24px);
    margin: 8px 12px;
    padding: 8px;
    background: linear-gradient(135deg, #7C3AED, #5B21B6);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity .15s;
}
.icare-icd10-ai-btn:hover:not(:disabled) { opacity: .88; }
.icare-icd10-ai-btn:disabled { opacity: .6; cursor: wait; }

.icare-icd10-ai-status {
    padding: 0 12px 8px;
    font-size: 11px;
}

/* AI results section */
.icare-icd10-ai-results {
    border-top: 2px solid #EDE9FE;
    padding: 8px 0 0;
    background: #FAFAFE;
}
.icare-icd10-ai-row .icare-icd10-result-row {
    grid-template-rows: auto auto;
}

/* Mobile */
@media (max-width: 600px) {
    .icare-icd10-result-row { grid-template-columns: 70px 1fr; gap: 5px; }
    .icare-icd10-add-btn { grid-column: 1 / -1; width: 100%; }
    .icare-icd10-chip-desc { max-width: 120px; }
}

/* ================================================================
   Frontend shortcode — explicit overrides to beat theme CSS
   ================================================================ */
/* ── Base layout (overridden by .icare-desktop-grid flexbox) ── */
.icare-frontend-wrap .icare-patient-row:not(.icare-desktop-grid),
.icare-wrap .icare-patient-row:not(.icare-desktop-grid) {
    display: grid !important;
    grid-template-columns: 52px 1fr 230px !important;
    grid-template-rows: auto !important;
    align-items: stretch !important;
    overflow: hidden !important;
    min-height: unset !important;
    height: auto !important;
}
/* ── Mobile: 2-col grid ── */
@media (max-width: 768px) {
    .icare-frontend-wrap .icare-patient-row:not(.icare-desktop-grid),
    .icare-wrap .icare-patient-row:not(.icare-desktop-grid) {
        grid-template-columns: 42px 1fr !important;
    }
}
.icare-frontend-wrap .icare-patient-row:not(.icare-desktop-grid) .icare-patient-middle,
.icare-wrap .icare-patient-row:not(.icare-desktop-grid) .icare-patient-middle {
    display: flex !important;
    flex-direction: column !important;
    padding: 12px 14px !important;
    gap: 4px !important;
    min-width: 0 !important;
    overflow: hidden !important;
    grid-column: 2 !important;
    grid-row: 1 !important;
}
.icare-frontend-wrap .icare-seq-col,
.icare-wrap .icare-seq-col {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-start !important;
    padding-top: 12px !important;
    grid-column: 1 !important;
    grid-row: 1 !important;
}
.icare-frontend-wrap .icare-patient-row:not(.icare-desktop-grid) .icare-patient-actions,
.icare-wrap .icare-patient-row:not(.icare-desktop-grid) .icare-patient-actions {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    overflow: hidden !important;
    grid-column: 3 !important;
    grid-row: 1 !important;
    border-left: 1px solid var(--ic-border) !important;
    padding: 10px 10px !important;
    gap: 6px !important;
    background: transparent !important;
}
.icare-frontend-wrap .icare-flag-col,
.icare-wrap .icare-flag-col {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 5px !important;
    width: 100% !important;
    padding: 0 !important;
}
/* Mobile: single column for flags */
@media (max-width: 768px) {
    .icare-frontend-wrap .icare-flag-col,
    .icare-wrap .icare-flag-col {
        grid-template-columns: 1fr 1fr !important;
        width: 100% !important;
    }
}
.icare-frontend-wrap .icare-action-col,
.icare-wrap .icare-action-col {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
    align-items: center !important;
    gap: 5px !important;
    padding: 4px 0 0 !important;
    border-top: 1px solid var(--ic-border) !important;
    margin-top: 2px !important;
}
.icare-frontend-wrap .icare-flag-icon,
.icare-wrap .icare-flag-icon {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 5px !important;
    width: 100% !important;
    background: none !important;
    border: 1.5px solid #E5E7EB !important;
    border-radius: 8px !important;
    padding: 5px 7px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    font-family: inherit !important;
    text-align: left !important;
}
.icare-frontend-wrap .icare-action-btn,
.icare-wrap .icare-action-btn {
    width: 30px !important;
    height: 30px !important;
    border-radius: 7px !important;
    border: 1.5px solid #E5E7EB !important;
    background: #fff !important;
    font-size: 14px !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}

/* ================================================================
   Frontend stats row — force full width fill
   ================================================================ */
.icare-frontend-wrap .icare-stats-row {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr)) !important;
    width: 100% !important;
    gap: 8px !important;
}
@media (max-width: 540px) {
    .icare-frontend-wrap .icare-stats-row {
        grid-template-columns: repeat(3, 1fr) !important;
    }
}
.icare-frontend-wrap .icare-stat-card {
    min-width: 0 !important;
    width: 100% !important;
}
/* Prevent theme sidebar from pushing the layout */
.icare-frontend-wrap {
    width: 100% !important;
    max-width: 1160px !important;
    margin: 0 auto !important;
    box-sizing: border-box !important;
    float: none !important;
    clear: both !important;
}
.icare-frontend-wrap .icare-shift-bar {
    display: flex !important;
    align-items: flex-start !important;
    justify-content: space-between !important;
    flex-wrap: wrap !important;
    gap: 10px !important;
    width: 100% !important;
}

/* ================================================================
   Stat cards — 3-column mobile layout
   ================================================================ */
@media (max-width: 540px) {
    .icare-stats-row {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 6px !important;
    }
    .icare-stat-card {
        padding: 8px 4px !important;
    }
    .icare-stat-num {
        font-size: 22px !important;
    }
    .icare-stat-label {
        font-size: 8px !important;
        letter-spacing: .3px !important;
    }
}
@media (max-width: 380px) {
    .icare-stat-num   { font-size: 18px !important; }
    .icare-stat-label { font-size: 7.5px !important; }
}

/* ================================================================
   Filter group headings — Location / Status / Action
   ================================================================ */
.icare-filter-group {
    margin-bottom: 6px;
}

.icare-filter-heading {
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #9CA3AF;
    padding: 8px 2px 5px;
    display: flex;
    align-items: center;
    gap: 5px;
    border-top: 1px solid #F3F4F6;
}

/* Remove top border from the very first heading */
.icare-filter-group:first-of-type .icare-filter-heading {
    border-top: none;
    padding-top: 4px;
}

/* Remove the old 🏷 Filter: label since we now have a proper heading */
.icare-flag-filter-label { display: none; }

/* ================================================================
   Allergy status badges — case note header
   ================================================================ */
.icare-cn-allergy-alert {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #FEF2F2;
    border: 2px solid #DC2626;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 800;
    color: #DC2626;
    letter-spacing: .3px;
    margin-top: 8px;
    width: fit-content;
    text-transform: uppercase;
}
.icare-cn-allergy-ok {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ECFDF5;
    border: 1.5px solid #A7F3D0;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 700;
    color: #065F46;
    margin-top: 8px;
    width: fit-content;
}
.icare-cn-allergy-unknown {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #FFFBEB;
    border: 1.5px solid #FDE68A;
    border-radius: 8px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 700;
    color: #92400E;
    margin-top: 8px;
    width: fit-content;
}

/* ================================================================
   Case note footer — Print at bottom
   ================================================================ */
.icare-cn-modal-footer {
    padding: 12px 16px;
    border-top: 1px solid #E5E7EB;
    background: #F8FAFC;
    display: flex;
    gap: 10px;
    align-items: center;
    border-radius: 0 0 16px 16px;
    flex-shrink: 0;
    position: sticky;
    bottom: 0;
}

/* ================================================================
   Medications tab UI
   ================================================================ */
.icare-meds-group {
    margin-bottom: 14px;
}
.icare-meds-group-title {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .6px;
    padding: 7px 12px;
    border-radius: 8px;
    border: 1.5px solid;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.icare-meds-count {
    background: rgba(0,0,0,.1);
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 11px;
}
.icare-med-card {
    background: #fff;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 7px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}
.icare-med-card-main { flex: 1; }
.icare-med-name {
    font-size: 14px;
    font-weight: 700;
    color: #0B2D4E;
}
.icare-med-detail {
    font-size: 12px;
    color: #374151;
    margin-top: 2px;
}
.icare-med-date {
    font-size: 11px;
    color: #6B7280;
    margin-top: 2px;
}
.icare-med-notes {
    font-size: 11px;
    color: #9CA3AF;
    font-style: italic;
    margin-top: 2px;
}
.icare-med-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}
.icare-med-doses {
    background: #F8FAFC;
    border-radius: 7px;
    padding: 7px 10px;
    border: 1px solid #E5E7EB;
    margin-top: 5px;
}
.icare-med-dose-row {
    font-size: 11px;
    color: #6B7280;
    padding: 2px 0;
    border-bottom: 1px solid #F3F4F6;
}
.icare-med-dose-row:last-child { border-bottom: none; }


/* ================================================================
   Case Note Gallery Tabs
   ================================================================ */
.icare-cn-gallery-panel {
    padding: 10px 0;
}
.icare-cn-gallery-title {
    font-size: 13px;
    font-weight: 800;
    color: #0B2D4E;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.icare-cn-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}
.icare-cn-gallery-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #E5E7EB;
    background: #F8FAFC;
}
.icare-cn-gallery-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
}
.icare-cn-gallery-date {
    font-size: 9px;
    color: #9CA3AF;
    text-align: center;
    padding: 2px 4px;
}
.icare-cn-gallery-pdf {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    font-size: 12px;
    color: #1D4ED8;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
    word-break: break-all;
}
.icare-cn-gallery-del {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: rgba(220,38,38,.85);
    color: #fff;
    border: none;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .12s;
}
.icare-cn-gallery-item:hover .icare-cn-gallery-del { opacity: 1; }
.icare-cn-upload-lbl {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #F0F9FF;
    border: 1.5px dashed #BAE6FD;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #0369A1;
    cursor: pointer;
    transition: all .12s;
}
.icare-cn-upload-lbl:hover { background: #E0F2FE; border-color: #7DD3FC; }

/* Ward card clickable cursor */
.icare-ward-card-head { cursor: pointer; }
.icare-ward-card-head:hover { background: #F8FAFC; }
.icare-ward-card-dx {
    font-size: 12px;
    color: #374151;
    margin-top: 2px;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 500px;
}

/* ================================================================
   Case Note Gallery (combined tab)
   ================================================================ */
.icare-cn-gallery-panel { padding: 10px 0; }
.icare-cn-gallery-title {
    font-size: 13px;
    font-weight: 800;
    color: #0B2D4E;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.icare-cn-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
    min-height: 20px;
}
.icare-cn-gallery-item {
    position: relative;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid #E5E7EB;
    background: #F8FAFC;
}
.icare-cn-gallery-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
    cursor: zoom-in;
}
.icare-cn-gallery-date {
    font-size: 9px;
    color: #9CA3AF;
    text-align: center;
    padding: 2px 4px;
}
.icare-cn-gallery-pdf {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px 8px;
    font-size: 11px;
    color: #1D4ED8;
    text-decoration: none;
    font-weight: 600;
    text-align: center;
}
.icare-cn-gallery-del {
    position: absolute;
    top: 4px; right: 4px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: rgba(220,38,38,.85);
    color: #fff;
    border: none;
    font-size: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity .12s;
}
.icare-cn-gallery-item:hover .icare-cn-gallery-del { opacity: 1; }
.icare-cn-upload-lbl {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: #F0F9FF;
    border: 1.5px dashed #BAE6FD;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #0369A1;
    cursor: pointer;
    transition: all .12s;
}
.icare-cn-upload-lbl:hover { background: #E0F2FE; }
.icare-cn-gallery-divider {
    border: none;
    border-top: 1.5px solid #E5E7EB;
    margin: 16px 0;
}

/* Ward card — clickable + show diagnosis */
.icare-ward-card-head { cursor: pointer; transition: background .12s; }
.icare-ward-card-head:hover { background: #F8FAFC; }
.icare-ward-card-dx {
    font-size: 12px;
    color: #374151;
    margin-top: 3px;
    font-style: italic;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 420px;
}

/* ================================================================
   Case Note History — inline edit (Option C)
   ================================================================ */
.icare-cn-hist-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #F3F4F6;
}
.icare-cn-hist-item:last-child { border-bottom: none; }
.icare-cn-hist-left {
    flex-shrink: 0;
    width: 72px;
    text-align: center;
}
.icare-cn-hist-date {
    font-size: 11px;
    font-weight: 800;
    color: #0B2D4E;
}
.icare-cn-hist-shift {
    font-size: 10px;
    color: #9CA3AF;
    margin-top: 2px;
}
.icare-cn-hist-body { flex: 1; min-width: 0; }
.icare-cn-hist-row {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 6px;
    line-height: 1.5;
}
.icare-cn-hist-label {
    font-size: 11px;
    font-weight: 700;
    color: #9CA3AF;
    white-space: nowrap;
}
.icare-cn-hist-val {
    font-size: 13px;
    color: #374151;
    flex: 1;
}
.icare-cn-hist-hospital {
    font-size: 11px;
    color: #9CA3AF;
    margin-top: 2px;
}
.icare-cn-hist-edit-btn {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    color: #0369A1;
    background: #F0F9FF;
    border: 1px solid #BAE6FD;
    border-radius: 6px;
    padding: 2px 8px;
    cursor: pointer;
    font-family: inherit;
    opacity: 0;
    transition: opacity .15s;
}
.icare-cn-hist-row:hover .icare-cn-hist-edit-btn { opacity: 1; }

/* Inline editor */
.icare-cn-hist-editor-wrap {
    width: 100%;
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.icare-cn-hist-editor {
    width: 100%;
    border: 2px solid #2563EB;
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    outline: none;
    box-sizing: border-box;
}
.icare-cn-hist-editor-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.icare-cn-hist-audit-note {
    font-size: 11px;
    color: #D97706;
    font-weight: 600;
}

/* ================================================================
   Case Note — Simplified 4-tab layout
   ================================================================ */

/* Tab bar — 4 tabs fit comfortably */
.icare-cn-tabs {
    display: flex;
    border-bottom: 2px solid #E5E7EB;
    gap: 0;
    overflow-x: auto;
    scrollbar-width: none;
}
.icare-cn-tabs::-webkit-scrollbar { display: none; }
.icare-cn-tab {
    flex-shrink: 0;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #6B7280;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-family: inherit;
    transition: all .12s;
    white-space: nowrap;
    margin-bottom: -2px;
}
.icare-cn-tab:hover  { color: #0B2D4E; }
.icare-cn-tab.active { color: #00897B; border-bottom-color: #00897B; }

/* Footer layout */
.icare-cn-modal-footer {
    padding: 12px 16px;
    border-top: 1px solid #E5E7EB;
    background: #F8FAFC;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-shrink: 0;
    border-radius: 0 0 16px 16px;
}
.icare-cn-audit-toggle-btn {
    background: #F8FAFC;
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    font-family: inherit;
    transition: all .12s;
}
.icare-cn-audit-toggle-btn:hover  { border-color: #374151; }
.icare-cn-audit-toggle-btn.active { background: #0B2D4E; color: #fff; border-color: #0B2D4E; }

/* Collapsible medications */
.icare-cn-meds-collapsible { padding: 0 !important; border: 1px solid #E5E7EB !important; border-radius: 10px; overflow: hidden; }
.icare-cn-collapsible-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #F8FAFC;
    cursor: pointer;
    font-size: 13px;
    font-weight: 700;
    color: #0B2D4E;
    user-select: none;
    border-bottom: 1px solid #E5E7EB;
}
.icare-cn-collapsible-head:hover { background: #EFF6FF; }
.icare-cn-collapsible-arrow { font-size: 14px; color: #9CA3AF; }
.icare-cn-collapsible-body  { padding: 12px 14px; }

/* Audit panel — shown at bottom of modal, below body */
#icare-cn-tab-audit {
    border-top: 2px solid #E5E7EB;
    padding: 14px 16px;
    background: #FAFAFA;
    max-height: 280px;
    overflow-y: auto;
}

/* History tab — scan section divider */
.icare-cn-tab-panel .icare-cn-section { margin-top: 0; }

/* ================================================================
   Departmental Note Entries — Timeline
   ================================================================ */
.icare-cn-entries-timeline { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }

.icare-entry-card {
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 4px rgba(11,45,78,.06);
}
.icare-entry-card.urgent { border-color: #DC2626; box-shadow: 0 0 0 2px #FEE2E2; }

.icare-entry-card-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px;
    background: #F8FAFC;
    border-bottom: 1px solid #E5E7EB;
}
.icare-entry-head-left  { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.icare-entry-head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }

.icare-entry-dept       { font-size: 14px; font-weight: 800; }
.icare-entry-subteam    { font-size: 11px; color: #6B7280; }
.icare-entry-author     { font-size: 11px; font-weight: 600; color: #374151; }
.icare-entry-dt         { font-size: 10px; color: #9CA3AF; }

.icare-entry-type-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: .4px;
}
.icare-entry-urgent-badge {
    font-size: 11px;
    font-weight: 700;
    color: #DC2626;
    background: #FEE2E2;
    border-radius: 6px;
    padding: 2px 8px;
}
.icare-entry-primary-badge {
    font-size: 10px;
    font-weight: 700;
    color: #0B2D4E;
    background: #DBEAFE;
    border-radius: 6px;
    padding: 2px 7px;
}
.icare-entry-corrected-badge {
    font-size: 9px;
    color: #D97706;
    background: #FEF3C7;
    border-radius: 6px;
    padding: 1px 6px;
    font-weight: 600;
}

.icare-entry-card-body  { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.icare-entry-field      { display: flex; flex-direction: column; gap: 3px; }
.icare-entry-field-lbl  { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: #9CA3AF; }
.icare-entry-field-val  { font-size: 13px; color: #374151; line-height: 1.5; }
.icare-entry-plan       { background: #F0F9FF; border-radius: 6px; padding: 6px 10px; font-weight: 600; color: #0B2D4E; }

.icare-entry-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 14px 10px;
    flex-wrap: wrap;
    gap: 6px;
}
.icare-entry-correct-btn {
    font-size: 11px;
    color: #0369A1;
    background: #F0F9FF;
    border: 1px solid #BAE6FD;
    border-radius: 6px;
    padding: 3px 10px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
}
.icare-entry-footer-note { font-size: 10px; color: #D1D5DB; }

/* Correct entry form */
.icare-entry-correct-form {
    background: #FFFBEB;
    border-top: 1px solid #FDE68A;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.icare-entry-correct-note {
    font-size: 11px;
    color: #D97706;
    font-weight: 600;
    margin: 0;
}

/* ================================================================
   AI Summary Banner
   ================================================================ */
.icare-cn-ai-banner {
    background: linear-gradient(135deg, #EFF6FF 0%, #F0FDF4 100%);
    border: 1.5px solid #BFDBFE;
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 14px;
}
.icare-cn-ai-banner-head {
    font-size: 11px;
    font-weight: 800;
    color: #1E40AF;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.icare-cn-ai-ts { font-weight: 400; color: #9CA3AF; }
.icare-cn-ai-refresh-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 15px;
    color: #1E40AF;
    padding: 0 4px;
    margin-left: auto;
}
.icare-cn-ai-banner-body {
    font-size: 13px;
    color: #1E3A5F;
    line-height: 1.6;
}
.icare-cn-ai-conflicts { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.icare-cn-conflict-item {
    font-size: 12px;
    font-weight: 600;
    padding: 5px 10px;
    border-radius: 7px;
}
.icare-cn-conflict-high   { background: #FEE2E2; color: #DC2626; }
.icare-cn-conflict-medium { background: #FEF3C7; color: #D97706; }

/* Primary team fields label */
.icare-cn-primary-fields { margin-top: 8px; }
.icare-cn-primary-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #9CA3AF;
    margin-bottom: 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid #E5E7EB;
}

/* ================================================================
   Add Entry Form
   ================================================================ */
.icare-cn-entry-form {
    background: #F8FAFC;
    border: 1.5px solid #E5E7EB;
    border-radius: 12px;
    padding: 14px;
    margin-bottom: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.icare-cn-entry-form-head {
    font-size: 13px;
    font-weight: 800;
    color: #0B2D4E;
    margin-bottom: 4px;
}
.icare-cn-entry-row { display: flex; flex-direction: column; gap: 4px; }
.icare-cn-entry-row label { font-size: 11px; font-weight: 700; color: #374151; }
.icare-cn-urgent-lbl {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #DC2626;
    cursor: pointer;
}
.icare-cn-entry-actions { display: flex; gap: 8px; margin-top: 4px; }

/* ================================================================
   AI Differential Diagnosis suggestions
   ================================================================ */
.icare-cn-ddx-wrap { position: relative; }
.icare-cn-ddx-suggestions {
    background: #fff;
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,.1);
    margin-top: 4px;
    overflow: hidden;
}
.icare-cn-ddx-title {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: #1E40AF;
    padding: 6px 10px;
    background: #EFF6FF;
    border-bottom: 1px solid #DBEAFE;
}
.icare-cn-ddx-item {
    padding: 8px 10px;
    cursor: pointer;
    display: flex;
    align-items: flex-start;
    gap: 8px;
    flex-wrap: wrap;
    border-bottom: 1px solid #F3F4F6;
    transition: background .1s;
}
.icare-cn-ddx-item:last-child { border-bottom: none; }
.icare-cn-ddx-item:hover  { background: #F0F9FF; }
.icare-cn-ddx-code  { font-size: 11px; font-weight: 800; color: #0369A1; background: #DBEAFE; border-radius: 5px; padding: 1px 6px; white-space: nowrap; }
.icare-cn-ddx-label { font-size: 13px; font-weight: 600; color: #0B2D4E; }
.icare-cn-ddx-note  { font-size: 11px; color: #6B7280; font-style: italic; width: 100%; }

/* ── Closed shift notice banner ── */
.icare-shift-status-notice {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #FEF3C7;
    border: 1.5px solid #FDE68A;
    border-radius: 10px;
    padding: 10px 16px;
    margin-bottom: 14px;
    font-size: 13px;
    font-weight: 600;
    color: #92400E;
}

/* ================================================================
   Floating Menu Button (FAB) + Sidebar Drawer
   ================================================================ */

/* ── Floating hamburger button ── */
.icare-fab-menu {
    position: fixed;
    top: 14px;
    right: 14px;
    z-index: 1200;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #0B2D4E;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    padding: 0;
    box-shadow: 0 3px 12px rgba(11,45,78,.35);
    transition: background .15s, transform .15s;
    -webkit-tap-highlight-color: transparent;
}
.icare-fab-menu:hover  { background: #00897B; }
.icare-fab-menu:active { transform: scale(.93); }
.icare-fab-bar {
    display: block;
    width: 18px;
    height: 2px;
    background: #fff;
    border-radius: 2px;
    transition: all .2s;
}

/* ── Overlay ── */
.icare-sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(11,45,78,.5);
    z-index: 1300;
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s;
}
.icare-sidebar-overlay.open {
    opacity: 1;
    pointer-events: all;
}

/* ── Sidebar drawer ── */
.icare-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 300px;
    max-width: 85vw;
    background: #fff;
    z-index: 1400;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .28s cubic-bezier(.4,0,.2,1);
    box-shadow: -4px 0 24px rgba(11,45,78,.18);
    overflow-y: auto;
}
.icare-sidebar.open { transform: translateX(0); }

/* ── Sidebar header ── */
.icare-sidebar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: #0B2D4E;
    flex-shrink: 0;
}
.icare-sidebar-brand { font-size: 22px; font-weight: 800; font-family: inherit; }
.icare-sidebar-brand-med { color: #00BFA5; }
.icare-sidebar-brand-hub { color: #fff; }
.icare-sidebar-close {
    background: rgba(255,255,255,.15);
    border: none;
    color: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: inherit;
    transition: background .12s;
}
.icare-sidebar-close:hover { background: rgba(255,255,255,.28); }

/* ── User info block ── */
.icare-sidebar-user {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 18px;
    background: #F0F6FA;
    border-bottom: 1px solid #E5E7EB;
}
.icare-sidebar-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #0B2D4E;
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.icare-sidebar-user-name { font-size: 15px; font-weight: 700; color: #0B2D4E; }
.icare-sidebar-user-role { font-size: 12px; font-weight: 600; color: #00897B; margin-top: 2px; }
.icare-sidebar-user-dept { font-size: 11px; color: #6B7280; margin-top: 2px; }

/* ── Nav items ── */
.icare-sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 10px 0;
    flex: 1;
}
.icare-sidebar-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    color: #0B2D4E;
    text-decoration: none;
    background: none;
    border: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    transition: background .12s;
    border-bottom: 1px solid #F3F4F6;
}
.icare-sidebar-item:hover { background: #F0F9FF; }
.icare-sidebar-item:last-child { border-bottom: none; }
.icare-sidebar-item-icon  { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; }
.icare-sidebar-item-label { flex: 1; }
.icare-sidebar-item-arrow { font-size: 18px; color: #9CA3AF; }

/* ── Footer ── */
.icare-sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #E5E7EB;
    background: #F8FAFC;
    flex-shrink: 0;
}
.icare-sidebar-footer-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 10px;
}
.icare-sidebar-version {
    font-size: 11px;
    color: #9CA3AF;
    font-weight: 600;
    margin-bottom: 4px;
}
.icare-sidebar-credit {
    font-size: 10px;
    color: #D1D5DB;
}

/* ================================================================
   Privacy Policy Modal
   ================================================================ */
.icare-privacy-modal {
    position: fixed;
    inset: 0;
    background: rgba(11,45,78,.6);
    z-index: 1500;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}
.icare-privacy-modal-inner {
    background: #fff;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-width: 560px;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -8px 32px rgba(11,45,78,.2);
    animation: slideUpModal .25s ease-out;
}
@keyframes slideUpModal {
    from { transform: translateY(30px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}
.icare-privacy-modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
}
.icare-privacy-modal-head h2 { margin: 0; font-size: 17px; color: #0B2D4E; }
.icare-privacy-modal-head .icare-sidebar-close {
    background: #F4F6F8;
    color: #374151;
}
.icare-privacy-modal-body {
    padding: 18px 20px;
    overflow-y: auto;
    font-size: 13px;
    color: #374151;
    line-height: 1.7;
}
.icare-privacy-modal-body h3 {
    font-size: 13px;
    font-weight: 800;
    color: #0B2D4E;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin: 18px 0 6px;
}
.icare-privacy-modal-body h3:first-child { margin-top: 0; }
.icare-privacy-modal-body ul {
    padding-left: 18px;
    margin: 6px 0;
}
.icare-privacy-modal-body li { margin-bottom: 4px; }
.icare-privacy-modal-body p  { margin: 4px 0 8px; }
.icare-privacy-updated {
    font-size: 11px;
    color: #9CA3AF;
    font-style: italic;
    margin-bottom: 14px !important;
}

/* ================================================================
   Discharge Summary Modal
   ================================================================ */
.icare-discharge-modal {
    position: fixed;
    inset: 0;
    background: rgba(11,45,78,.6);
    z-index: 1600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.icare-discharge-inner {
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 860px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(11,45,78,.25);
    overflow: hidden;
}
.icare-discharge-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: #0B2D4E;
    flex-shrink: 0;
}
.icare-discharge-head h2 { margin: 0; font-size: 16px; color: #fff; }
.icare-discharge-body {
    padding: 18px 20px;
    overflow-y: auto;
    flex: 1;
}

/* Patient bar */
.icare-dc-patient-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 16px;
    background: #F0F6FA;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 16px;
}
.icare-dc-name    { font-size: 15px; font-weight: 800; color: #0B2D4E; }
.icare-dc-meta    { font-size: 12px; color: #6B7280; }
.icare-dc-allergy { font-size: 12px; font-weight: 700; color: #DC2626; background: #FEE2E2; border-radius: 6px; padding: 2px 8px; }

/* Two-column grid */
.icare-dc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; margin-bottom: 12px; }
@media (max-width: 600px) { .icare-dc-grid { grid-template-columns: 1fr; } }

.icare-dc-row   { margin-bottom: 10px; }
.icare-dc-label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: #6B7280; margin-bottom: 3px; }
.icare-dc-input, .icare-dc-textarea {
    width: 100%;
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    font-family: inherit;
    color: #374151;
    outline: none;
    transition: border-color .12s;
    box-sizing: border-box;
}
.icare-dc-input:focus, .icare-dc-textarea:focus { border-color: #00897B; }
.icare-dc-textarea { resize: vertical; }

/* Full-width sections */
.icare-dc-section { margin-bottom: 12px; }
.icare-dc-section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; color: #6B7280; margin-bottom: 4px; }

/* AI draft button */
.icare-dc-ai-btn {
    margin-top: 6px;
    background: #EFF6FF;
    border: 1.5px solid #BFDBFE;
    color: #1E40AF;
    font-weight: 700;
    font-size: 12px;
    padding: 5px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    transition: all .12s;
}
.icare-dc-ai-btn:hover { background: #DBEAFE; }
.icare-dc-ai-note { font-size: 11px; color: #9CA3AF; margin-left: 8px; }

/* Footer */
.icare-dc-footer {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid #E5E7EB;
    margin-top: 4px;
    flex-wrap: wrap;
}
.icare-dc-print-btn {
    background: #F8FAFC;
    border: 1.5px solid #E5E7EB;
    border-radius: 8px;
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    font-family: inherit;
}
.icare-dc-pdpa-note { font-size: 10px; color: #D1D5DB; margin-left: auto; }
.icare-dc-saved-badge {
    font-size: 12px;
    font-weight: 700;
    color: #166534;
    background: #DCFCE7;
    border-radius: 6px;
    padding: 3px 10px;
}

/* ================================================================
   Medications — Current/History view
   ================================================================ */
.icare-med-view-toggle {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    border-bottom: 2px solid #E5E7EB;
    padding-bottom: 0;
}
.icare-med-view-btn {
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #6B7280;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-family: inherit;
    margin-bottom: -2px;
    transition: all .12s;
}
.icare-med-view-btn.active { color: #00897B; border-bottom-color: #00897B; }
.icare-med-view-btn:hover  { color: #0B2D4E; }

/* Current view cards */
.icare-med-class-badge {
    font-size: 10px;
    font-weight: 700;
    background: #EFF6FF;
    color: #1E40AF;
    border-radius: 5px;
    padding: 1px 7px;
    margin-left: 6px;
    vertical-align: middle;
}
.icare-med-indication {
    font-size: 11px;
    color: #059669;
    font-style: italic;
    margin-top: 2px;
}
.icare-med-meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 11px;
    color: #9CA3AF;
    margin-top: 3px;
}
.icare-med-pdept { color: #6B7280; }
.icare-med-stopped-reason {
    font-size: 11px;
    color: #DC2626;
    background: #FEF2F2;
    border-radius: 5px;
    padding: 2px 8px;
    margin-top: 3px;
    display: inline-block;
}
.icare-med-hold-note {
    font-size: 11px;
    color: #D97706;
    background: #FFFBEB;
    border-radius: 5px;
    padding: 2px 8px;
    margin-top: 3px;
    display: inline-block;
}
.icare-med-last-dose {
    font-size: 11px;
    color: #7C3AED;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.icare-med-dose-hist-btn {
    font-size: 10px;
    font-weight: 700;
    color: #7C3AED;
    background: #F5F3FF;
    border: 1px solid #DDD6FE;
    border-radius: 5px;
    padding: 1px 8px;
    cursor: pointer;
    font-family: inherit;
}

/* History view rows */
.icare-med-hist-note {
    font-size: 11px;
    color: #9CA3AF;
    font-style: italic;
    margin-bottom: 10px;
}
.icare-med-hist-row {
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 8px;
    background: #fff;
}
.icare-med-hist-header {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}
.icare-med-hist-date {
    font-size: 11px;
    font-weight: 800;
    color: #0B2D4E;
    white-space: nowrap;
}
.icare-med-hist-status-badge { font-size: 11px; font-weight: 700; }
.icare-med-hist-stopped-date { font-size: 11px; color: #9CA3AF; }
.icare-med-hist-name   { font-size: 14px; font-weight: 700; color: #0B2D4E; }
.icare-med-hist-detail { font-size: 12px; color: #374151; margin-top: 2px; }
.icare-med-hist-meta   { font-size: 11px; color: #9CA3AF; margin-top: 2px; }
.icare-med-hist-indication { font-size: 11px; color: #059669; font-style: italic; margin-top: 2px; }
.icare-med-hist-stopped    { font-size: 11px; color: #DC2626; margin-top: 2px; }
.icare-med-hist-notes  { font-size: 11px; color: #6B7280; margin-top: 2px; }
.icare-med-hist-doses  { font-size: 11px; color: #7C3AED; margin-top: 4px; display: flex; align-items: center; gap: 8px; }

/* ================================================================
   MOBILE 2-COLUMN LAYOUT  (≤ 768px)
   Col 1 — narrow number/seq  |  Col 2 — everything else
   Applies to: ED patient rows, all patient lists
   ================================================================ */
@media (max-width: 768px) {

    /* ── ED Referrals — .icare-patient-row ───────────────────── */
    .icare-patient-row {
        display:        grid;
        grid-template-columns: 40px 1fr !important;
        grid-template-rows:    auto;
        align-items:    start;
        gap:            0;
        padding:        0;
    }

    /* Col 1 — sequence number */
    .icare-seq-col {
        grid-column:    1;
        grid-row:       1 / 99;       /* span all rows in col 1 */
        border-right:   1px solid var(--ic-border);
        background:     #F8FAFC;
        min-height:     100%;
        justify-content: flex-start;
        padding-top:    14px;
    }
    /* Arrows visible on mobile — smaller size */
    .icare-seq-btns { display: flex !important; flex-direction: column; gap: 1px; }
    .icare-seq-btn { width: 24px !important; height: 22px !important; font-size: 9px !important; }

    /* Col 2 — patient info block */
    .icare-patient-body {
        grid-column:    2;
        padding:        10px 12px;
    }

    /* Hide the third "actions" column — move into col 2 */
    .icare-patient-row > .icare-patient-right {
        display:        flex;
        flex-wrap:      wrap;
        gap:            6px;
        padding:        0 12px 10px;
        grid-column:    2;
    }

    /* Flags become bigger touch targets */
    .icare-flag-btn {
        min-width:  40px !important;
        min-height: 40px !important;
        font-size:  15px !important;
    }

    /* Action buttons — stretch to fill */
    .icare-patient-actions {
        display:    flex;
        flex-wrap:  wrap;
        gap:        6px;
        padding:    0 12px 10px;
        grid-column: 2;
    }
    .icare-patient-actions .icare-btn {
        flex:          1 1 auto;
        min-width:     80px;
        font-size:     12px;
        padding:       9px 8px;
        justify-content: center;
        text-align:    center;
    }

    /* Patient name — slightly smaller */
    .icare-patient-name { font-size: 14px !important; }
    .icare-patient-meta { font-size: 11px !important; flex-wrap: wrap; }
}


/* ================================================================
   Mobile spacing optimisation — compact patient cards
   ================================================================ */
@media (max-width: 768px) {

    /* ── Flag buttons: 2×3 tight grid on mobile ──────────────── */
    .icare-flag-group {
        display:              grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap:                  5px !important;
        max-width:            100% !important;   /* remove 220px cap */
        width:                100% !important;
    }

    .icare-flag-group .icare-flag-btn {
        width:       100% !important;
        padding:     8px 10px !important;
        font-size:   13px !important;
        min-height:  40px;               /* comfortable touch target */
        border-radius: 10px !important;
    }

    /* ── Remove excess bottom space on patient card ───────────── */
    .icare-patient-row  { margin-bottom: 6px !important; }
    .icare-patient-body { padding-bottom: 6px !important; }
    .icare-patient-actions { padding-bottom: 8px !important; }

    /* ── Tighten inner row gaps ──────────────────────────────── */
    .icare-patient-left  { gap: 8px; }
    .icare-patient-right { gap: 5px; padding-top: 4px; }

    /* ── Remove min-height that causes blank space below ─────── */
    .icare-patient-row  { min-height: unset !important; }
    .icare-patient-body { min-height: unset !important; }

    /* ── Icon action row (pencil/doc/knife/passover/delete) ──── */
    .icare-patient-actions-secondary {
        padding: 4px 12px 8px !important;
        gap: 6px;
    }
    .icare-patient-actions-secondary .icare-btn {
        min-width:  40px;
        min-height: 40px;
        padding:    6px !important;
    }

    /* ── Shift patient list — no extra bottom padding ─────────── */
    .icare-patient-list { padding-bottom: 70px; }  /* just above bottom nav */
}

/* ================================================================
   Mobile — fix white space below patient card  (≤ 768px)
   The seq number column was stretching the entire card height.
   ================================================================ */
@media (max-width: 768px) {

    /* Seq column: don't span rows — just sit at the top */
    .icare-seq-col {
        grid-column:    1 !important;
        grid-row:       1 !important;
        align-self:     stretch !important;
        min-height:     unset !important;
        height:         auto !important;
    }
    /* On mobile patient-middle fills col 2 */
    .icare-patient-middle,
    .icare-frontend-wrap .icare-patient-middle,
    .icare-wrap .icare-patient-middle {
        grid-column: 2 !important;
        grid-row: 1 !important;
    }
    /* On mobile patient-actions is hidden — flags/actions flow inline */
    .icare-patient-actions,
    .icare-frontend-wrap .icare-patient-actions,
    .icare-wrap .icare-patient-actions {
        grid-column: 2 !important;
        grid-row: 2 !important;
        border-left: none !important;
        border-top: 1px solid var(--ic-border) !important;
        padding: 8px 12px !important;
    }

    /* Patient row: shrink to content, no artificial minimum */
    .icare-patient-row {
        min-height:  unset !important;
        height:      auto !important;
        align-items: start !important;
    }

    /* Seq number itself stays vertically centred within its column */
    .icare-seq-num {
        position:   sticky;
        top:        12px;
    }

    /* Remove excess padding from flag group container */
    .icare-flag-group-wrap,
    .icare-patient-flags {
        padding-bottom: 0 !important;
        margin-bottom:  0 !important;
    }

    /* Tighten the bottom icon row */
    .icare-patient-actions-secondary {
        padding-top:    6px !important;
        padding-bottom: 8px !important;
        margin-top:     0   !important;
    }
}

/* ================================================================
   Standardise flag button background to white (inactive state)
   ================================================================ */
.icare-flag-btn,
.icare-flag-btn-sp,
.icare-flag-btn-plan,
.icare-flag-btn-callback,
.icare-flag-btn-consent,
.icare-flag-btn-scans,
.icare-flag-btn-passover,
.icare-flag-group .icare-flag-btn {
    background: #ffffff !important;
}

/* Keep active/toggled states coloured */
.icare-flag-btn.active,
.icare-flag-btn-sp.active,
.icare-flag-btn-callback.active,
.icare-flag-btn-consent.active,
.icare-flag-btn-scans.active,
.icare-flag-btn-passover.active { background: inherit; }

/* ================================================================
   Standardise flag button background — transparent so it always
   matches the patient card background perfectly (no grey/white clash)
   ================================================================ */
.icare-flag-btn,
.icare-flag-btn-sp,
.icare-flag-btn-plan,
.icare-flag-btn-callback,
.icare-flag-btn-consent,
.icare-flag-btn-scans,
.icare-flag-btn-passover,
.icare-flag-group .icare-flag-btn {
    background: transparent !important;
}

/* Active/toggled states keep their colour */
.icare-flag-btn.active            { background: #e8f0fe  !important; }
.icare-flag-btn-sp.active         { background: #DBEAFE  !important; }
.icare-flag-btn-callback.active   { background: #FEF9C3  !important; }
.icare-flag-btn-consent.active    { background: #FEF3C7  !important; }
.icare-flag-btn-scans.active      { background: #EDE9FE  !important; }
.icare-flag-btn-passover.active   { background: #FFE4E6  !important; }

/* Post to OT button — hidden until feature is ready */
.icare-post-ot-btn { display: none !important; }

/* ================================================================
   Filter hiding — uses class instead of inline display:none
   so it overrides the flex !important rules on .icare-wrap rows
   ================================================================ */
.icare-patient-row.icare-row-hidden,
.icare-wrap .icare-patient-row.icare-row-hidden,
.icare-frontend-wrap .icare-patient-row.icare-row-hidden,
.icare-patient-row.icare-desktop-grid.icare-row-hidden {
    display: none !important;
}

/* ================================================================
   DESKTOP 3-COLUMN LAYOUT  (> 768px)
   Col 1: Number + Arrows  |  Col 2: Patient Info  |  Col 3: Flags + Icons
   ================================================================ */
@media (min-width: 769px) {

    /* ── Row grid ─────────────────────────────────────────────── */
    .icare-patient-row {
        display:               grid !important;
        grid-template-columns: 52px 1fr 230px !important;
        grid-template-rows:    auto !important;
        align-items:           stretch !important;
        min-height:            unset !important;
    }

    /* ── Col 1: Seq number + reorder arrows ───────────────────── */
    .icare-seq-col {
        grid-column:     1 !important;
        grid-row:        1 !important;
        display:         flex !important;
        flex-direction:  column !important;
        align-items:     center !important;
        justify-content: flex-start !important;
        padding:         12px 4px !important;
        border-right:    1px solid var(--ic-border) !important;
        background:      #F8FAFC !important;
        gap:             4px !important;
        min-height:      unset !important;
        height:          auto !important;
    }

    /* ── Col 2: Patient info ──────────────────────────────────── */
    .icare-patient-middle {
        grid-column:    2 !important;
        grid-row:       1 !important;
        padding:        12px 14px !important;
        display:        flex !important;
        flex-direction: column !important;
        gap:            4px !important;
        min-width:      0 !important;
        overflow:       hidden !important;
    }

    /* ── Col 3: Flags + Icons ─────────────────────────────────── */
    .icare-patient-actions {
        grid-column:    3 !important;
        grid-row:       1 !important;
        display:        flex !important;
        flex-direction: column !important;
        align-items:    stretch !important;
        border-left:    1px solid var(--ic-border) !important;
        background:     transparent !important;
        padding:        10px 10px !important;
        gap:            6px !important;
        min-width:      0 !important;
        cursor:         default !important;
    }

    /* Flag group fills full width of col 3 */
    .icare-flag-group,
    .icare-patient-actions .icare-flag-group {
        display:               grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap:                   5px !important;
        width:                 100% !important;
        max-width:             100% !important;
    }

    .icare-flag-group .icare-flag-btn {
        width:       100% !important;
        font-size:   12px !important;
        padding:     7px 6px !important;
        border-radius: 8px !important;
        text-align:  center !important;
        white-space: nowrap !important;
        overflow:    hidden !important;
        text-overflow: ellipsis !important;
    }

    /* Icon buttons row — horizontal, bottom of col 3 */
    .icare-action-col {
        display:         flex !important;
        flex-direction:  row !important;
        align-items:     center !important;
        justify-content: flex-start !important;
        gap:             5px !important;
        flex-wrap:       wrap !important;
        padding-top:     4px !important;
        border-top:      1px solid var(--ic-border) !important;
        margin-top:      2px !important;
    }

    .icare-action-btn {
        width:          34px !important;
        height:         34px !important;
        display:        flex !important;
        align-items:    center !important;
        justify-content: center !important;
        font-size:      16px !important;
        border-radius:  8px !important;
        padding:        0 !important;
        flex-shrink:    0 !important;
    }


    /* Admin uses .icare-flag-col for the flag buttons wrapper */
    .icare-patient-actions .icare-flag-col {
        display:               grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap:                   5px !important;
        width:                 100% !important;
    }
    .icare-action-divider {
        height:     1px !important;
        background: var(--ic-border) !important;
        margin:     2px 0 !important;
        width:      100% !important;
    }
    /* Patient name row — keep on one line */
    .icare-patient-name  { font-size: 14px !important; font-weight: 700 !important; }
    .icare-patient-header { flex-wrap: nowrap !important; gap: 6px !important; }
    .icare-patient-time  { white-space: nowrap !important; }
}

/* ================================================================
   Coming Soon page  [icare_coming_soon]
   ================================================================ */
.icare-cs-wrap {
    min-height:      70vh;
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: center;
    padding:         40px 20px 80px;
    background:      #F0F4FF;
}
.icare-cs-card {
    background:    #ffffff;
    border-radius: 20px;
    padding:       40px 32px 36px;
    max-width:     460px;
    width:         100%;
    text-align:    center;
    box-shadow:    0 8px 32px rgba(11,45,78,.10);
    border:        1px solid #E5E7EB;
}
.icare-cs-icon {
    font-size:     52px;
    margin-bottom: 16px;
    line-height:   1;
}
.icare-cs-title {
    font-size:     26px;
    font-weight:   800;
    color:         #0B2D4E;
    margin:        0 0 8px;
    font-family:   inherit;
}
.icare-cs-sub {
    font-size:     14px;
    font-weight:   600;
    color:         #00897B;
    margin:        0 0 14px;
}
.icare-cs-desc {
    font-size:     13px;
    color:         #6B7280;
    line-height:   1.7;
    margin:        0 0 20px;
}
.icare-cs-badge {
    display:         inline-flex;
    align-items:     center;
    gap:             8px;
    background:      #F0F9FF;
    border:          1px solid #BAE6FD;
    border-radius:   30px;
    padding:         6px 16px;
    font-size:       12px;
    font-weight:     600;
    color:           #0369A1;
    margin-bottom:   28px;
}
.icare-cs-back-btn {
    display:       inline-block;
    background:    #0B2D4E;
    color:         #ffffff;
    font-size:     14px;
    font-weight:   700;
    padding:       12px 28px;
    border-radius: 12px;
    text-decoration: none;
    transition:    background .15s, transform .1s;
    font-family:   inherit;
}
.icare-cs-back-btn:hover {
    background: #00897B;
    color:      #ffffff;
    transform:  translateY(-1px);
}
.icare-cs-footer {
    margin-top: 24px;
    font-size:  10px;
    color:      #9CA3AF;
    text-align: center;
}

/* ================================================================
   icare-desktop-grid — FLEXBOX 3-col patient row
   Using flexbox (not grid) to avoid 1fr zero-width issues
   ================================================================ */

/* All viewports: flex row */
.icare-desktop-grid {
    display:         flex !important;
    flex-direction:  row !important;
    align-items:     stretch !important;
    min-height:      unset !important;
    height:          auto !important;
    width:           100% !important;
    overflow:        hidden !important;
}

/* Col 1: seq number + arrows — 5% */
.icare-desktop-grid > .icare-seq-col {
    flex:            0 0 5% !important;
    width:           5% !important;
    min-width:       5% !important;
    max-width:       5% !important;
    display:         flex !important;
    flex-direction:  column !important;
    align-items:     center !important;
    justify-content: flex-start !important;
    padding-top:     12px !important;
    border-right:    1px solid var(--ic-border) !important;
    background:      #F8FAFC !important;
    overflow:        hidden !important;
}

/* Col 2: patient info — fills remaining space, pushes col 3 to right */
.icare-desktop-grid > .icare-patient-middle {
    flex:            1 1 0% !important;
    min-width:       0 !important;
    width:           0 !important;
    display:         flex !important;
    flex-direction:  column !important;
    padding:         12px 14px !important;
    gap:             4px !important;
    overflow:        hidden !important;
    word-break:      break-word !important;
}

/* Col 3: flags + icons — 30% */
.icare-desktop-grid > .icare-patient-actions {
    flex:            0 0 30% !important;
    width:           30% !important;
    min-width:       30% !important;
    max-width:       30% !important;
    display:         flex !important;
    flex-direction:  column !important;
    gap:             5px !important;
    padding:         10px !important;
    border-left:     1px solid var(--ic-border) !important;
    background:      transparent !important;
    overflow:        hidden !important;
}

/* Mobile: stack middle + actions below seq col */
@media (max-width: 600px) {
    .icare-desktop-grid {
        flex-wrap: wrap !important;
    }
    .icare-desktop-grid > .icare-seq-col {
        flex:       0 0 42px !important;
        width:      42px !important;
        min-width:  42px !important;
        max-width:  42px !important;
        align-self: stretch !important;
    }
    .icare-desktop-grid > .icare-patient-middle {
        flex:       1 1 calc(100% - 42px) !important;
        min-width:  0 !important;
        width:      0 !important;
        padding:    10px 12px !important;
    }
    .icare-desktop-grid > .icare-patient-actions {
        flex:       1 1 calc(100% - 42px) !important;
        width:      auto !important;
        min-width:  0 !important;
        max-width:  none !important;
        margin-left: 42px !important;
        border-left: none !important;
        border-top: 1px solid var(--ic-border) !important;
        padding:    8px 12px !important;
    }
}

/* Print Census button — visible on all screen sizes */
#icare-print-census-btn {
    display:    inline-flex !important;
    align-items: center;
    gap:        5px;
    white-space: nowrap;
}
@media (max-width: 768px) {
    #icare-print-census-btn {
        font-size: 12px !important;
        padding:   6px 10px !important;
    }
}

/* Mobile action buttons — compact touch targets */
@media (max-width: 768px) {
    .icare-desktop-grid > .icare-patient-actions .icare-flag-btn {
        font-size:  11px !important;
        padding:    6px 4px !important;
        min-height: 34px !important;
    }
    .icare-desktop-grid > .icare-patient-actions .icare-action-col .icare-action-btn {
        width:      30px !important;
        height:     30px !important;
        font-size:  14px !important;
    }
}

/* ================================================================
   DEFINITIVE PATIENT ROW LAYOUT — highest possible specificity
   Desktop: 3-col flex  |  Mobile (≤600px): 2-col flex
   html body prefix beats all other CSS rules
   ================================================================ */

/* ── Desktop: 3 columns ── */
/* ================================================================
   DEFINITIVE 3-COL LAYOUT v2 — box-sizing ensures exact percentages
   Col borders are INCLUDED in percentage widths via border-box
   5% (seq) + 65% (info) + 30% (actions) = exactly 100%
   ================================================================ */

/* Parent: no overflow so columns stay within card */
html body .icare-desktop-grid {
    display:         flex !important;
    flex-direction:  row !important;
    width:           100% !important;
    align-items:     stretch !important;
    overflow:        hidden !important;
    min-height:      unset !important;
    height:          auto !important;
}

/* Col 1 — 5% seq number + arrows */
html body .icare-desktop-grid > .icare-seq-col {
    flex:            0 0 5% !important;
    width:           5% !important;
    box-sizing:      border-box !important;
    display:         flex !important;
    flex-direction:  column !important;
    align-items:     center !important;
    justify-content: flex-start !important;
    padding-top:     12px !important;
    border-right:    1px solid var(--ic-border, #E5E7EB) !important;
    background:      #F8FAFC !important;
    overflow:        hidden !important;
}

/* Col 2 — 65% patient info with generous padding */
html body .icare-desktop-grid > .icare-patient-middle {
    flex:            0 0 65% !important;
    width:           65% !important;
    box-sizing:      border-box !important;
    overflow:        hidden !important;
    padding:         14px 18px !important;
    display:         flex !important;
    flex-direction:  column !important;
    gap:             5px !important;
    word-break:      break-word !important;
}

/* Col 3 — 30% flags + icons, always right-aligned */
html body .icare-desktop-grid > .icare-patient-actions {
    flex:            0 0 30% !important;
    width:           30% !important;
    box-sizing:      border-box !important;
    display:         flex !important;
    flex-direction:  column !important;
    gap:             5px !important;
    padding:         10px 10px !important;
    border-left:     1px solid var(--ic-border, #E5E7EB) !important;
    background:      transparent !important;
    overflow:        hidden !important;
}

/* ── Mobile (≤600px): 2 columns — seq + content ── */
@media (max-width: 600px) {
    html body .icare-desktop-grid {
        flex-wrap:   wrap !important;
    }
    html body .icare-desktop-grid > .icare-seq-col {
        flex:        0 0 42px !important;
        width:       42px !important;
        box-sizing:  border-box !important;
        align-self:  stretch !important;
        border-right: 1px solid var(--ic-border, #E5E7EB) !important;
    }
    html body .icare-desktop-grid > .icare-patient-middle {
        flex:        1 1 calc(100% - 42px) !important;
        width:       calc(100% - 42px) !important;
        box-sizing:  border-box !important;
        padding:     10px 14px !important;
    }
    html body .icare-desktop-grid > .icare-patient-actions {
        flex:        1 1 calc(100% - 42px) !important;
        width:       calc(100% - 42px) !important;
        box-sizing:  border-box !important;
        margin-left: 42px !important;
        border-left: none !important;
        border-top:  1px solid var(--ic-border, #E5E7EB) !important;
        padding:     8px 14px !important;
    }
}

/* ================================================================
   FRONTEND SHORTCODE LAYOUT — unique icsc- classes, zero conflicts
   icsc-row | icsc-col1 (5%) | icsc-col2 (65%) | icsc-col3 (30%)
   ================================================================ */

/* Desktop: 3 columns */
.icsc-row {
    display:         flex;
    flex-direction:  row;
    width:           100%;
    overflow:        hidden;
    align-items:     stretch;
    flex-wrap:       nowrap;
}
.icsc-col1 {
    flex:            0 0 5%;
    width:           5%;
    max-width:       5%;
    box-sizing:      border-box;
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    justify-content: flex-start;
    padding-top:     12px;
    border-right:    1px solid #E5E7EB;
    background:      #F8FAFC;
    overflow:        hidden;
}
.icsc-col2 {
    flex:            0 0 65%;
    width:           65%;
    min-width:       0;
    box-sizing:      border-box;
    overflow:        hidden;
    padding:         14px 18px;
    display:         flex;
    flex-direction:  column;
    gap:             4px;
    word-break:      break-word;
}
.icsc-col3 {
    flex:            0 0 30%;
    width:           30%;
    max-width:       30%;
    min-width:       0;
    box-sizing:      border-box;
    display:         flex;
    flex-direction:  column;
    gap:             5px;
    padding:         10px;
    border-left:     1px solid #E5E7EB;
    overflow:        hidden;
}

/* Mobile: 2 columns */
@media (max-width: 600px) {
    .icsc-row              { flex-wrap: wrap; }
    .icsc-col1             { flex: 0 0 42px; width: 42px; max-width: 42px; align-self: stretch; }
    .icsc-col2             { flex: 1 1 calc(100% - 42px); width: calc(100% - 42px); padding: 10px 14px; }
    .icsc-col3             { flex: 1 1 calc(100% - 42px); width: auto; max-width: none;
                             margin-left: 42px; border-left: none;
                             border-top: 1px solid #E5E7EB; padding: 8px 14px; }
}

/* icsc-row filter hiding */
.icsc-row.icsc-hidden { display: none !important; }

/* Fix flag buttons inside icsc-col3 — 2-col grid */
.icsc-col3 .icare-flag-group {
    display:               grid;
    grid-template-columns: 1fr 1fr;
    gap:                   5px;
    width:                 100%;
}
.icsc-col3 .icare-flag-btn {
    width:         100%;
    font-size:     12px;
    padding:       7px 4px;
    border-radius: 8px;
    text-align:    center;
    white-space:   nowrap;
    overflow:      hidden;
    text-overflow: ellipsis;
    box-sizing:    border-box;
}
/* Action icon row inside icsc-col3 */
.icsc-col3 .icare-action-col {
    display:         flex;
    flex-direction:  row;
    flex-wrap:       wrap;
    gap:             5px;
    padding-top:     4px;
    border-top:      1px solid #E5E7EB;
    margin-top:      2px;
}
.icsc-col3 .icare-action-btn {
    width:       34px;
    height:      34px;
    font-size:   16px;
    border-radius: 8px;
    display:     flex;
    align-items: center;
    justify-content: center;
    padding:     0;
    box-sizing:  border-box;
    flex-shrink: 0;
}

/* ================================================================
   Mobile horizontal overflow fix — prevent page wider than viewport
   ================================================================ */
@media (max-width: 768px) {

    /* Wrap: no horizontal overflow */
    .icare-frontend-wrap {
        overflow-x: hidden !important;
        max-width:  100vw !important;
        width:      100% !important;
        box-sizing: border-box !important;
        padding:    12px 12px 80px !important;
    }

    /* Shift info: wrap text, don't overflow */
    .icare-shift-info {
        white-space: normal !important;
        word-break:  break-word !important;
        font-size:   12px !important;
        max-width:   100% !important;
    }
    .icare-shift-bar {
        flex-wrap:   wrap !important;
        overflow:    hidden !important;
        gap:         6px !important;
    }
    .icare-shift-actions-row {
        flex-wrap:   wrap !important;
        gap:         6px !important;
    }

    /* Stats row: 3 per row, no overflow */
    .icare-stats-row {
        display:               grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap:                   6px !important;
        overflow:              hidden !important;
    }
    .icare-stat-card {
        min-width:   0 !important;
        overflow:    hidden !important;
    }

    /* Filter tabs: horizontal scroll only if needed */
    .icare-filter-tabs,
    .icare-status-tabs,
    .icare-flag-filter-bar {
        flex-wrap:   wrap !important;
        overflow-x:  hidden !important;
        max-width:   100% !important;
    }
    .icare-filter-tab,
    .icare-status-tab,
    .icare-flag-filter-btn {
        white-space: nowrap !important;
        flex-shrink: 1 !important;
        max-width:   calc(50% - 4px) !important;
        overflow:    hidden !important;
        text-overflow: ellipsis !important;
    }

    /* Location filter: allow horizontal scroll */
    .icare-filter-group {
        overflow-x:  auto !important;
        max-width:   100% !important;
        scrollbar-width: none !important;
    }
    .icare-filter-group::-webkit-scrollbar { display: none; }

    /* Shift actions buttons: wrap */
    .icare-shift-actions { flex-wrap: wrap !important; gap: 6px !important; }
    .icare-btn-sm        { font-size: 12px !important; padding: 6px 10px !important; }

    /* Patient card: no horizontal overflow */
    .icare-patient-row,
    .icsc-row {
        max-width:   100% !important;
        overflow-x:  hidden !important;
        box-sizing:  border-box !important;
    }

    /* Ensure all children stay within bounds */
    .icare-frontend-wrap * {
        max-width:   100% !important;
        box-sizing:  border-box !important;
    }
}

/* ================================================================
   Floating menu button + sidebar — hidden for now
   Re-enable by removing this block when needed
   ================================================================ */
.icare-fab-menu,
.icare-sidebar-overlay,
.icare-sidebar,
.icare-privacy-modal { display: none !important; }

/* ================================================================
   GALLERY — Wound + X-ray sub-tabs, thumbnails, tag modal, lightbox
   ================================================================ */

/* Sub-tab bar */
.icare-gallery-subtabs {
    display:    flex;
    gap:        8px;
    margin-bottom: 14px;
    border-bottom: 2px solid #E5E7EB;
    padding-bottom: 0;
}
.icare-gallery-stab {
    background:    none;
    border:        none;
    padding:       8px 16px;
    font-size:     13px;
    font-weight:   600;
    color:         #6B7280;
    cursor:        pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-family:   inherit;
    transition:    all .15s;
}
.icare-gallery-stab.active { color: #0B2D4E; border-bottom-color: #1a73e8; }
.icare-gallery-stab:hover  { color: #0B2D4E; }

/* Gallery panel */
.icare-gallery-panel { padding: 10px 0; }

.icare-gallery-grid {
    display:               grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap:                   10px;
    margin-bottom:         12px;
}
.icare-gallery-thumb-wrap {
    position:      relative;
    border-radius: 10px;
    overflow:      hidden;
    background:    #F3F4F6;
    aspect-ratio:  1;
    cursor:        pointer;
    border:        1px solid #E5E7EB;
    transition:    box-shadow .15s;
}
.icare-gallery-thumb-wrap:hover { box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.icare-gallery-thumb-wrap.uploading { opacity: .6; cursor: default; }

.icare-gallery-thumb {
    width:          100%;
    height:         100%;
    object-fit:     cover;
    display:        block;
    cursor:         pointer;
    -webkit-tap-highlight-color: rgba(0,0,0,0.2);
}
.icare-gallery-thumb-label {
    position:   absolute;
    bottom:     0; left: 0; right: 0;
    background: rgba(0,0,0,.55);
    color:      #fff;
    font-size:  9px;
    padding:    3px 5px;
    white-space: nowrap;
    overflow:   hidden;
    text-overflow: ellipsis;
}
.icare-gallery-del-btn {
    position:      absolute;
    top:           4px; right: 4px;
    width:         20px; height: 20px;
    background:    rgba(0,0,0,.55);
    color:         #fff;
    border:        none;
    border-radius: 50%;
    font-size:     10px;
    cursor:        pointer;
    display:       none;
    align-items:   center;
    justify-content: center;
    line-height:   1;
}
.icare-gallery-thumb-wrap:hover .icare-gallery-del-btn { display: flex; }

/* Upload button */
.icare-gallery-upload-row { margin-top: 6px; }
.icare-gallery-upload-btn {
    position:      relative;  /* so opacity:0 input fills this exactly */
    overflow:      hidden;    /* clip the invisible input */
    display:       inline-flex;
    align-items:   center;
    gap:           6px;
    background:    #F0F9FF;
    border:        2px dashed #BAE6FD;
    border-radius: 10px;
    padding:       10px 18px;
    font-size:     13px;
    font-weight:   600;
    color:         #0369A1;
    cursor:        pointer;
    transition:    all .15s;
    -webkit-tap-highlight-color: transparent;
}
.icare-gallery-upload-btn:hover { background: #E0F2FE; border-color: #7DD3FC; }

/* Empty state */
.icare-gallery-empty {
    color:      #9CA3AF;
    font-size:  13px;
    text-align: center;
    padding:    20px 0;
}

/* Spinner */
.icare-gallery-spinner {
    width:  28px; height: 28px;
    border: 3px solid #E5E7EB;
    border-top-color: #1a73e8;
    border-radius: 50%;
    animation: icare-spin .7s linear infinite;
    margin: 30px auto;
}
@keyframes icare-spin { to { transform: rotate(360deg); } }

/* Loading */
.icare-gallery-loading { color: #9CA3AF; font-size: 12px; padding: 16px; text-align: center; }

/* ── Tag modal ─────────────────────────────────────────────────── */
.icare-gallery-tag-overlay {
    position:        fixed;
    inset:           0;
    z-index:         99999;
    background:      rgba(0,0,0,.55);
    display:         none;  /* JS sets display:flex when opening */
    align-items:     center;
    justify-content: center;
    padding:         20px;
}
.icare-gallery-tag-overlay.icare-tag-open,
.icare-gallery-tag-overlay[style*='flex'] {
    display: flex !important;
}
.icare-gallery-tag-box {
    background:    #fff;
    border-radius: 16px;
    padding:       24px 22px;
    width:         100%;
    max-width:     420px;
    box-shadow:    0 20px 60px rgba(0,0,0,.25);
}
.icare-gallery-tag-hdr {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    margin-bottom:   18px;
    font-size:       16px;
    font-weight:     700;
    color:           #0B2D4E;
}
.icare-gallery-tag-close {
    background: none; border: none; font-size: 18px; cursor: pointer; color: #9CA3AF;
}
.icare-gallery-tag-label {
    display:       block;
    font-size:     12px;
    font-weight:   600;
    color:         #374151;
    margin-bottom: 5px;
    margin-top:    12px;
}
.icare-gallery-tag-input {
    width:         100%;
    border:        1.5px solid #D1D5DB;
    border-radius: 8px;
    padding:       9px 12px;
    font-size:     13px;
    font-family:   inherit;
    box-sizing:    border-box;
    outline:       none;
    transition:    border-color .15s;
}
.icare-gallery-tag-input:focus { border-color: #1a73e8; }
.icare-gallery-tag-footer {
    display:         flex;
    gap:             10px;
    margin-top:      20px;
    justify-content: flex-end;
}

/* ── Lightbox ──────────────────────────────────────────────────── */
.icare-lb-overlay {
    position:        fixed;
    inset:           0;
    z-index:         100000;
    background:      rgba(0,0,0,.93);
    display:         flex;
    align-items:     center;
    justify-content: center;
    gap:             16px;
    padding:         20px;
}
#icare-lb-inner {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    max-width:      80vw;
    max-height:     85vh;
}
#icare-lb-img {
    max-width:     100%;
    max-height:    72vh;
    object-fit:    contain;
    border-radius: 8px;
}
#icare-lb-label  { color: #D1D5DB; font-size: 12px; margin-top: 10px; text-align: center; }
#icare-lb-counter{ color: #9CA3AF; font-size: 11px; margin-top: 4px; }

.icare-lb-btn {
    background:    rgba(255,255,255,.15);
    border:        none;
    color:         #fff;
    border-radius: 50%;
    width:         44px; height: 44px;
    font-size:     24px;
    cursor:        pointer;
    display:       flex;
    align-items:   center;
    justify-content: center;
    transition:    background .15s;
    flex-shrink:   0;
}
.icare-lb-btn:hover { background: rgba(255,255,255,.3); }
.icare-lb-close { position: absolute; top: 16px; right: 16px; }
.icare-lb-nav   { }

/* ================================================================
   ICD-11 Search field
   ================================================================ */
.icare-icd11-search-wrap { position: relative; }

.icare-icd11-dropdown {
    position:      absolute;
    top:           100%;
    left:          0; right: 0;
    background:    #fff;
    border:        1.5px solid #1a73e8;
    border-top:    none;
    border-radius: 0 0 10px 10px;
    box-shadow:    0 8px 24px rgba(0,0,0,.12);
    z-index:       9999;
    max-height:    300px;
    overflow-y:    auto;
}
.icare-icd11-src-badge {
    font-size:  10px;
    font-weight: 700;
    color:      #6B7280;
    padding:    4px 12px 2px;
    border-bottom: 1px solid #F3F4F6;
    letter-spacing: .4px;
}
.icare-icd11-item {
    padding:    10px 14px;
    cursor:     pointer;
    border-bottom: 1px solid #F3F4F6;
    display:    flex;
    flex-direction: column;
    gap:        2px;
    transition: background .1s;
}
.icare-icd11-item:last-child { border-bottom: none; }
.icare-icd11-item:hover      { background: #EEF2FF; }

.icare-icd11-item-code {
    font-family: monospace;
    font-weight: 700;
    font-size:   12px;
    color:       #1a73e8;
    background:  #EEF2FF;
    border-radius: 4px;
    padding:     1px 6px;
    width:       fit-content;
}
.icare-icd11-item-title {
    font-size:   13px;
    font-weight: 500;
    color:       #0B2D4E;
}
.icare-icd11-item-icd10 {
    font-size:   11px;
    color:       #6B7280;
}
.icare-icd11-loading,
.icare-icd11-noresult {
    padding:    14px;
    text-align: center;
    color:      #9CA3AF;
    font-size:  13px;
}

/* Selected code display */
.icare-icd11-selected {
    display:     flex;
    align-items: center;
    gap:         8px;
    margin-top:  8px;
    background:  #F0FDF4;
    border:      1.5px solid #86EFAC;
    border-radius: 10px;
    padding:     8px 12px;
    flex-wrap:   wrap;
}
.icare-icd11-badge {
    font-family: monospace;
    font-weight: 800;
    font-size:   13px;
    color:       #15803D;
    background:  #DCFCE7;
    border-radius: 6px;
    padding:     2px 10px;
    flex-shrink: 0;
}
.icare-icd11-title {
    font-size:   13px;
    font-weight: 600;
    color:       #166534;
    flex:        1;
}
.icare-icd11-clear {
    background:  none;
    border:      1px solid #86EFAC;
    border-radius: 6px;
    color:       #15803D;
    font-size:   11px;
    padding:     2px 8px;
    cursor:      pointer;
    flex-shrink: 0;
    font-family: inherit;
}
.icare-icd11-clear:hover { background: #DCFCE7; }

/* ================================================================
   Modal footer — always sticky at bottom on mobile + frontend
   Override any theme/page CSS that might let modal grow unconstrained
   ================================================================ */
/* Flex layout for modal boxes — scoped to specific modals only */
.icare-frontend-wrap #icare-modal .icare-modal-box,
#icare-modal .icare-modal-box,
#icare-scan-modal,
#icare-referral-modal {
    flex-direction:  column !important;
    max-height:      92vh !important;
    overflow:        hidden !important;
    /* NOTE: display is NOT set here — modals control their own display:none/flex */
}
.icare-frontend-wrap #icare-modal .icare-modal-body,
#icare-modal .icare-modal-body {
    flex:            1 1 auto !important;
    overflow-y:      auto !important;
    -webkit-overflow-scrolling: touch !important;
    min-height:      0 !important;
}
.icare-frontend-wrap #icare-modal .icare-modal-footer,
#icare-modal .icare-modal-footer {
    flex-shrink:     0 !important;
    position:        sticky !important;
    bottom:          0 !important;
    background:      #F9FAFB !important;
    border-top:      1.5px solid #E5E7EB !important;
    padding:         14px 18px !important;
    z-index:         10 !important;
    display:         flex !important;
    gap:             10px !important;
    justify-content: flex-end !important;
}

/* Mobile: footer full-width buttons */
@media (max-width: 600px) {
    .icare-modal-footer {
        padding:    12px 16px !important;
    }
    .icare-modal-footer .icare-btn {
        flex:       1 !important;
        text-align: center !important;
        justify-content: center !important;
        font-size:  15px !important;
        padding:    13px 0 !important;
    }
}

/* Gallery "All" tab — both panels visible, stacked with divider */
#icare-gallery-wound + #icare-gallery-xray {
    border-top:  1.5px solid #E5E7EB;
    margin-top:  14px;
    padding-top: 12px;
}
#icare-gallery-wound + #icare-gallery-xray::before {
    content:     '🩻 X-Ray / Imaging';
    display:     block;
    font-size:   12px;
    font-weight: 700;
    color:       #6B7280;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 8px;
}
/* Label for wound when both visible */
.icare-gallery-subtabs + #icare-gallery-wound {
    /* noop — wound always first, no label needed */
}

/* ================================================================
   Auto-resize textarea (management plan)
   JS sets height dynamically; CSS ensures smooth growth
   ================================================================ */
.icare-autoresize {
    resize:     none !important;     /* JS handles resize */
    overflow-y: hidden !important;   /* no scrollbar — shows all content */
    min-height: 80px;
    transition: height 0.1s ease;
    box-sizing: border-box;
}

/* ICD-11 AI suggested badge */
#icare-icd11-ai-badge {
    animation: icare-fadeIn .3s ease;
}
@keyframes icare-fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ================================================================
   Gallery upload progress bar
   ================================================================ */
.icare-gallery-progress-wrap {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    justify-content: center;
    gap:            8px;
    padding:        12px 10px;
    height:         100%;
    min-height:     90px;
}
.icare-gallery-progress-label {
    font-size:   11px;
    font-weight: 600;
    color:       #6B7280;
}
.icare-gallery-progress-bar-outer {
    width:         80%;
    height:        6px;
    background:    #E5E7EB;
    border-radius: 10px;
    overflow:      hidden;
}
.icare-gallery-progress-bar-inner {
    height:        100%;
    background:    linear-gradient(90deg, #1a73e8, #00897B);
    border-radius: 10px;
    transition:    width .2s ease;
}
.icare-gallery-error {
    background:    #FEE2E2;
    border:        1px solid #FCA5A5;
    border-radius: 8px;
    padding:       8px 12px;
    font-size:     12px;
    color:         #DC2626;
    margin-bottom: 6px;
    grid-column:   1 / -1;
}

/* ================================================================
   Feedback section (frontend footer)
   ================================================================ */
.icare-feedback-section {
    max-width:     680px;
    margin:        40px auto 20px;
    background:    #fff;
    border:        1px solid #E5E7EB;
    border-radius: 16px;
    padding:       24px 22px;
    box-shadow:    0 4px 16px rgba(0,0,0,.06);
}
.icare-feedback-title {
    font-size:     16px;
    font-weight:   700;
    color:         #0B2D4E;
    margin-bottom: 4px;
}
.icare-feedback-sub {
    font-size:     13px;
    color:         #6B7280;
    margin:        0 0 16px;
}
.icare-feedback-grid {
    display:               grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap:                   10px;
    margin-bottom:         10px;
}
@media (max-width: 600px) {
    .icare-feedback-grid { grid-template-columns: 1fr; }
}
.icare-feedback-section #icare-fb-comment {
    width:         100%;
    margin-bottom: 12px;
    box-sizing:    border-box;
}
.icare-feedback-alert {
    padding:       10px 14px;
    border-radius: 8px;
    font-size:     13px;
    font-weight:   600;
    margin-bottom: 10px;
}
.icare-feedback-alert.success { background: #F0FDF4; color: #15803D; border: 1px solid #86EFAC; }
.icare-feedback-alert.error   { background: #FEF2F2; color: #DC2626; border: 1px solid #FCA5A5; }

/* Lightbox download button */
.icare-lb-download-btn {
    display:         inline-flex;
    align-items:     center;
    gap:             6px;
    margin-top:      12px;
    background:      rgba(255,255,255,.15);
    color:           #fff;
    border:          1.5px solid rgba(255,255,255,.3);
    border-radius:   8px;
    padding:         8px 20px;
    font-size:       13px;
    font-weight:     600;
    text-decoration: none;
    cursor:          pointer;
    transition:      background .15s;
}
.icare-lb-download-btn:hover {
    background: rgba(255,255,255,.28);
    color:      #fff;
    text-decoration: none;
}

/* Hide ICD-10 mapped field in Add/Edit Patient modal — billing handled separately */
#icare-icd10-mapped-group { display: none !important; }
/* Hide the blue ICD-10 card/search bar in modal */
.icare-emr-icd10-section { display: none !important; }

/* ================================================================
   Lightbox — CSS class toggle (reliable across all browsers/iOS)
   ================================================================ */
#icare-lightbox {
    display: none;          /* hidden by default */
}
#icare-lightbox.icare-lb-open {
    display: flex !important;   /* shown when class added by JS */
    align-items:     center !important;
    justify-content: center !important;
}
/* Prevent body scroll when lightbox is open */
body.icare-lb-open-body {
    overflow: hidden;
}

/* Removes iOS 300ms click delay on thumbnails */
.icare-gallery-thumb { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }

/* Image count badge — tappable, opens gallery view */
.icare-open-gallery-btn {
    display:         inline-flex;
    align-items:     center;
    gap:             4px;
    background:      rgba(26,115,232,.08);
    border:          1.5px solid rgba(26,115,232,.25);
    border-radius:   20px;
    padding:         3px 10px;
    font-size:       12px;
    font-weight:     600;
    color:           #1a73e8;
    cursor:          pointer;
    touch-action:    manipulation;
    font-family:     inherit;
    transition:      all .15s;
    -webkit-tap-highlight-color: transparent;
}
.icare-open-gallery-btn:hover,
.icare-open-gallery-btn:active {
    background: rgba(26,115,232,.16);
    border-color: #1a73e8;
}

/* ================================================================
   SHIFT CHAT — WhatsApp-style floating chat panel
   ================================================================ */

/* FAB button */
.icare-chat-fab {
    position:        fixed;
    bottom:          72px; /* above bottom nav */
    right:           16px;
    width:           52px;
    height:          52px;
    border-radius:   50%;
    background:      #0B2D4E;
    color:           #fff;
    font-size:       22px;
    border:          none;
    box-shadow:      0 4px 16px rgba(0,0,0,.25);
    cursor:          pointer;
    z-index:         99998;
    display:         flex;
    align-items:     center;
    justify-content: center;
    touch-action:    manipulation;
    transition:      transform .15s;
}
.icare-chat-fab:active { transform: scale(.93); }

.icare-chat-badge {
    position:        absolute;
    top:             -4px;
    right:           -4px;
    background:      #EF4444;
    color:           #fff;
    font-size:       10px;
    font-weight:     700;
    min-width:       18px;
    height:          18px;
    border-radius:   9px;
    padding:         0 4px;
    display:         flex;
    align-items:     center;
    justify-content: center;
    border:          2px solid #fff;
}

/* Chat panel */
.icare-chat-panel {
    position:        fixed;
    bottom:          136px; /* above FAB + nav */
    right:           16px;
    width:           320px;
    max-width:       calc(100vw - 32px);
    height:          480px;
    max-height:      calc(100vh - 180px);
    background:      #fff;
    border-radius:   16px;
    box-shadow:      0 8px 40px rgba(0,0,0,.20);
    display:         flex;
    flex-direction:  column;
    z-index:         99997;
    overflow:        hidden;
    transform:       scale(.85) translateY(20px);
    opacity:         0;
    pointer-events:  none;
    transition:      transform .2s cubic-bezier(.34,1.56,.64,1), opacity .18s;
}
.icare-chat-panel.icare-chat-open {
    transform:       scale(1) translateY(0);
    opacity:         1;
    pointer-events:  all;
}

/* Header */
.icare-chat-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    padding:         12px 14px;
    background:      #0B2D4E;
    color:           #fff;
    flex-shrink:     0;
}
.icare-chat-title    { font-size: 14px; font-weight: 700; }
.icare-chat-subtitle { font-size: 11px; color: rgba(255,255,255,.7); margin-top: 1px; }
.icare-chat-header-actions { display: flex; align-items: center; gap: 6px; }

.icare-chat-action-btn {
    font-size:     11px; font-weight: 700;
    border:        1.5px solid rgba(255,255,255,.5);
    border-radius: 6px; padding: 4px 10px;
    background:    transparent; color: #fff;
    cursor:        pointer; font-family: inherit;
}
.icare-chat-action-btn.icare-chat-join { background: rgba(255,255,255,.15); }
.icare-chat-close-btn {
    background: none; border: none; color: #fff;
    font-size: 16px; cursor: pointer; padding: 4px;
}

/* Messages area */
.icare-chat-messages {
    flex:            1;
    overflow-y:      auto;
    padding:         12px 10px;
    display:         flex;
    flex-direction:  column;
    gap:             6px;
    background:      #ECE5DD; /* WhatsApp green-ish bg */
}

/* System notification */
.icare-chat-system {
    display:         flex;
    flex-direction:  column;
    align-items:     center;
    gap:             4px;
    text-align:      center;
    margin:          4px auto;
    max-width:       90%;
    background:      rgba(255,255,255,.7);
    border-radius:   10px;
    padding:         6px 12px;
    font-size:       11px;
    color:           #374151;
}
.icare-chat-patient-tag {
    background:      #DBEAFE;
    color:           #1D4ED8;
    border-radius:   4px;
    padding:         1px 7px;
    font-size:       10px;
    font-weight:     700;
}
.icare-chat-thumb {
    width:           90px; height: 90px;
    object-fit:      cover;
    border-radius:   8px;
    cursor:          pointer;
    margin-top:      4px;
    touch-action:    manipulation;
}

/* Chat bubbles */
.icare-chat-bubble-wrap {
    display:         flex;
    flex-direction:  column;
    max-width:       80%;
}
.icare-chat-me    { align-self: flex-end; align-items: flex-end; }
.icare-chat-other { align-self: flex-start; align-items: flex-start; }

.icare-chat-name {
    font-size:   10px;
    font-weight: 700;
    color:       #0B2D4E;
    padding:     0 4px;
    margin-bottom: 2px;
}
.icare-chat-bubble {
    padding:       8px 10px;
    border-radius: 12px;
    display:       flex;
    flex-direction: column;
    gap:           2px;
    position:      relative;
    word-break:    break-word;
}
.icare-chat-me    .icare-chat-bubble { background: #DCF8C6; border-bottom-right-radius: 3px; }
.icare-chat-other .icare-chat-bubble { background: #fff;    border-bottom-left-radius: 3px; }
.icare-chat-text  { font-size: 13px; color: #111827; }
.icare-chat-time  { font-size: 10px; color: #9CA3AF; text-align: right; }

/* Input row */
.icare-chat-input-row {
    display:      flex;
    align-items:  center;
    gap:          8px;
    padding:      10px 12px;
    border-top:   1px solid #E5E7EB;
    background:   #F9FAFB;
    flex-shrink:  0;
}
.icare-chat-input {
    flex:         1;
    border:       1.5px solid #D1D5DB;
    border-radius: 20px;
    padding:      8px 14px;
    font-size:    13px;
    outline:      none;
    font-family:  inherit;
}
.icare-chat-input:focus { border-color: #1a73e8; }
.icare-chat-send-btn {
    width:        36px; height: 36px;
    border-radius: 50%;
    background:   #0B2D4E;
    color:        #fff;
    border:       none;
    font-size:    16px;
    cursor:       pointer;
    flex-shrink:  0;
    display:      flex; align-items: center; justify-content: center;
    touch-action: manipulation;
}

/* Join prompt */
.icare-chat-join-prompt {
    padding:    16px;
    text-align: center;
    font-size:  13px;
    color:      #6B7280;
    flex-shrink: 0;
}
.icare-chat-loading { color: #9CA3AF; font-size: 12px; text-align: center; padding: 20px; }

/* Fade-in animation for new messages */
.icare-chat-new { animation: icare-chat-pop .25s ease; }
@keyframes icare-chat-pop { from { opacity:0; transform: translateY(6px); } to { opacity:1; transform: none; } }

@media (max-width: 400px) {
    .icare-chat-panel { right: 8px; width: calc(100vw - 16px); }
    .icare-chat-fab   { right: 8px; }
}

/* ── Chat room tabs ─────────────────────────────────────────────── */
.icare-chat-room-tabs {
    display:        flex;
    overflow-x:     auto;
    gap:            4px;
    padding:        6px 10px;
    background:     #F3F4F6;
    border-bottom:  1px solid #E5E7EB;
    flex-shrink:    0;
    scrollbar-width: none;
}
.icare-chat-room-tabs::-webkit-scrollbar { display: none; }
.icare-chat-room-tab {
    white-space:    nowrap;
    font-size:      11px;
    font-weight:    600;
    padding:        4px 10px;
    border-radius:  12px;
    border:         1.5px solid #D1D5DB;
    background:     #fff;
    color:          #6B7280;
    cursor:         pointer;
    font-family:    inherit;
    touch-action:   manipulation;
    transition:     all .15s;
    flex-shrink:    0;
}
.icare-chat-room-tab.icare-chat-room-active {
    background:    #0B2D4E;
    color:         #fff;
    border-color:  #0B2D4E;
}
.icare-chat-room-tab.icare-chat-room-add {
    background:    transparent;
    border-style:  dashed;
    color:         #1a73e8;
    border-color:  #1a73e8;
    font-size:     14px;
    padding:       2px 10px;
}
.icare-chat-room-del {
    margin-left:   4px;
    opacity:       .6;
    font-size:     9px;
}
.icare-chat-room-del:hover { opacity: 1; }

/* ================================================================
   ICD-11 — Suggest button + results list
   ================================================================ */
.icare-icd11-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    margin-bottom:   6px;
}
.icare-icd11-suggest-btn {
    background:      #FEF9C3;
    border:          1.5px solid #FDE047;
    color:           #92400E;
    border-radius:   8px;
    padding:         4px 12px;
    font-size:       12px;
    font-weight:     700;
    cursor:          pointer;
    font-family:     inherit;
    touch-action:    manipulation;
    white-space:     nowrap;
    transition:      all .15s;
}
.icare-icd11-suggest-btn:hover  { background: #FDE68A; }
.icare-icd11-suggest-btn:disabled { opacity: .6; cursor: default; }

/* Results list */
.icare-icd11-results {
    margin-top:    8px;
    border:        1.5px solid #E5E7EB;
    border-radius: 10px;
    overflow:      hidden;
    background:    #fff;
}
.icare-icd11-results-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    padding:         6px 12px;
    background:      #F9FAFB;
    border-bottom:   1px solid #E5E7EB;
    font-size:       11px;
}
.icare-icd11-src           { font-weight: 700; color: #6B7280; }
.icare-icd11-results-count { color: #9CA3AF; }

.icare-icd11-result-row {
    padding:       10px 12px;
    border-bottom: 1px solid #F3F4F6;
    cursor:        pointer;
    position:      relative;
    touch-action:  manipulation;
    transition:    background .1s;
}
.icare-icd11-result-row:last-child { border-bottom: none; }
.icare-icd11-result-row:hover,
.icare-icd11-result-row:active { background: #EEF2FF; }

.icare-icd11-result-main {
    display:     flex;
    align-items: flex-start;
    gap:         8px;
    margin-bottom: 2px;
}
.icare-icd11-result-code {
    font-family:   monospace;
    font-weight:   800;
    font-size:     11px;
    color:         #1a73e8;
    background:    #EEF2FF;
    border-radius: 4px;
    padding:       1px 6px;
    flex-shrink:   0;
}
.icare-icd11-result-title {
    font-size:   13px;
    font-weight: 600;
    color:       #111827;
    flex:        1;
}
.icare-icd11-result-icd10 {
    font-size: 11px;
    color:     #6B7280;
    margin-left: 4px;
}
.icare-icd11-select-btn {
    position:      absolute;
    right:         10px;
    top:           50%;
    transform:     translateY(-50%);
    background:    #1a73e8;
    color:         #fff;
    border:        none;
    border-radius: 6px;
    padding:       4px 10px;
    font-size:     11px;
    font-weight:   700;
    cursor:        pointer;
    font-family:   inherit;
    touch-action:  manipulation;
}

.icare-icd11-hint {
    padding:       8px 12px;
    font-size:     11px;
    color:         #92400E;
    background:    #FEF9C3;
    border-bottom: 1px solid #FDE68A;
}
.icare-icd11-searching,
.icare-icd11-no-result {
    padding:    14px;
    text-align: center;
    font-size:  13px;
    color:      #9CA3AF;
}

/* ================================================================
   Feedback slide-up sheet (opened from sidebar)
   ================================================================ */
.icare-feedback-sheet {
    position:       fixed;
    bottom:         0; left: 0; right: 0;
    z-index:        999998;
    background:     #fff;
    border-radius:  20px 20px 0 0;
    box-shadow:     0 -8px 40px rgba(0,0,0,.18);
    max-height:     90vh;
    overflow-y:     auto;
    -webkit-overflow-scrolling: touch;
}
.icare-feedback-sheet-inner { padding: 24px 20px 40px; }
.icare-feedback-sheet-head {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    margin-bottom:   8px;
}
.icare-feedback-sheet-head h3 { margin: 0; font-size: 18px; color: #0B2D4E; }
.icare-feedback-fields {
    display:        flex;
    flex-direction: column;
    gap:            10px;
    margin-top:     14px;
}
.icare-feedback-fields textarea {
    resize:     vertical;
    min-height: 90px;
}

/* ================================================================
   ICD-11 multi-code chips
   ================================================================ */
#icare-icd11-selected {
    display:        flex;
    flex-direction: column;
    gap:            6px;
    margin-top:     8px;
}
.icare-icd11-chip {
    display:         flex;
    align-items:     center;
    gap:             8px;
    background:      #F0FDF4;
    border:          1.5px solid #86EFAC;
    border-radius:   10px;
    padding:         8px 12px;
    flex-wrap:       wrap;
}
.icare-icd11-chip-code {
    font-family:   monospace;
    font-weight:   800;
    font-size:     12px;
    color:         #15803D;
    background:    #DCFCE7;
    border-radius: 5px;
    padding:       2px 8px;
    flex-shrink:   0;
}
.icare-icd11-chip-title {
    font-size:   13px;
    font-weight: 600;
    color:       #166534;
    flex:        1;
    min-width:   0;
}
.icare-icd11-chip-del {
    background:    none;
    border:        1px solid #86EFAC;
    border-radius: 5px;
    color:         #15803D;
    font-size:     11px;
    padding:       2px 7px;
    cursor:        pointer;
    flex-shrink:   0;
    font-family:   inherit;
    touch-action:  manipulation;
}
.icare-icd11-chip-del:hover { background: #DCFCE7; }

/* Select button — changes when code already selected */
.icare-icd11-select-btn {
    background: #1a73e8;
    transition: background .15s;
}
.icare-icd11-btn-selected {
    background: #16A34A !important;
}

/* ================================================================
   Inline feedback form — bottom of every page
   ================================================================ */
.icare-page-feedback {
    width:      100%;
    background: #F8FAFC;
    border-top: 1px solid #E5E7EB;
    padding:    20px 16px 80px; /* 80px clears the bottom nav */
}
.icare-page-feedback-inner {
    max-width:  680px;
    margin:     0 auto;
    display:    flex;
    flex-direction: column;
    gap:        10px;
}
.icare-page-feedback-title {
    font-size:   14px;
    font-weight: 700;
    color:       #6B7280;
    letter-spacing: .3px;
}
.icare-page-feedback-row {
    display:               grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap:                   8px;
}
@media (max-width: 600px) {
    .icare-page-feedback-row { grid-template-columns: 1fr; }
}
.icare-page-feedback #icare-fb-comment {
    resize:     vertical;
    min-height: 70px;
}

/* ================================================================
   Font size +2px — surgical increases on text elements only
   Avoids compounding by using flat px values, not calc(1em+2px)
   Buttons, badges, and compact UI elements are intentionally excluded
   ================================================================ */

/* Core reading text */
.icare-patient-name  { font-size: 16px !important; }
.icare-patient-dx    { font-size: 14px !important; }
.icare-patient-plan  { font-size: 14px !important; }
.icare-patient-meta  { font-size: 13px !important; }

/* Form fields inside the edit/add patient modal */
.icare-modal-box .icare-input,
.icare-modal-box select.icare-input { font-size: 16px !important; }
.icare-modal-box label,
.icare-form-group > label           { font-size: 13px !important; }
.icare-form-group .icare-autoresize { font-size: 16px !important; }
/* contenteditable plan editor — must be >= 16px to prevent iOS/Android auto-zoom */
.icare-modal-box .icare-plan-rich,
.icsc-modal      .icare-plan-rich   { font-size: 16px !important; }

/* Shift header + info */
.icare-shift-info   { font-size: 15px !important; }

/* Stats panel numbers */
.icare-stat-number  { font-size: calc(var(--icare-stat-size, 2em) + 2px) !important; }

/* ICD-11 result titles */
.icare-icd11-result-title { font-size: 15px !important; }

/* Chat messages */
.icare-chat-text    { font-size: 15px !important; }
.icare-chat-system  { font-size: 13px !important; }

/* Search results */
.icare-search-result-name { font-size: 16px !important; }
.icare-search-result-dx   { font-size: 14px !important; }

/* ================================================================
   iOS auto-zoom prevention
   Safari zooms in when a focused input has font-size < 16px.
   Setting 16px on all interactive fields prevents this entirely.
   Buttons are excluded — they don't trigger zoom.
   ================================================================ */
.icare-input,
.icare-frontend-wrap input:not([type="submit"]):not([type="button"]):not([type="reset"]):not([type="checkbox"]):not([type="radio"]),
.icare-frontend-wrap textarea,
.icare-frontend-wrap select,
.icare-chat-input,
.icare-icd11-search,
.icare-search-input {
    font-size: 16px !important;   /* 16px minimum — prevents iOS Safari auto-zoom */
    -webkit-text-size-adjust: 100%;
}

/* Ensure touch-action on inputs kills 300ms double-tap delay without disabling zoom */
.icare-input,
.icare-chat-input {
    touch-action: manipulation;
}

/* ================================================================
   Chat — Pin, Search, Archive, Patient room enhancements
   ================================================================ */

/* Pinned room tab */
.icare-chat-room-tab.icare-chat-room-pinned {
    border-color: #F59E0B;
    color: #92400E;
    background: #FFFBEB;
}
.icare-chat-room-tab.icare-chat-room-active.icare-chat-room-pinned {
    background: #F59E0B;
    color: #fff;
    border-color: #F59E0B;
}

/* Archived room tab */
.icare-chat-room-tab.icare-chat-room-archived {
    opacity: .6;
    border-style: dashed;
}
.icare-chat-room-arc-toggle {
    border-style: dashed !important;
    color: #6B7280 !important;
    font-size: 10px !important;
}

/* Search button */
.icare-chat-room-search {
    background: #EEF2FF !important;
    color: #4338CA !important;
    border-color: #C7D2FE !important;
    font-size: 14px !important;
    padding: 4px 8px !important;
}

/* Search input row */
#icare-chat-search-row {
    padding: 6px 10px;
    background: #F9FAFB;
    border-bottom: 1px solid #E5E7EB;
    flex-shrink: 0;
}
#icare-chat-search-input {
    width: 100%;
    border: 1.5px solid #D1D5DB;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
}
#icare-chat-search-input:focus { border-color: #1a73e8; }

/* Archived rooms strip */
.icare-chat-archived-tabs {
    display: flex;
    overflow-x: auto;
    gap: 4px;
    padding: 4px 10px;
    background: #F3F4F6;
    border-bottom: 1px solid #E5E7EB;
    scrollbar-width: none;
}
.icare-chat-archived-tabs::-webkit-scrollbar { display: none; }

/* Patient chat button on patient card */
.icare-btn-chat {
    background: #EEF2FF;
    border-color: #C7D2FE;
    color: #4338CA;
    font-size: 13px !important;
    padding: 3px 8px !important;
}
.icare-btn-chat:hover { background: #C7D2FE; }

/* ================================================================
   Page Progress Bar — top-of-page loading indicator
   Appears on page load, animates to ~70%, completes when ready
   ================================================================ */
#icare-progress-bar {
    position:    fixed;
    top:         0;
    left:        0;
    width:       0%;
    height:      3px;
    background:  linear-gradient(90deg, #1a73e8 0%, #34d399 100%);
    z-index:     9999999; /* above everything */
    transition:  width .4s ease, opacity .3s ease;
    opacity:     1;
    border-radius: 0 2px 2px 0;
    pointer-events: none; /* never intercepts clicks */
    box-shadow:  0 0 8px rgba(26,115,232,.5);
}
#icare-progress-bar.icare-pb-done {
    width:   100% !important;
    opacity: 0;
    transition: width .2s ease, opacity .4s ease .15s;
}

/* ================================================================
   Chat room context menu (long-press → Pin / Archive / Cancel)
   ================================================================ */
#icare-chat-ctx-menu {
    position:      fixed;
    z-index:       1000010;
    background:    #fff;
    border-radius: 14px;
    box-shadow:    0 8px 32px rgba(0,0,0,.22);
    padding:       6px;
    min-width:     180px;
    animation:     icare-ctx-pop .15s cubic-bezier(.34,1.56,.64,1);
}
@keyframes icare-ctx-pop {
    from { opacity:0; transform: scale(.85); }
    to   { opacity:1; transform: scale(1); }
}
.icare-chat-ctx-title {
    font-size:   12px;
    font-weight: 700;
    color:       #6B7280;
    padding:     6px 12px 4px;
    border-bottom: 1px solid #F3F4F6;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow:    hidden;
    text-overflow: ellipsis;
    max-width:   200px;
}
.icare-chat-ctx-btn {
    display:        block;
    width:          100%;
    padding:        10px 14px;
    text-align:     left;
    background:     none;
    border:         none;
    border-radius:  10px;
    font-size:      14px;
    font-family:    inherit;
    cursor:         pointer;
    color:          #111827;
    touch-action:   manipulation;
    transition:     background .1s;
}
.icare-chat-ctx-btn:hover,
.icare-chat-ctx-btn:active { background: #F3F4F6; }
.icare-chat-ctx-cancel      { color: #EF4444; margin-top: 2px; border-top: 1px solid #F3F4F6; }

/* ================================================================
   Live Dashboard Refresh — flash indicator + card animations
   ================================================================ */

/* New patient card flash — green glow */
.icare-patient-row.icare-row-flash-new {
    animation: icare-flash-new 2.5s ease forwards;
}
@keyframes icare-flash-new {
    0%   { box-shadow: 0 0 0 3px rgba(52,211,153,0);   background: rgba(52,211,153,0); }
    15%  { box-shadow: 0 0 0 3px rgba(52,211,153,.6);  background: rgba(52,211,153,.08); }
    60%  { box-shadow: 0 0 0 3px rgba(52,211,153,.3);  background: rgba(52,211,153,.04); }
    100% { box-shadow: 0 0 0 3px rgba(52,211,153,0);   background: rgba(52,211,153,0); }
}

/* Changed patient card flash — blue glow */
.icare-patient-row.icare-row-flash-changed {
    animation: icare-flash-changed 2s ease forwards;
}
@keyframes icare-flash-changed {
    0%   { box-shadow: 0 0 0 2px rgba(26,115,232,0); }
    20%  { box-shadow: 0 0 0 2px rgba(26,115,232,.5); }
    100% { box-shadow: 0 0 0 2px rgba(26,115,232,0); }
}

/* Live refresh toast indicator */
#icare-live-indicator {
    position:        fixed;
    top:             16px;
    left:            50%;
    transform:       translateX(-50%) translateY(-60px);
    background:      #0B2D4E;
    color:           #fff;
    padding:         8px 20px;
    border-radius:   20px;
    font-size:       13px;
    font-weight:     600;
    z-index:         1000003;
    pointer-events:  none;
    transition:      transform .3s cubic-bezier(.34,1.56,.64,1), opacity .3s;
    opacity:         0;
    white-space:     nowrap;
    box-shadow:      0 4px 16px rgba(0,0,0,.25);
}
#icare-live-indicator.icare-live-indicator-show {
    transform: translateX(-50%) translateY(0);
    opacity:   1;
}

/* ================================================================
   ICD-11 Typeahead Dropdown
   Appears below the diagnosis textarea as the doctor types
   ================================================================ */
#icare-icd11-dropdown {
    position:        absolute;
    z-index:         10001;
    background:      #fff;
    border:          1.5px solid #1a73e8;
    border-radius:   0 0 12px 12px;
    box-shadow:      0 8px 32px rgba(0,0,0,.18);
    width:           100%;
    max-height:      320px;
    overflow-y:      auto;
    margin-top:      -2px;
    -webkit-overflow-scrolling: touch;
}
/* Ensure the diagnosis field container is positioned */
#icare-f-dx {
    border-bottom-left-radius:  0;
    border-bottom-right-radius: 0;
}
#icare-f-dx:focus ~ #icare-icd11-dropdown,
#icare-icd11-dropdown:hover {
    display: block;
}
.icare-icd11-dd-row {
    display:      flex;
    align-items:  center;
    gap:          8px;
    padding:      10px 14px;
    cursor:       pointer;
    border-bottom: 1px solid #F3F4F6;
    transition:   background .1s;
    touch-action: manipulation;
}
.icare-icd11-dd-row:last-of-type { border-bottom: none; }
.icare-icd11-dd-row:hover,
.icare-icd11-dd-row:active        { background: #EEF6FF; }
.icare-icd11-dd-row-selected      { background: #F0FDF4; }
.icare-icd11-dd-row-selected:hover { background: #DCFCE7; }
.icare-dd-code {
    font-size:   11px;
    font-weight: 700;
    color:       #1a73e8;
    background:  #EEF2FF;
    border-radius: 4px;
    padding:     2px 6px;
    white-space: nowrap;
    flex-shrink: 0;
}
.icare-dd-title {
    flex:        1;
    font-size:   14px;
    color:       #111827;
    line-height: 1.3;
}
.icare-dd-icd10 {
    font-size:   11px;
    color:       #6B7280;
    white-space: nowrap;
    flex-shrink: 0;
}
.icare-dd-sel {
    font-size:   16px;
    font-weight: 700;
    color:       #9CA3AF;
    flex-shrink: 0;
    width:       20px;
    text-align:  center;
}
.icare-icd11-dd-row-selected .icare-dd-sel { color: #16a34a; }
.icare-dd-footer {
    padding:     8px 14px;
    font-size:   11px;
    color:       #9CA3AF;
    background:  #F9FAFB;
    border-top:  1px solid #E5E7EB;
    border-radius: 0 0 10px 10px;
    display:     flex;
    gap:         6px;
    align-items: center;
}
/* Hide the Suggest button — typeahead makes it redundant */
#icare-icd11-suggest-btn { display: none !important; }

/* Wrap the textarea in a relative container so dropdown positions correctly */
.icare-icd11-wrap {
    position: relative;
}

/* ================================================================
   Chat — WhatsApp-style room list + chat room navigation
   ================================================================ */

/* Panel now taller to accommodate the room list */
.icare-chat-panel {
    height:     520px;
    max-height: calc(100vh - 160px);
}

/* Views — slide animation */
.icare-chat-view { display: flex; flex-direction: column; height: 100%; }
.icare-chat-view-rooms { background: #fff; }
.icare-chat-view-room  { background: #fff; }

/* Back button */
.icare-chat-back-btn {
    background:  none;
    border:      none;
    font-size:   22px;
    font-weight: 700;
    color:       #fff;
    cursor:      pointer;
    padding:     0 8px 0 0;
    line-height: 1;
    touch-action: manipulation;
    flex-shrink: 0;
}
.icare-chat-back-btn:hover { opacity: .8; }

/* Room search bar */
.icare-chat-room-search-bar {
    padding:    8px 10px;
    background: #F0F4F8;
    flex-shrink: 0;
}
.icare-chat-room-search-bar input {
    width:        100%;
    border:       1.5px solid #D1D5DB;
    border-radius: 20px;
    padding:      6px 14px;
    font-size:    14px;
    font-family:  inherit;
    background:   #fff;
    outline:      none;
}
.icare-chat-room-search-bar input:focus { border-color: #1a73e8; }

/* Room list container */
.icare-chat-room-list {
    flex:       1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Each room row */
.icare-chat-room-row {
    display:      flex;
    align-items:  center;
    gap:          10px;
    padding:      12px 14px;
    cursor:       pointer;
    border-bottom: 1px solid #F3F4F6;
    transition:   background .1s;
    touch-action: manipulation;
    user-select:  none;
}
.icare-chat-room-row:hover,
.icare-chat-room-row:active  { background: #F0F4FF; }
.icare-room-row-active       { background: #EEF2FF; }
.icare-room-row-pinned       { background: #FFFBEB; }

.icare-room-row-icon {
    font-size:   24px;
    flex-shrink: 0;
    width:       40px;
    height:      40px;
    display:     flex;
    align-items: center;
    justify-content: center;
    background:  #F3F4F6;
    border-radius: 50%;
}
.icare-room-row-body {
    flex:       1;
    min-width:  0;
}
.icare-room-row-top {
    display:     flex;
    align-items: center;
    gap:         4px;
    margin-bottom: 2px;
}
.icare-room-row-name {
    font-weight: 600;
    font-size:   14px;
    color:       #111827;
    flex:        1;
    white-space: nowrap;
    overflow:    hidden;
    text-overflow: ellipsis;
}
.icare-room-row-pin   { font-size: 12px; flex-shrink: 0; }
.icare-room-row-time  { font-size: 11px; color: #9CA3AF; flex-shrink: 0; }
.icare-room-row-preview {
    font-size:   13px;
    color:       #6B7280;
    white-space: nowrap;
    overflow:    hidden;
    text-overflow: ellipsis;
}
.icare-room-row-arrow {
    font-size:   20px;
    color:       #D1D5DB;
    flex-shrink: 0;
}

/* Archived section header */
.icare-chat-archived-header {
    padding:     10px 14px;
    font-size:   12px;
    font-weight: 600;
    color:       #6B7280;
    background:  #F9FAFB;
    border-top:  1px solid #E5E7EB;
    cursor:      pointer;
}
.icare-chat-archived-header:hover { background: #F3F4F6; }

/* New room FAB in header */
#icare-chat-new-room-fab {
    font-size:   20px;
    font-weight: 700;
    background:  rgba(255,255,255,.15);
    border:      none;
    color:       #fff;
    border-radius: 50%;
    width:       30px;
    height:      30px;
    display:     flex;
    align-items: center;
    justify-content: center;
    cursor:      pointer;
    touch-action: manipulation;
}
#icare-chat-new-room-fab:hover { background: rgba(255,255,255,.25); }

/* Patient tag in system messages — tappable */
.icare-chat-patient-tag {
    display:      inline-block;
    background:   #1a73e8;
    color:        #fff;
    border-radius: 10px;
    padding:      2px 8px;
    font-size:    11px;
    font-weight:  600;
    cursor:       pointer;
    margin-left:  4px;
    touch-action: manipulation;
}
.icare-chat-patient-tag:hover { background: #1557B0; }

/* Empty state */
.icare-chat-empty {
    padding:    30px 20px;
    text-align: center;
    color:      #9CA3AF;
    font-size:  14px;
}

/* Mobile: full width panel */
@media (max-width: 480px) {
    .icare-chat-panel {
        width:         calc(100vw - 16px) !important;
        right:         8px !important;
        height:        70vh !important;
        max-height:    70vh !important;
        border-radius: 16px !important;
    }
}

/* ================================================================
   Inline new room form
   ================================================================ */
.icare-new-room-form {
    background:  #F0F4F8;
    padding:     12px 12px 14px;
    border-bottom: 2px solid #1a73e8;
}
.icare-new-room-tag-row {
    display:     flex;
    gap:         6px;
    flex-wrap:   wrap;
    margin-bottom: 10px;
}
.icare-room-tag-btn {
    border:       1.5px solid #D1D5DB;
    border-radius: 20px;
    padding:      4px 10px;
    font-size:    12px;
    font-family:  inherit;
    background:   #fff;
    color:        #374151;
    cursor:       pointer;
    touch-action: manipulation;
    transition:   all .15s;
    white-space:  nowrap;
}
.icare-room-tag-btn:hover { border-color: #1a73e8; color: #1a73e8; }
.icare-room-tag-btn.active {
    background:  #1a73e8;
    border-color: #1a73e8;
    color:        #fff;
    font-weight:  600;
}
.icare-new-room-input-row {
    display:  flex;
    gap:      6px;
    align-items: center;
}
.icare-new-room-name {
    flex:         1;
    border:       1.5px solid #D1D5DB;
    border-radius: 10px;
    padding:      8px 12px;
    font-size:    14px;
    font-family:  inherit;
    outline:      none;
    min-width:    0;
}
.icare-new-room-name:focus { border-color: #1a73e8; }
.icare-new-room-submit {
    background:   #1a73e8;
    color:        #fff;
    border:       none;
    border-radius: 10px;
    padding:      8px 14px;
    font-size:    13px;
    font-weight:  600;
    font-family:  inherit;
    cursor:       pointer;
    white-space:  nowrap;
    touch-action: manipulation;
    flex-shrink:  0;
}
.icare-new-room-submit:hover { background: #1557B0; }
.icare-new-room-submit:disabled { opacity: .6; }
.icare-new-room-cancel {
    background:  none;
    border:      none;
    color:       #9CA3AF;
    font-size:   18px;
    cursor:      pointer;
    padding:     4px;
    flex-shrink: 0;
    touch-action: manipulation;
}
.icare-new-room-cancel:hover { color: #EF4444; }

/* ================================================================
   Settings Page (scoped to avoid affecting patient cards)
   ================================================================ */
.icare-settings-wrap { max-width:540px; margin:0 auto; padding:20px 16px 100px; }
.icare-settings-title { font-size:22px; font-weight:700; color:#0B2D4E; margin-bottom:20px; }
.icare-settings-section { background:#fff; border:1px solid #E5E7EB; border-radius:14px; padding:16px; margin-bottom:16px; }
.icare-settings-section-title { font-size:12px; font-weight:700; color:#6B7280; text-transform:uppercase; letter-spacing:.5px; margin-bottom:14px; }
.icare-settings-info-row { display:flex; justify-content:space-between; padding:8px 0; border-bottom:1px solid #F3F4F6; font-size:14px; }
.icare-settings-info-row:last-child { border-bottom:none; }
.icare-settings-info-row span:first-child { color:#6B7280; }
.icare-settings-info-row span:last-child { font-weight:600; color:#111827; }
.icare-settings-privacy-text { font-size:13px; color:#6B7280; line-height:1.6; margin:0 0 10px; }

/* Font size picker — scoped to settings page ONLY */
.icare-settings-wrap .icare-font-size-picker { display:flex; gap:10px; }
.icare-settings-wrap .icare-font-btn {
    flex:1; border:1.5px solid #D1D5DB; border-radius:10px; padding:10px 8px;
    background:#fff; cursor:pointer; font-family:inherit;
    display:flex; flex-direction:column; align-items:center; gap:4px;
    transition:all .15s; touch-action:manipulation;
}
.icare-settings-wrap .icare-font-btn:nth-child(1) { font-size:14px; }
.icare-settings-wrap .icare-font-btn:nth-child(2) { font-size:18px; }
.icare-settings-wrap .icare-font-btn:nth-child(3) { font-size:22px; }
.icare-settings-wrap .icare-font-btn small { font-size:10px; color:#6B7280; font-weight:400; }
.icare-settings-wrap .icare-font-btn.active { border-color:#1a73e8; background:#EEF2FF; color:#1a73e8; }
.icare-settings-wrap .icare-font-btn.active small { color:#1a73e8; }

/* Font size classes for main dashboard */
.icare-font-large .icare-patient-name { font-size:18px !important; }
.icare-font-large .icare-patient-dx   { font-size:15px !important; }
.icare-font-small .icare-patient-name { font-size:13px !important; }
.icare-font-small .icare-patient-dx   { font-size:11px !important; }

/* Hospital Alert picker */
.icare-alert-picker-overlay { position:fixed; inset:0; background:rgba(0,0,0,.5); z-index:1000010; display:flex; align-items:center; justify-content:center; padding:20px; }
.icare-alert-picker { background:#fff; border-radius:18px; padding:24px; width:100%; max-width:360px; box-shadow:0 20px 60px rgba(0,0,0,.3); }
.icare-alert-picker-title { font-size:18px; font-weight:700; color:#0B2D4E; margin-bottom:6px; }
.icare-alert-picker-sub { font-size:13px; color:#6B7280; margin-bottom:16px; }
.icare-alert-type-btn { display:block; width:100%; padding:12px 16px; margin-bottom:8px; border:1.5px solid #E5E7EB; border-radius:10px; background:#fff; font-size:14px; font-family:inherit; font-weight:600; text-align:left; cursor:pointer; touch-action:manipulation; transition:background .1s; }
.icare-alert-type-btn:hover { background:#FEF2F2; border-color:#EF4444; }
.icare-alert-cancel-btn { display:block; width:100%; padding:10px; border:none; background:none; color:#6B7280; font-size:14px; font-family:inherit; cursor:pointer; }
.icare-chat-alert-msg { background:#FEF2F2!important; border:2px solid #EF4444!important; color:#991B1B!important; font-weight:700!important; border-radius:10px; padding:10px 14px; margin:8px 0; text-align:center; }
#icare-chat-alert-btn { font-size:16px; }

/* ================================================================
   Font size classes — 6 levels, applied via PHP class on .icare-frontend-wrap
   ================================================================ */
.icare-font-xs  { font-size: 11px; }
.icare-font-sm  { font-size: 13px; }
.icare-font-medium { font-size: 15px; }
.icare-font-lg  { font-size: 17px; }
.icare-font-xl  { font-size: 19px; }
.icare-font-xxl { font-size: 21px; }

.icare-font-xs  .icare-patient-name { font-size: 12px !important; }
.icare-font-sm  .icare-patient-name { font-size: 14px !important; }
.icare-font-medium .icare-patient-name { font-size: 16px !important; }
.icare-font-lg  .icare-patient-name { font-size: 18px !important; }
.icare-font-xl  .icare-patient-name { font-size: 20px !important; }
.icare-font-xxl .icare-patient-name { font-size: 22px !important; }

/* Settings font btn sizes - scoped */
.icare-settings-wrap .icare-font-btn:nth-child(1) { font-size: 10px; }
.icare-settings-wrap .icare-font-btn:nth-child(2) { font-size: 12px; }
.icare-settings-wrap .icare-font-btn:nth-child(3) { font-size: 14px; }
.icare-settings-wrap .icare-font-btn:nth-child(4) { font-size: 16px; }
.icare-settings-wrap .icare-font-btn:nth-child(5) { font-size: 18px; }
.icare-settings-wrap .icare-font-btn:nth-child(6) { font-size: 20px; }

/* ================================================================
   Chat image upload button
   ================================================================ */
.icare-chat-img-btn {
    display:      flex;
    align-items:  center;
    justify-content: center;
    width:        36px;
    height:       36px;
    font-size:    18px;
    cursor:       pointer;
    flex-shrink:  0;
    border-radius: 50%;
    background:   transparent;
    border:       none;
    touch-action: manipulation;
    transition:   background .15s;
    user-select:  none;
}
.icare-chat-img-btn:hover { background: rgba(255,255,255,.15); }

/* Chat image thumbnail in message */
.icare-chat-img-thumb {
    max-width:    200px;
    max-height:   160px;
    border-radius: 10px;
    margin-top:   6px;
    cursor:       pointer;
    display:      block;
    object-fit:   cover;
    border:       2px solid rgba(255,255,255,.3);
    transition:   opacity .15s;
}
.icare-chat-img-thumb:hover { opacity: .85; }

/* Alert button in header */
#icare-chat-alert-btn {
    font-size:   16px;
    background:  rgba(239,68,68,.15);
    border-radius: 6px;
    padding:     2px 6px;
}
#icare-chat-alert-btn:hover { background: rgba(239,68,68,.3); }

/* ================================================================
   Alert picker — improved with message field and send button
   ================================================================ */
.icare-alert-type-row {
    display:   flex;
    flex-direction: column;
    gap:       6px;
    max-height: 220px;
    overflow-y: auto;
    margin-bottom: 12px;
}
.icare-alert-type-btn.selected {
    background:   #FEF2F2;
    border-color: #EF4444;
    color:        #991B1B;
}
.icare-alert-msg-label {
    font-size:   12px;
    font-weight: 600;
    color:       #6B7280;
    margin-bottom: 4px;
}
.icare-alert-msg-input {
    width:        100%;
    border:       1.5px solid #D1D5DB;
    border-radius: 8px;
    padding:      8px 10px;
    font-size:    14px;
    font-family:  inherit;
    resize:       vertical;
    outline:      none;
    margin-bottom: 12px;
    box-sizing:   border-box;
}
.icare-alert-msg-input:focus { border-color: #EF4444; }
.icare-alert-send-btn {
    display:      block;
    width:        100%;
    padding:      12px;
    background:   #EF4444;
    color:        #fff;
    border:       none;
    border-radius: 10px;
    font-size:    15px;
    font-weight:  700;
    font-family:  inherit;
    cursor:       pointer;
    touch-action: manipulation;
    transition:   background .15s;
}
.icare-alert-send-btn:hover:not(:disabled) { background: #DC2626; }
.icare-alert-send-btn:disabled {
    background: #D1D5DB;
    cursor:     not-allowed;
}

/* Alert button in header — always visible inline */
#icare-chat-alert-btn {
    display:       none; /* shown via JS for admins/specialists */
    align-items:   center;
    justify-content: center;
    background:    rgba(239,68,68,.2);
    border-radius: 8px;
    font-size:     16px;
    padding:       2px 7px;
    border:        1.5px solid rgba(239,68,68,.4);
}
#icare-chat-alert-btn:hover { background: rgba(239,68,68,.4); }

/* ================================================================
   Chat Room Row — Swipe-left to reveal action buttons
   ================================================================ */

/* Row is the clipping container */
.icare-chat-room-row {
    position:   relative;
    overflow:   hidden;
    /* remove old direct padding — content layer has it now */
    padding:    0 !important;
    border-bottom: 1px solid #F3F4F6;
}
.icare-chat-room-row:last-of-type { border-bottom: none; }

/* Swipeable content layer */
.icare-room-row-content {
    display:      flex;
    align-items:  center;
    gap:          10px;
    padding:      12px 14px;
    background:   #fff;
    position:     relative;
    z-index:      2;
    transform:    translateX(0);
    transition:   transform 0.2s ease;
    cursor:       pointer;
    /* preserve existing hover */
}
.icare-chat-room-row:hover      .icare-room-row-content { background: #F0F4FF; }
.icare-room-row-pinned          .icare-room-row-content { background: #FFFBEB; }
.icare-room-row-active          .icare-room-row-content { background: #EEF2FF; }
.icare-row-swiped               .icare-room-row-content { background: #F8FAFC; }

/* Action buttons — sit behind the content layer on the right */
.icare-room-row-actions {
    position:   absolute;
    right:      0;
    top:        0;
    bottom:     0;
    display:    flex;
    align-items: stretch;
    z-index:    1;
}

.icare-row-act-btn {
    display:        flex;
    flex-direction: column;
    align-items:    center;
    justify-content: center;
    gap:            3px;
    width:          60px;
    border:         none;
    cursor:         pointer;
    font-size:      18px;
    font-family:    inherit;
    touch-action:   manipulation;
    transition:     filter 0.15s;
}
.icare-row-act-btn span {
    font-size:  10px;
    font-weight: 600;
    letter-spacing: -.2px;
}
.icare-row-act-btn:hover { filter: brightness(.88); }
.icare-row-act-btn:active { filter: brightness(.78); }

.icare-row-act-archive { background: #3B82F6; color: #fff; }
.icare-row-act-edit    { background: #F59E0B; color: #fff; }
.icare-row-act-delete  { background: #EF4444; color: #fff; }

/* Chat row — ensure action buttons are hidden behind content until swiped */
.icare-room-row-content {
    width:       100% !important;
    min-width:   100% !important;
    flex-shrink: 0;
}
.icare-room-row-actions {
    /* Prevent showing through when not swiped */
    pointer-events: none;
}
.icare-row-swiped .icare-room-row-actions {
    pointer-events: auto;
}

/* ================================================================
   Push to EMOT — ED Dashboard button
   ================================================================ */
.icare-btn-push-ot {
    background:    #DC2626;
    color:         #fff;
    border:        none;
    font-weight:   700;
    animation:     icare-ot-pulse 2s ease infinite;
}
.icare-btn-push-ot:hover { background: #B91C1C; }
@keyframes icare-ot-pulse {
    0%,100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
    50%      { box-shadow: 0 0 0 4px rgba(220,38,38,.25); }
}
.icare-btn-ot-pushed {
    background:  #D1FAE5;
    color:       #065F46;
    border:      1px solid #6EE7B7;
    cursor:      default;
}

/* ================================================================
   Pending-Op panel in OT Management page
   ================================================================ */
.icare-ot-pending-op-panel {
    background:    #FFF7ED;
    border:        2px solid #F97316;
    border-radius: 12px;
    margin:        16px 0 20px;
    padding:       14px 16px;
}
.icare-ot-pending-op-title {
    font-size:   14px;
    font-weight: 700;
    color:       #C2410C;
    margin-bottom: 10px;
}
.icare-ot-pendop-row {
    display:      flex;
    align-items:  center;
    gap:          10px;
    padding:      8px 0;
    border-bottom: 1px solid #FED7AA;
}
.icare-ot-pendop-row:last-child { border-bottom: none; }
.icare-ot-pendop-row.icare-ot-pushed { opacity: .55; }
.icare-ot-pendop-info {
    flex:    1;
    min-width: 0;
}
.icare-ot-pendop-name {
    display:     block;
    font-weight: 600;
    font-size:   14px;
    color:       #111827;
}
.icare-ot-pendop-meta {
    display:   block;
    font-size: 12px;
    color:     #6B7280;
    white-space: nowrap;
    overflow:  hidden;
    text-overflow: ellipsis;
}

/* ================================================================
   OT Type Picker Modal
   ================================================================ */
.icare-ot-picker-overlay {
    position:   fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index:    1000020;
    display:    flex;
    align-items: center;
    justify-content: center;
    padding:    20px;
}
.icare-ot-picker-box {
    background:   #fff;
    border-radius: 18px;
    padding:      24px;
    width:        100%;
    max-width:    340px;
    box-shadow:   0 20px 60px rgba(0,0,0,.3);
}
.icare-ot-picker-title {
    font-size:   18px;
    font-weight: 700;
    color:       #0B2D4E;
    margin-bottom: 4px;
}
.icare-ot-picker-patient {
    font-size:   14px;
    font-weight: 600;
    color:       #1a73e8;
    margin-bottom: 4px;
}
.icare-ot-picker-subtitle {
    font-size:   12px;
    color:       #6B7280;
    margin-bottom: 14px;
}
.icare-ot-type-row {
    display:       flex;
    align-items:   center;
    justify-content: space-between;
    width:         100%;
    padding:       12px 14px;
    margin-bottom: 8px;
    border:        1.5px solid #E5E7EB;
    border-radius: 10px;
    background:    #fff;
    font-family:   inherit;
    cursor:        pointer;
    text-align:    left;
    touch-action:  manipulation;
    transition:    all .15s;
}
.icare-ot-type-row:hover { border-color: #1a73e8; background: #EEF2FF; }
.icare-ot-type-label {
    font-size:   15px;
    font-weight: 600;
    color:       #111827;
}
.icare-ot-type-desc {
    font-size:  12px;
    color:      #9CA3AF;
}
.icare-ot-type-other { border-style: dashed; }
.icare-ot-type-other:hover { border-color: #F59E0B; background: #FFFBEB; }
.icare-ot-picker-cancel {
    display:    block;
    width:      100%;
    padding:    10px;
    border:     none;
    background: none;
    color:      #9CA3AF;
    font-size:  14px;
    font-family: inherit;
    cursor:     pointer;
    margin-top: 4px;
    touch-action: manipulation;
}


/* ================================================================
   Rich-Text Plan Toolbar
   ================================================================ */
.icare-plan-editor { display: flex; flex-direction: column; gap: 0; width: 100%; }
.icare-plan-toolbar {
    display:     flex;
    align-items: center;
    gap:         2px;
    background:  #F9FAFB;
    border:      1.5px solid #E5E7EB;
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    padding:     5px 8px;
    flex-wrap:   wrap;
}
.icare-plan-toolbar .icare-pt-btn {
    background:  none;
    border:      1.5px solid transparent;
    border-radius: 5px;
    padding:     3px 7px;
    font-size:   13px;
    font-family: inherit;
    cursor:      pointer;
    color:       #374151;
    line-height: 1.4;
    min-width:   28px;
    text-align:  center;
    transition:  all .15s;
    touch-action: manipulation;
}
.icare-plan-toolbar .icare-pt-btn:hover  { background: #E5E7EB; border-color: #D1D5DB; }
.icare-plan-toolbar .icare-pt-btn.active { background: #EEF2FF; border-color: #6366F1; color: #4338CA; }
.icare-plan-toolbar .icare-pt-sep { width: 1px; height: 18px; background: #D1D5DB; margin: 0 4px; flex-shrink: 0; }
.icare-plan-toolbar .icare-pt-color {
    width:  18px; height: 18px;
    border-radius: 50%;
    border:  2px solid transparent;
    cursor:  pointer;
    padding: 0;
    flex-shrink: 0;
    transition: transform .15s, box-shadow .15s;
}
.icare-plan-toolbar .icare-pt-color:hover { transform: scale(1.2); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.icare-plan-toolbar .icare-pt-color.active { border-color: #111; transform: scale(1.15); }
.icare-plan-toolbar .icare-pt-sign {
    margin-left: auto;
    font-size:   11px;
    padding:     3px 8px;
    background:  #F0FDF4;
    border:      1.5px solid #BBF7D0;
    border-radius: 5px;
    color:       #15803D;
    font-weight: 600;
    cursor:      pointer;
    transition:  all .15s;
}
.icare-plan-toolbar .icare-pt-sign:hover { background: #DCFCE7; }

.icare-plan-rich {
    min-height:  90px;
    max-height:  220px;
    overflow-y:  auto;
    border:      1.5px solid #E5E7EB;
    border-radius: 0 0 8px 8px;
    padding:     10px 12px;
    font-size:   14px;
    line-height: 1.6;
    color:       #1F2937;
    background:  #fff;
    outline:     none;
    -webkit-overflow-scrolling: touch;
    word-break:  break-word;
}
.icare-plan-rich:focus { border-color: #1a73e8; box-shadow: 0 0 0 2px rgba(26,115,232,.1); }
.icare-plan-rich:empty::before {
    content:     attr(data-placeholder);
    color:       #9CA3AF;
    font-style:  italic;
    pointer-events: none;
}

/* Plan display in patient row — allow inline styling from rich text */
.icare-patient-plan { line-height: 1.55; color: var(--ic-text2); }
.icare-patient-plan strong, .icare-patient-plan b { font-weight: 700; }
.icare-patient-plan em, .icare-patient-plan i     { font-style: italic; }
.icare-patient-plan s, .icare-patient-plan del, .icare-patient-plan strike { text-decoration: line-through; }
/* Inline colour from rich-text plan: inline styles already beat class rules in
   CSS specificity (1,0,0,0 vs 0,1,0,0). The colour is preserved because:
   (a) JS converts rgb() → hex before saving so wp_kses can pass it through,
   (b) PHP safe_style_css filter explicitly allows 'color'.
   No !important hacks needed — the cascade works correctly. */
.icare-patient-plan font[color] { color: attr(color); }

/* ================================================================
   Font-size scaling — extended to IC, contact, diagnosis, plan
   (existing name rules stay; we ADD meta, dx, plan, time below)
   ================================================================ */
.icare-font-xs   .icare-patient-meta  { font-size: 10px !important; }
.icare-font-sm   .icare-patient-meta  { font-size: 11px !important; }
.icare-font-medium .icare-patient-meta { font-size: 12px !important; }
.icare-font-lg   .icare-patient-meta  { font-size: 13px !important; }
.icare-font-xl   .icare-patient-meta  { font-size: 14px !important; }
.icare-font-xxl  .icare-patient-meta  { font-size: 15px !important; }

.icare-font-xs   .icare-patient-dx    { font-size: 10px !important; }
.icare-font-sm   .icare-patient-dx    { font-size: 11px !important; }
.icare-font-medium .icare-patient-dx  { font-size: 12px !important; }
.icare-font-lg   .icare-patient-dx    { font-size: 13px !important; }
.icare-font-xl   .icare-patient-dx    { font-size: 14px !important; }
.icare-font-xxl  .icare-patient-dx    { font-size: 15px !important; }

.icare-font-xs   .icare-patient-plan  { font-size: 10px !important; }
.icare-font-sm   .icare-patient-plan  { font-size: 11px !important; }
.icare-font-medium .icare-patient-plan { font-size: 12px !important; }
.icare-font-lg   .icare-patient-plan  { font-size: 13px !important; }
.icare-font-xl   .icare-patient-plan  { font-size: 14px !important; }
.icare-font-xxl  .icare-patient-plan  { font-size: 15px !important; }

.icare-font-xs   .icare-patient-time  { font-size: 10px !important; }
.icare-font-sm   .icare-patient-time  { font-size: 11px !important; }
.icare-font-medium .icare-patient-time { font-size: 12px !important; }
.icare-font-lg   .icare-patient-time  { font-size: 13px !important; }
.icare-font-xl   .icare-patient-time  { font-size: 14px !important; }
.icare-font-xxl  .icare-patient-time  { font-size: 15px !important; }

/* ================================================================
   User Settings — Security section
   ================================================================ */
.icare-security-note {
    font-size:   12px;
    color:       #6B7280;
    margin:      -4px 0 8px;
    font-style:  italic;
}

/* ================================================================
   Export & Team modals — intentionally higher z-index than patient
   modal (100000) so they always render on top even if patient card
   is open when user clicks Export / Edit Team.
   ================================================================ */
#icare-export-modal,
#icare-team-modal {
    z-index: 100020 !important;
}

/* ================================================================
   ICD-11 Auto-suggest AI badge
   ================================================================ */
.icare-icd11-chip--ai {
    border-color:    #6366F1;
    background:      #EEF2FF;
}
.icare-icd11-ai-badge {
    display:         inline-flex;
    align-items:     center;
    gap:             3px;
    font-size:       10px;
    font-weight:     700;
    color:           #4338CA;
    background:      #E0E7FF;
    border-radius:   4px;
    padding:         1px 5px;
    margin-right:    5px;
    letter-spacing:  .2px;
    flex-shrink:     0;
}
.icare-icd11-ai-hint {
    font-size:   12px;
    color:       #6366F1;
    font-style:  italic;
    font-weight: 500;
    padding:     6px 10px;
    background:  #EEF2FF;
    border-radius: 6px;
    margin-bottom: 6px;
}
