/* =============================================================
   HOS10 Modern Theme
   Apple-inspired clean UI for the HOS10 management system.
   ============================================================= */

/* --- CSS Variables --- */
:root {
    --hos-primary: #0071e3;
    --hos-primary-dark: #0058b0;
    --hos-surface: #f5f5f7;
    --hos-card: #ffffff;
    --hos-text: #1d1d1f;
    --hos-text-secondary: #86868b;
    --hos-text-tertiary: #6e6e73;
    --hos-border: #d2d2d7;
    --hos-border-light: #e8e8ed;
    --hos-nav-height: 56px;
    --hos-nav-bg: rgba(255, 255, 255, 0.82);
    --hos-radius: 12px;
    --hos-radius-lg: 14px;
    --hos-radius-sm: 8px;
    --hos-danger: #ff3b30;
    --hos-success: #34c759;
    --hos-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --hos-font-mono: "SF Mono", "Menlo", "Consolas", monospace;
}


/* =============================================================
   1. Base & Old-Style Overrides
   ============================================================= */

body, html {
    background-color: var(--hos-surface) !important;
    font-family: var(--hos-font);
    color: var(--hos-text);
}

/* Override old SiteV2 h2 global rule */
h2 {
    font-size: inherit;
    color: inherit;
    margin: 0;
    padding: 0;
    border: none;
}

/* Override old SiteV2 h3 global rule */
h3 {
    font-size: inherit;
    color: inherit;
    background-color: transparent;
    margin: 0;
    padding: 0;
    display: block;
}

/* Override old SiteV2 input/select margin */
.hos-navbar input,
.hos-navbar select,
.ci-filter-card input,
.ci-filter-card select,
.hos-dashboard input,
.hos-dashboard select {
    margin-left: 0;
    margin-right: 0;
}

/* Override warpper */
.warpper {
    padding-top: 0 !important;
    background-color: transparent !important;
}

/* Hide old top bar */
.top_bar {
    display: none !important;
}

/* Override old main_content constraints */
.hos-main .main_content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px 40px;
    min-width: auto;
    display: block;
    text-align: left;
}

/* Override old .page > * for pagination children */
.ci-pagination .page > * {
    padding: 0;
}

/* Override case_row bg from SiteV2 */
.ci-case-card.case_row:nth-child(even) {
    background-color: #fff;
}
.ci-case-card.case_row:hover,
.ci-case-card.case_row.hover {
    background-color: #fff;
}


/* =============================================================
   2. Top Navbar
   ============================================================= */

.hos-navbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--hos-nav-height);
    background: var(--hos-nav-bg);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-bottom: 1px solid var(--hos-border);
    z-index: 1000;
    display: flex;
    align-items: center;
    padding: 0 24px;
}

.hos-navbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--hos-text);
    font-weight: 600;
    font-size: 1.1rem;
    flex-shrink: 0;
}
.hos-navbar-brand:hover { text-decoration: none; color: var(--hos-text); }

.hos-brand-logo {
    width: 32px; height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.hos-brand-logo img { width: 100%; height: 100%; object-fit: cover; }

.hos-nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 32px;
    list-style: none;
    padding: 0;
    margin-top: 0;
    margin-bottom: 0;
    flex-wrap: nowrap;
    overflow-x: auto;
}
.hos-nav-links li {
    display: inline-flex;
    align-items: center;
    height: auto;
    line-height: normal;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    color: inherit;
    vertical-align: middle;
    flex-shrink: 0;
}
.hos-nav-links li a,
.hos-nav-links li span {
    display: inline-flex;
    align-items: center;
    padding: 6px 14px;
    border-radius: var(--hos-radius-sm);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--hos-text-secondary);
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
    white-space: nowrap;
}
.hos-nav-links li a:hover {
    background: rgba(0,0,0,0.05);
    color: var(--hos-text);
    text-decoration: none;
}
.hos-nav-links li.active,
.hos-nav-links li.active:hover {
    background: none;
    border: none;
    border-bottom: none;
}
.hos-nav-links li.active a,
.hos-nav-links li.active span {
    background: rgba(0,113,227,0.1);
    color: var(--hos-primary);
    font-weight: 600;
}

/* Divider between page-local and global nav items */
.hos-nav-divider {
    width: 1px;
    height: 20px;
    background: var(--hos-border);
    margin: 0 8px;
    flex-shrink: 0;
}

.hos-nav-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 12px;
}
.hos-nav-right-link {
    color: var(--hos-text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 0.15s, color 0.15s;
}
.hos-nav-right-link:hover {
    background: var(--hos-surface);
    color: var(--hos-text);
    text-decoration: none;
}

/* Hamburger button (mobile only) */
.hos-hamburger {
    display: none;
    align-items: center;
    justify-content: center;
    margin-left: auto;
    width: 36px;
    height: 36px;
    border: none;
    background: none;
    color: var(--hos-text);
    font-size: 18px;
    cursor: pointer;
    border-radius: var(--hos-radius-sm);
}
.hos-hamburger:hover {
    background: rgba(0,0,0,0.05);
}

/* Mobile dropdown menu */
.hos-mobile-menu {
    display: none;
    position: absolute;
    top: var(--hos-nav-height);
    left: 0;
    right: 0;
    background: #fff;
    border-bottom: 1px solid var(--hos-border);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    z-index: 999;
    padding: 8px 0;
}
.hos-mobile-menu.open {
    display: block;
}
.hos-mobile-menu-section {
    padding: 8px 0;
}
.hos-mobile-menu-section a {
    display: block;
    padding: 10px 24px;
    color: var(--hos-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
}
.hos-mobile-menu-section a:hover {
    background: var(--hos-surface);
}

/* Calendar responsive */
#calendar { max-width: 100%; overflow-x: auto; }
.ui-dialog { max-width: calc(100vw - 20px) !important; }
.ui-dialog .ui-dialog-content { max-height: 80vh; overflow-y: auto; }

.hos-user-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px 4px 6px;
    border-radius: 20px;
    background: rgba(0,0,0,0.04);
    font-size: 0.82rem;
    color: var(--hos-text);
    text-decoration: none;
    font-weight: 500;
}
.hos-user-chip:hover { background: rgba(0,0,0,0.08); text-decoration: none; color: var(--hos-text); }

.hos-user-avatar {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--hos-primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
}

.hos-btn-logout {
    font-size: 0.8rem;
    color: var(--hos-text-secondary);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: 6px;
    transition: background 0.2s;
}
.hos-btn-logout:hover { background: rgba(0,0,0,0.05); color: var(--hos-text); text-decoration: none; }


/* --- Main content area --- */
.hos-main {
    padding-top: calc(var(--hos-nav-height) + 24px);
    min-height: 100vh;
}

/* For _Layoutfile (no main_content wrapper) */
.hos-main-file {
    padding-top: calc(var(--hos-nav-height) + 16px);
    min-height: 100vh;
}


/* =============================================================
   3. Home Dashboard
   ============================================================= */

.hos-dashboard {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 0 60px;
}

.hos-welcome { margin-bottom: 32px; }
.hos-welcome h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--hos-text);
    margin: 0 0 4px;
    background: none;
    border: none;
    padding: 0;
}
.hos-welcome p {
    font-size: 1rem;
    color: var(--hos-text-secondary);
    margin: 0;
}

.hos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
    margin-bottom: 32px;
}

.hos-module-card {
    background: var(--hos-card);
    border-radius: 16px;
    border: 1px solid var(--hos-border-light);
    overflow: hidden;
    transition: box-shadow 0.25s, transform 0.25s;
}
.hos-module-card:hover {
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

.hos-module-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #f0f0f5;
}
.hos-module-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: #fff;
    flex-shrink: 0;
}
.hos-module-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--hos-text);
    margin: 0; padding: 0;
    background: none;
    display: block;
}

.hos-module-body { padding: 8px 12px 12px; }

.hos-module-link {
    display: flex;
    align-items: center;
    padding: 9px 10px;
    border-radius: var(--hos-radius-sm);
    color: var(--hos-text);
    text-decoration: none;
    font-size: 0.88rem;
    font-weight: 400;
    transition: background 0.15s;
}
.hos-module-link:hover {
    background: var(--hos-surface);
    color: var(--hos-primary);
    text-decoration: none;
}
.hos-module-link i {
    margin-right: 10px;
    width: 16px;
    text-align: center;
    color: var(--hos-text-secondary);
    font-size: 0.85rem;
}
.hos-module-link:hover i { color: var(--hos-primary); }

/* Icon background variants */
.hos-icon-blue   { background: linear-gradient(135deg, #0071e3, #3b9cff); }
.hos-icon-teal   { background: linear-gradient(135deg, #30b0c7, #34d399); }
.hos-icon-purple { background: linear-gradient(135deg, #7c3aed, #a78bfa); }
.hos-icon-orange { background: linear-gradient(135deg, #f59e0b, #fb923c); }
.hos-icon-pink   { background: linear-gradient(135deg, #ec4899, #f472b6); }
.hos-icon-green  { background: linear-gradient(135deg, #059669, #34d399); }
.hos-icon-red    { background: linear-gradient(135deg, #dc2626, #f87171); }
.hos-icon-indigo { background: linear-gradient(135deg, #4f46e5, #818cf8); }


/* =============================================================
   4. Case Index Page
   ============================================================= */

.ci-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px 60px;
}

/* Page header */
.ci-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}
.ci-page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--hos-text);
    margin: 0; padding: 0;
    border: none; background: none;
}
.ci-btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 20px;
    border-radius: 10px;
    background: var(--hos-primary);
    color: #fff;
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    border: none;
    transition: background 0.2s;
}
.ci-btn-primary:hover { background: var(--hos-primary-dark); color: #fff; text-decoration: none; }

/* Filter card */
.ci-filter-card {
    background: var(--hos-card);
    border-radius: var(--hos-radius-lg);
    border: 1px solid var(--hos-border-light);
    padding: 20px;
    margin-bottom: 20px;
}
.ci-filter-title {
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--hos-text-secondary);
    margin-bottom: 12px;
}
.ci-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}
.ci-filter-card .form-control,
.ci-filter-card .custom-select {
    border-radius: var(--hos-radius-sm);
    border: 1px solid var(--hos-border);
    font-size: 0.88rem;
    padding: 6px 12px;
    transition: border-color 0.2s;
}
.ci-filter-card .form-control:focus,
.ci-filter-card .custom-select:focus {
    border-color: var(--hos-primary);
    box-shadow: 0 0 0 3px rgba(0,113,227,0.12);
}

.ci-date-group {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--hos-border);
    border-radius: var(--hos-radius-sm);
    overflow: hidden;
}
.ci-date-group .btn {
    border: none;
    border-radius: 0;
    padding: 6px 10px;
    background: var(--hos-surface);
    color: var(--hos-text);
}
.ci-date-group .btn:hover { background: var(--hos-border-light); }
.ci-date-group .form-control {
    border: none;
    border-radius: 0;
    text-align: center;
    width: 110px;
}

.ci-search-wrap {
    position: relative;
    flex: 1;
    min-width: 200px;
}
.ci-search-wrap input { padding-right: 36px; }
.ci-search-wrap .search-icon {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--hos-text-secondary);
    pointer-events: none;
}

.ci-checkbox-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: center;
    margin-top: 10px;
    font-size: 0.85rem;
    color: var(--hos-text-tertiary);
}
.ci-checkbox-row label {
    cursor: pointer;
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.ci-checkbox-row input[type=checkbox] { width: 16px; height: 16px; margin: 0; }

.ci-btn-clear {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 12px;
    border-radius: 16px;
    background: rgba(255,59,48,0.08);
    color: var(--hos-danger);
    font-size: 0.8rem;
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-decoration: none;
}
.ci-btn-clear:hover { background: rgba(255,59,48,0.15); color: var(--hos-danger); text-decoration: none; }

/* Empty state */
.ci-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--hos-text-secondary);
}
.ci-empty i { font-size: 2.5rem; margin-bottom: 12px; display: block; }
.ci-empty p { font-size: 1rem; margin: 0; }

/* Case card */
.ci-case-card {
    background: var(--hos-card);
    border-radius: var(--hos-radius-lg);
    border: 1px solid var(--hos-border-light);
    padding: 20px;
    margin-bottom: 12px;
    transition: box-shadow 0.2s, border-color 0.2s;
}
.ci-case-card:hover,
.ci-case-card.hover {
    border-color: #bde0fe;
    box-shadow: 0 2px 16px rgba(0,113,227,0.08);
}

.ci-case-top {
    display: flex;
    align-items: flex-start;
    gap: 16px;
}

.ci-status-col {
    flex-shrink: 0;
    text-align: center;
    min-width: 60px;
}
.ci-status-col img { height: 48px; margin-bottom: 4px; }
.hc-case-status-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: var(--hos-surface, #f5f5f7);
    margin-bottom: 4px;
    transition: all 0.15s ease;
}
.hc-case-status-icon svg {
    width: 28px;
    height: 28px;
}
.ci-status-col .status-text {
    display: block;
    font-size: 0.72rem;
    color: var(--hos-text-secondary);
    font-weight: 500;
}
.ci-case-card .badge-success { font-size: 0.6rem; }

.ci-info-col { flex: 1; min-width: 0; }

.ci-patient-row {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
}
.ci-patient-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--hos-text);
    text-decoration: none;
}
.ci-patient-name:hover { color: var(--hos-primary); text-decoration: none; }

.ci-clinic-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    background: #f0f0f5;
    font-size: 0.78rem;
    color: var(--hos-text-tertiary);
    font-weight: 500;
}

.ci-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 0.82rem;
    color: var(--hos-text-tertiary);
}
.ci-meta-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    background: var(--hos-surface);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--hos-text-tertiary);
}

.ci-detail-row {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 24px;
    font-size: 0.82rem;
    color: var(--hos-text-tertiary);
}
.ci-detail-row .text-dark { color: var(--hos-text); }

.ci-right-col {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    min-width: 200px;
}

.ci-appointment { text-align: right; }
.ci-appointment-label {
    font-size: 0.75rem;
    color: var(--hos-text-secondary);
    margin-bottom: 2px;
}
.ci-appointment-value {
    font-family: var(--hos-font-mono);
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--hos-text);
}
.ci-btn-edit-date {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: var(--hos-radius-sm);
    border: 1px solid var(--hos-border-light);
    background: var(--hos-card);
    color: var(--hos-primary);
    cursor: pointer;
    transition: background 0.15s;
    margin-left: 8px;
}
.ci-btn-edit-date:hover { background: #f0f0f5; }

/* Action buttons */
.ci-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px dashed var(--hos-border-light);
}
.ci-actions .btn {
    font-size: 0.8rem;
    padding: 5px 12px;
    border-radius: var(--hos-radius-sm);
    font-weight: 500;
    border: 1px solid var(--hos-border-light);
    background: var(--hos-card);
    color: var(--hos-text);
    transition: all 0.15s;
}
.ci-actions .btn:hover {
    background: var(--hos-surface);
    border-color: var(--hos-border);
}
.ci-actions .btn i { margin-right: 4px; }
.ci-actions .btn-danger-ghost {
    color: var(--hos-danger);
    border-color: rgba(255,59,48,0.2);
}
.ci-actions .btn-danger-ghost:hover { background: rgba(255,59,48,0.06); }
.ci-actions .btn-primary-ghost {
    color: var(--hos-primary);
    border-color: rgba(0,113,227,0.2);
}
.ci-actions .btn-primary-ghost:hover { background: rgba(0,113,227,0.06); }

/* File panel inside card */
.ci-file-panel {
    margin-top: 12px;
    padding: 16px;
    background: #f9f9fb;
    border-radius: 10px;
    border: 1px solid var(--hos-border-light);
}


/* =============================================================
   5. Pagination (Modern)
   ============================================================= */

/* New Pager: ul.pagination */
.ci-pagination {
    display: flex;
    justify-content: center;
    margin-top: 24px;
}

.ci-pagination .pagination,
.hos-pagination .pagination {
    display: flex;
    gap: 4px;
    list-style: none;
    padding: 0;
    margin: 0;
    align-items: center;
}

.ci-pagination .pagination li,
.hos-pagination .pagination li {
    display: inline-flex;
}

.ci-pagination .pagination li a,
.hos-pagination .pagination li a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--hos-radius-sm);
    border: 1px solid var(--hos-border-light);
    background: var(--hos-card);
    color: var(--hos-text);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}
.ci-pagination .pagination li a:hover,
.hos-pagination .pagination li a:hover {
    background: var(--hos-surface);
    border-color: var(--hos-primary);
    color: var(--hos-primary);
    text-decoration: none;
}

.ci-pagination .pagination li.active span,
.hos-pagination .pagination li.active span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--hos-radius-sm);
    border: 1px solid var(--hos-primary);
    background: var(--hos-primary);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Old Pager: .page wrapper with flat <a>/<span> */
.page.pagesbottom,
.hos-pagination-legacy {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-top: 24px;
    flex-wrap: wrap;
}

.page.pagesbottom > a,
.hos-pagination-legacy > a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--hos-radius-sm);
    border: 1px solid var(--hos-border-light);
    background: var(--hos-card);
    color: var(--hos-text);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s;
}
.page.pagesbottom > a:hover,
.hos-pagination-legacy > a:hover {
    background: var(--hos-surface);
    border-color: var(--hos-primary);
    color: var(--hos-primary);
    text-decoration: none;
}

.page.pagesbottom > span.current,
.hos-pagination-legacy > span.current {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--hos-radius-sm);
    border: 1px solid var(--hos-primary);
    background: var(--hos-primary);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
}

.page.pagesbottom > span.disabled,
.hos-pagination-legacy > span.disabled {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border-radius: var(--hos-radius-sm);
    border: 1px solid var(--hos-border-light);
    background: var(--hos-surface);
    color: var(--hos-border);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: default;
}


/* =============================================================
   6. Apple-style Modal (shared)
   ============================================================= */

.apple-modal-font {
    font-family: var(--hos-font);
    color: var(--hos-text);
    background-color: #f2f2f7;
    border-radius: var(--hos-radius);
    overflow: hidden;
}
.apple-header {
    border-bottom: 1px solid #e5e5ea;
    padding: 16px 24px;
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}
.apple-title { font-size: 1.1rem; font-weight: 600; margin: 0; color: var(--hos-text); }
.apple-close { background: none; border: none; font-size: 1.5rem; color: var(--hos-text-secondary); outline: none; cursor: pointer; line-height: 1; }

.apple-list-group {
    background-color: #fff;
    border-radius: 10px;
    margin: 20px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}
.apple-list-item {
    padding: 16px 20px;
    border-bottom: 1px solid #e5e5ea;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: background-color 0.2s;
    text-decoration: none;
    color: var(--hos-text);
}
.apple-list-item:last-child { border-bottom: none; }
.apple-list-item:hover { background-color: var(--hos-surface); text-decoration: none; color: #007aff; }
.apple-list-item:active { background-color: #e5e5ea; }
.apple-list-text { font-size: 1rem; font-weight: 500; }
.apple-list-arrow { color: #c7c7cc; font-size: 0.9rem; }

.apple-footer {
    padding: 16px 24px;
    background-color: #f2f2f7;
    display: flex;
    justify-content: center;
}
.btn-apple-cancel {
    background-color: #fff;
    color: #007aff;
    border: 1px solid #e5e5ea;
    padding: 8px 40px;
    border-radius: 20px;
    font-weight: 500;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}


/* =============================================================
   7. Case Details Page (cd- prefix)
   ============================================================= */

.cd-page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px 60px;
}

/* Upload box for ear photos */
.cd-upload-box {
    border: 2px dashed var(--hos-border);
    border-radius: var(--hos-radius);
    background: var(--hos-surface);
    padding: 16px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
}
.cd-upload-box:hover {
    border-color: var(--hos-primary);
    background: rgba(0,113,227,0.03);
}
.cd-upload-preview {
    margin-bottom: 8px;
}
.cd-upload-preview img {
    max-height: 280px;
    max-width: 100%;
    object-fit: contain;
    border-radius: var(--hos-radius-sm);
}
.cd-upload-hint {
    font-size: 0.82rem;
    color: var(--hos-text-secondary);
    font-weight: 500;
}

/* Tooth legend (replaces old .menu) */
.cd-tooth-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 12px;
    justify-content: center;
}
.cd-tooth-legend > div {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    background: var(--hos-surface);
    font-size: 0.78rem;
    color: var(--hos-text-tertiary);
    font-weight: 500;
}
.cd-legend-sym {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    background: var(--hos-primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 700;
}

/* Apple-style image lightbox */
.cd-lightbox .modal-dialog.cd-lightbox-dialog {
    max-width: 100%;
    height: 100%;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cd-lightbox .cd-lightbox-content {
    background: rgba(0,0,0,0.92);
    border: none;
    border-radius: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
}
.cd-lightbox .cd-lightbox-body {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    overflow: auto;
    position: relative;
    text-align: center;
}
.cd-lightbox .imagepreview {
    max-width: 90vw;
    max-height: 90vh;
    object-fit: contain;
}
.cd-lightbox .imagepreview.widthlimit {
    max-width: 90vw;
}
.cd-lightbox-close {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1060;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}
.cd-lightbox-close:hover {
    background: rgba(255,255,255,0.3);
}

.cd-lightbox-nav {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1060;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}
.cd-lightbox-nav:hover {
    background: rgba(255,255,255,0.3);
}
.cd-lightbox-prev { left: 16px; }
.cd-lightbox-next { right: 16px; }

.cd-lightbox-toolbar {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1060;
    display: flex;
    gap: 4px;
    background: rgba(255,255,255,0.12);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 4px;
}
.cd-lightbox-tool {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: none;
    background: transparent;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}
.cd-lightbox-tool:hover {
    background: rgba(255,255,255,0.2);
}


/* =============================================================
   8. Paper / Sedation Record (pp- prefix)
   ============================================================= */

.pp-section {
    padding: 16px 0;
    border-bottom: 1px solid var(--hos-border-light);
}
.pp-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.pp-section-title {
    font-size: 0.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--hos-text-secondary);
    margin-bottom: 12px;
}

/* Checkbox row */
.pp-check-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.pp-check-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: var(--hos-radius-sm);
    background: var(--hos-surface);
    font-size: 0.85rem;
    color: var(--hos-text-tertiary);
    font-weight: 500;
    margin: 0;
    cursor: default;
    border: 1px solid transparent;
    transition: all 0.15s;
}
.pp-check-item.pp-checked {
    background: rgba(0,113,227,0.08);
    color: var(--hos-primary);
    border-color: rgba(0,113,227,0.15);
}
.pp-checkbox {
    font-size: 0.95rem;
    line-height: 1;
}

/* Data table */
.pp-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.85rem;
}
.pp-table thead th {
    background: var(--hos-surface);
    color: var(--hos-text-secondary);
    font-weight: 600;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 8px 12px;
    border-bottom: 1px solid var(--hos-border-light);
    text-align: left;
}
.pp-table thead th:first-child {
    border-radius: var(--hos-radius-sm) 0 0 0;
}
.pp-table thead th:last-child {
    border-radius: 0 var(--hos-radius-sm) 0 0;
}
.pp-table tbody td {
    padding: 8px 12px;
    border-bottom: 1px solid var(--hos-border-light);
    color: var(--hos-text);
}
.pp-table tbody tr:last-child td {
    border-bottom: none;
}
.pp-table tbody tr:hover {
    background: rgba(0,113,227,0.02);
}

/* Value chip */
.pp-val {
    font-family: var(--hos-font-mono);
    font-weight: 600;
    color: var(--hos-text);
}
.pp-val-inline {
    font-family: var(--hos-font-mono);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--hos-text);
}

/* Inline group (pustule / suction / nasal) */
.pp-inline-group {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: center;
}
.pp-inline-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.pp-label {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--hos-text-secondary);
}

/* Drug grid */
.pp-drug-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
}
.pp-drug-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    border-radius: var(--hos-radius-sm);
    background: var(--hos-surface);
    border: 1px solid var(--hos-border-light);
}
.pp-drug-name {
    font-size: 0.82rem;
    color: var(--hos-text-secondary);
    font-weight: 500;
}
.pp-drug-val {
    font-family: var(--hos-font-mono);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--hos-text);
}
.pp-drug-val small {
    font-weight: 400;
    color: var(--hos-text-tertiary);
    font-size: 0.75rem;
}

/* Other med box */
.pp-other-box {
    padding: 10px 14px;
    border-radius: var(--hos-radius-sm);
    background: var(--hos-surface);
    border: 1px solid var(--hos-border-light);
}
.pp-other-text {
    margin-top: 4px;
    font-size: 0.88rem;
    color: var(--hos-text);
    word-break: break-all;
    white-space: normal;
}

/* Temperature row */
.pp-temp-row {
    display: flex;
    gap: 12px;
}
.pp-temp-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    border-radius: var(--hos-radius-sm);
    background: var(--hos-surface);
    border: 1px solid var(--hos-border-light);
}
.pp-temp-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--hos-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.pp-temp-val {
    font-family: var(--hos-font-mono);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--hos-text);
}

/* Special event handoff */
.pp-event-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.pp-event-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 8px 0;
}
.pp-event-desc {
    flex: 1;
    min-width: 200px;
    padding: 6px 12px;
    background: var(--hos-surface);
    border-radius: var(--hos-radius-sm);
    font-size: 0.85rem;
    color: var(--hos-text);
    word-break: break-all;
    white-space: normal;
}


/* =============================================================
   9. Responsive
   ============================================================= */

@media (max-width: 768px) {
    .hos-navbar { padding: 0 12px; }
    .hos-nav-links { display: none; }
    .hos-nav-right { display: none; }
    .hos-hamburger { display: flex !important; }
    .hos-main .main_content { padding: 0 12px 24px; }

    .ci-case-top { flex-direction: column; }
    .ci-right-col { align-items: flex-start; min-width: auto; }
    .ci-page-header { flex-direction: column; gap: 12px; align-items: flex-start; }

    .cd-page { padding: 0 12px 24px; }

    .pp-drug-grid { grid-template-columns: 1fr; }
    .pp-temp-row { flex-direction: column; }
    .pp-inline-group { flex-direction: column; align-items: flex-start; }
    .hl-filter-bar { flex-direction: column; align-items: stretch; }
    .hl-filter-sep { width: 100%; height: 1px; }
}


/* =============================================================
   10. Modern List / Table  (.hl- prefix)
   Adapted from HSMainCore ep-* pattern.
   ============================================================= */

/* -- Page wrapper -- */
.hl-page {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* -- Filter bar -- */
.hl-filter-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 12px 16px;
    background: #fff;
    border-radius: var(--hos-radius-lg);
    border: 1px solid var(--hos-border-light);
}
.hl-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.hl-filter-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--hos-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    margin-right: 2px;
}
.hl-filter-sep {
    width: 1px;
    height: 20px;
    background: var(--hos-border-light);
    flex-shrink: 0;
}
.hl-filter-select {
    border: 1px solid var(--hos-border-light);
    border-radius: var(--hos-radius-sm);
    padding: 5px 10px;
    font-size: 12.5px;
    color: var(--hos-text);
    background: var(--hos-surface);
    outline: none;
    cursor: pointer;
    height: 34px;
}
.hl-filter-select:focus {
    border-color: var(--hos-primary);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}
.hl-filter-input {
    border: 1px solid var(--hos-border-light);
    border-radius: var(--hos-radius-sm);
    padding: 5px 12px;
    font-size: 13px;
    color: var(--hos-text);
    background: var(--hos-surface);
    outline: none;
    height: 34px;
    width: 180px;
    transition: width 0.2s ease, border-color 0.15s, box-shadow 0.15s;
}
.hl-filter-input:focus {
    border-color: var(--hos-primary);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
    width: 240px;
}
.hl-filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 14px;
    border-radius: var(--hos-radius-sm);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    white-space: nowrap;
    height: 34px;
}
.hl-filter-btn-primary {
    background: var(--hos-primary);
    color: #fff;
    border-color: var(--hos-primary);
}
.hl-filter-btn-primary:hover {
    background: var(--hos-primary-dark);
    color: #fff;
}
.hl-filter-btn-secondary {
    background: #fff;
    color: var(--hos-text);
    border-color: var(--hos-border-light);
}
.hl-filter-btn-secondary:hover {
    background: var(--hos-surface);
}

/* -- Panel -- */
.hl-panel {
    background: #fff;
    border-radius: var(--hos-radius-lg);
    border: 1px solid var(--hos-border-light);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.hl-panel-toolbar {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    background: var(--hos-surface);
}
.hl-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--hos-text);
}
.hl-count-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 500;
    background: var(--hos-border-light);
    color: var(--hos-text-secondary);
}

/* -- Table -- */
.hl-table-wrap {
    overflow-x: auto;
}
.hl-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.hl-table thead th {
    position: sticky;
    top: 0;
    background: var(--hos-surface);
    color: var(--hos-text-secondary);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 9px 12px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    white-space: nowrap;
    z-index: 2;
}
.hl-table tbody tr {
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
    transition: background 0.1s;
}
.hl-table tbody tr:last-child {
    border-bottom: none;
}
.hl-table tbody tr:hover {
    background: var(--hos-surface);
}
.hl-table td {
    padding: 9px 12px;
    vertical-align: middle;
    color: var(--hos-text);
    white-space: nowrap;
}

/* -- Action buttons -- */
.hl-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}
.hl-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 10px;
    border-radius: 7px;
    border: 1px solid rgba(0, 0, 0, 0.06);
    background: #fff;
    color: var(--hos-text-secondary);
    font-size: 11.5px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
    white-space: nowrap;
}
.hl-action-btn:hover {
    background: var(--hos-primary);
    color: #fff;
    border-color: var(--hos-primary);
    text-decoration: none;
}
.hl-action-btn-danger:hover {
    background: var(--hos-danger);
    color: #fff;
    border-color: var(--hos-danger);
}

/* -- Status badges -- */
.hl-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}
.hl-badge-active {
    background: #d1fae5;
    color: #065f46;
}
.hl-badge-inactive {
    background: #fee2e2;
    color: #991b1b;
}
.hl-badge-admin {
    background: #ede9fe;
    color: #5b21b6;
}
.hl-badge-user {
    background: #dbeafe;
    color: #1e40af;
}
.hl-badge-clinic {
    background: #fef3c7;
    color: #92400e;
}

/* Clinic type badges */
.hl-badge-ct0 { background: #dbeafe; color: #1e40af; }  /* 兒牙鎮靜 - 藍 */
.hl-badge-ct1 { background: #ede9fe; color: #5b21b6; }  /* 成人鎮靜 - 紫 */
.hl-badge-ct2 { background: #d1fae5; color: #065f46; }  /* 腸胃鏡檢 - 綠 */
.hl-badge-ct3 { background: #fef3c7; color: #92400e; }  /* 人力派遣 - 黃 */
.hl-badge-ct4 { background: #fee2e2; color: #991b1b; }  /* 疼痛科 - 紅 */
.hl-badge-ct5 { background: #fce7f3; color: #9d174d; }  /* 台北凡登 - 粉 */
.hl-badge-ct6 { background: #ccfbf1; color: #115e59; }  /* 新竹凡登 - 青 */
.hl-badge-ct7 { background: #e0e7ff; color: #3730a3; }  /* 小耳症 - 靛 */
.hl-badge-ct8 { background: #f3e8ff; color: #6b21a8; }  /* 全麻 - 深紫 */

/* -- Text helpers -- */
.hl-sub {
    font-size: 12px;
    color: var(--hos-text);
}
.hl-muted {
    font-size: 11px;
    color: var(--hos-text-secondary);
}

/* -- Empty state -- */
.hl-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--hos-text-secondary);
    font-size: 14px;
    gap: 8px;
}

/* -- Searchable select -- */
.hl-searchable-select {
    position: relative;
}
.hl-searchable-select select.form-control {
    height: auto !important;
    min-height: 160px;
    max-height: 220px;
    overflow-y: auto;
    border-radius: var(--hos-radius-sm);
    border: 1px solid var(--hos-border-light);
    font-size: 13px;
    padding: 0;
}
.hl-searchable-select select.form-control option {
    padding: 6px 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    cursor: pointer;
}
.hl-searchable-select select.form-control option:hover,
.hl-searchable-select select.form-control option:checked {
    background: var(--hos-primary);
    color: #fff;
}

/* -- Pagination -- */
.hl-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 16px 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.04);
}
.hl-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border-radius: 8px;
    border: 1px solid var(--hos-border-light);
    background: #fff;
    color: var(--hos-text-secondary);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.15s;
    cursor: pointer;
}
.hl-page-btn:hover {
    background: var(--hos-primary);
    color: #fff;
    border-color: var(--hos-primary);
    text-decoration: none;
}
.hl-page-active {
    background: var(--hos-primary);
    color: #fff;
    border-color: var(--hos-primary);
    cursor: default;
}
.hl-page-info {
    margin-left: 12px;
    font-size: 12px;
    color: var(--hos-text-secondary);
}

/* -- Button Toggle Group (radio/checkbox as buttons) -- */
.hl-btn-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
}
.hl-btn-group input[type="radio"],
.hl-btn-group input[type="checkbox"] {
    display: none;
}
.hl-btn-group label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid var(--hos-border);
    background: #fff;
    color: var(--hos-text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
}
.hl-btn-group label:hover {
    border-color: var(--hos-primary);
    color: var(--hos-primary);
}
.hl-btn-group input[type="radio"]:checked + label,
.hl-btn-group input[type="checkbox"]:checked + label {
    background: var(--hos-primary);
    color: #fff;
    border-color: var(--hos-primary);
    box-shadow: 0 2px 8px rgba(0,113,227,0.3);
}

/* -- Required field marker -- */
.hl-required::after {
    content: " *";
    color: var(--hos-danger);
    font-weight: 700;
}

/* -- Disabled/greyed-out row -- */
.hl-row-disabled {
    opacity: 0.5;
    background: #f9f9f9 !important;
}

/* -- Responsive -- */
@media (max-width: 1200px) {
    .hl-page { padding: 12px 12px; }
    .hl-filter-bar { padding: 8px 10px; gap: 10px; }
}
@media (max-width: 768px) {
    .hl-filter-input { width: 140px; }
    .hl-filter-input:focus { width: 180px; }
}


/* =============================================================
   11. Calendar Page  (.cal- prefix)
   ============================================================= */

/* -- Page layout -- */
.cal-page {
    display: flex;
    gap: 16px;
    padding: 16px 20px;
    min-height: calc(100vh - var(--hos-nav-height) - 80px);
}

/* -- Sidebar -- */
.cal-sidebar {
    width: 220px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.cal-sidebar-card {
    background: #fff;
    border-radius: var(--hos-radius-lg);
    border: 1px solid var(--hos-border-light);
    overflow: hidden;
}
.cal-sidebar-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--hos-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 12px 14px 6px;
}
.cal-source-list {
    list-style: none;
    margin: 0;
    padding: 0 8px 8px;
}
.cal-source-item {
    padding: 7px 8px;
    border-radius: var(--hos-radius-sm);
    transition: background 0.12s;
    cursor: pointer;
    position: relative;
}
.cal-source-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    cursor: pointer;
}
.cal-source-item:hover {
    background: var(--hos-surface);
}
.cal-source-item input[type="checkbox"] {
    accent-color: var(--hos-primary);
    width: 15px;
    height: 15px;
    cursor: pointer;
}
.cal-source-name {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--hos-text);
    flex: 1;
}
.cal-source-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.cal-source-loading {
    display: none;
    font-size: 10px;
    color: var(--hos-text-secondary);
    position: absolute;
    bottom: -2px;
    left: 32px;
}
.cal-sidebar-actions {
    padding: 8px 14px 12px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}
.cal-sidebar-filter {
    padding: 10px 14px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}
.cal-sidebar-filter label {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    cursor: pointer;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--hos-text);
}
.cal-sidebar-filter input[type="checkbox"] {
    accent-color: var(--hos-primary);
    width: 15px;
    height: 15px;
}
.cal-sidebar-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    font-weight: 500;
    color: var(--hos-primary);
    text-decoration: none;
    padding: 4px 0;
    transition: opacity 0.15s;
}
.cal-sidebar-link:hover {
    opacity: 0.7;
    text-decoration: none;
    color: var(--hos-primary);
}

/* -- Calendar main area -- */
.cal-main {
    flex: 1;
    min-width: 0;
    background: #fff;
    border-radius: var(--hos-radius-lg);
    border: 1px solid var(--hos-border-light);
    padding: 16px;
    overflow: hidden;
}

/* -- FullCalendar v2 overrides -- */
.cal-main .fc {
    font-family: var(--hos-font);
}
.cal-main .fc-toolbar {
    margin-bottom: 12px !important;
}
.cal-main .fc-toolbar h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--hos-text);
}

/* Buttons */
.cal-main .fc-button {
    background: var(--hos-surface) !important;
    border: 1px solid var(--hos-border-light) !important;
    color: var(--hos-text) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    padding: 5px 12px !important;
    border-radius: var(--hos-radius-sm) !important;
    text-shadow: none !important;
    box-shadow: none !important;
    height: auto !important;
    line-height: 1.4 !important;
    transition: all 0.15s !important;
    text-transform: capitalize;
}
.cal-main .fc-button:hover {
    background: var(--hos-border-light) !important;
    color: var(--hos-text) !important;
}
.cal-main .fc-button.fc-state-active,
.cal-main .fc-state-active {
    background: var(--hos-primary) !important;
    color: #fff !important;
    border-color: var(--hos-primary) !important;
}
.cal-main .fc-button-group .fc-button {
    border-radius: 0 !important;
}
.cal-main .fc-button-group .fc-button:first-child {
    border-radius: var(--hos-radius-sm) 0 0 var(--hos-radius-sm) !important;
}
.cal-main .fc-button-group .fc-button:last-child {
    border-radius: 0 var(--hos-radius-sm) var(--hos-radius-sm) 0 !important;
}
.cal-main .fc-today-button {
    border-radius: var(--hos-radius-sm) !important;
}

/* Table / Grid */
.cal-main .fc-widget-header {
    border-color: var(--hos-border-light) !important;
}
.cal-main .fc-widget-header th {
    background: var(--hos-surface) !important;
    border-color: var(--hos-border-light) !important;
    font-size: 11px;
    font-weight: 600;
    color: var(--hos-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 8px 0 !important;
}
.cal-main .fc-widget-content {
    border-color: var(--hos-border-light) !important;
}
.cal-main .fc-day-header {
    border-color: var(--hos-border-light) !important;
}
.cal-main td.fc-today {
    background: rgba(0, 113, 227, 0.04) !important;
}
.cal-main .fc-day-number {
    font-size: 12px;
    font-weight: 600;
    color: var(--hos-text);
    padding: 4px 8px !important;
}
.cal-main td.fc-today .fc-day-number {
    color: var(--hos-primary);
    font-weight: 700;
}

/* Events */
.cal-main .fc-event {
    border: none !important;
    border-radius: 4px !important;
    font-size: 11px !important;
    font-weight: 500;
    padding: 2px 5px !important;
    margin: 1px 2px !important;
    line-height: 1.4;
    transition: opacity 0.15s, transform 0.1s;
}
.cal-main .fc-event:hover {
    opacity: 0.85;
    transform: scale(1.01);
}
.cal-main .fc-event .fc-content {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Agenda time grid */
.cal-main .fc-time-grid .fc-slats td {
    border-color: var(--hos-border-light) !important;
    height: 2.5em;
}
.cal-main .fc-axis {
    font-size: 10px;
    color: var(--hos-text-secondary);
}

/* -- Responsive -- */
@media (max-width: 992px) {
    .cal-page { flex-direction: column; }
    .cal-sidebar { width: 100%; flex-direction: row; flex-wrap: wrap; }
    .cal-sidebar-card { flex: 1; min-width: 200px; }
}
@media (max-width: 768px) {
    .cal-page { padding: 12px; }
    .cal-main { padding: 10px; }
    .cal-main .fc-toolbar h2 { font-size: 0.95rem; }
}


/* =============================================================
   12. SMS Tab Menu & Contact List (Modern Override)
   ============================================================= */

/* -- Tab Menu (pill style) -- */
ul.tabmenu {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 16px 0;
    padding: 0;
    list-style: none;
    background: var(--hos-surface);
    border-radius: var(--hos-radius);
    padding: 4px;
}

ul.tabmenu li {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 16px;
    border-radius: var(--hos-radius-sm);
    background: transparent;
    color: var(--hos-text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    margin: 0;
    border: none;
}

ul.tabmenu li:hover {
    color: var(--hos-text);
    background: rgba(0, 0, 0, 0.04);
}

ul.tabmenu li.active {
    background: #fff;
    color: var(--hos-primary);
    font-weight: 600;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* -- Contact list -- */
.prev_content > div {
    display: none;
    border: none;
    padding: 0;
    min-height: 80px;
    max-height: 320px;
    overflow-y: auto;
}

.prev_content > div.active {
    display: block;
}

.prev_content .contact {
    padding: 8px 12px;
    border-radius: var(--hos-radius-sm);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--hos-text);
    cursor: pointer;
    transition: all 0.15s;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.prev_content .contact:hover {
    background: rgba(0, 113, 227, 0.06);
    color: var(--hos-primary);
}

.prev_content .contact:active {
    background: rgba(0, 113, 227, 0.12);
}

/* -- SMS User Chips (receiver list) -- */
.sms-user {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    margin: 3px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    background: var(--hos-surface);
    border: 1px solid var(--hos-border-light);
    color: var(--hos-text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.sms-user:hover {
    border-color: var(--hos-border);
}

.sms-user.checked {
    background: rgba(0, 113, 227, 0.08);
    border-color: rgba(0, 113, 227, 0.3);
    color: var(--hos-primary);
    font-weight: 600;
}

/* -- Preview content textarea -- */
.prev_content textarea {
    width: 100%;
    border: 1px solid var(--hos-border-light);
    border-radius: var(--hos-radius-sm);
    padding: 12px;
    font-size: 0.88rem;
    color: var(--hos-text);
    resize: vertical;
    transition: border-color 0.2s;
}

.prev_content textarea:focus {
    outline: none;
    border-color: var(--hos-primary);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}


/* =============================================================
   13. Global Loading Overlay & Toast
   ============================================================= */

/* -- Loading Overlay -- */
.hos-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(4px);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hos-loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.hos-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--hos-border-light);
    border-top-color: var(--hos-primary);
    border-radius: 50%;
    animation: hos-spin 0.7s linear infinite;
}
@keyframes hos-spin {
    to { transform: rotate(360deg); }
}
.hos-loading-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--hos-text-secondary);
}

/* -- Toast Notification -- */
#hos-toast-container {
    position: fixed;
    top: 72px;
    right: 20px;
    z-index: 99998;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.hos-toast {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    background: var(--hos-card);
    border-radius: var(--hos-radius-sm);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
    font-size: 13px;
    font-weight: 500;
    color: var(--hos-text);
    transform: translateX(120%);
    transition: transform 0.3s ease;
    max-width: 360px;
}
.hos-toast-show {
    transform: translateX(0);
}

/* =============================================================
   Paper (鎮靜手術紀錄單) — Apple Inset Group 風格
   ============================================================= */
.paper-inset-group {
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 20px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.8), 0 2px 10px rgba(0,0,0,0.02);
    overflow: hidden;
}
.paper-section-header {
    background: rgba(244,247,249,0.85);
    border-bottom: 1px solid rgba(28,69,125,0.08);
    padding: 0.6rem 1.25rem;
    font-weight: 700;
    color: var(--hos-primary-dark, #0058b0);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
}
.paper-section-row {
    border-bottom: 1px solid rgba(28,69,125,0.08);
    padding: 0.85rem 1.25rem;
    background: rgba(255,255,255,0.4);
}
.paper-section-row:last-child { border-bottom: none; }
.paper-label-mini {
    font-size: 0.75rem;
    color: #8a96a8;
    font-weight: 600;
    margin-bottom: 0.1rem;
}
.paper-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: #54627b;
}
.paper-unit {
    font-size: 0.75rem;
    color: #8a96a8;
    font-weight: 500;
    margin-left: 2px;
}
.paper-status {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    border: 1px solid transparent;
}
.paper-status-yes {
    background: #e8eff7;
    color: #1c457d;
    border-color: rgba(28,69,125,0.2);
}
.paper-status-no {
    background: rgba(138,150,168,0.1);
    color: #8a96a8;
    border-color: rgba(138,150,168,0.2);
}
.paper-note {
    background: rgba(244,247,249,0.5);
    border: 1px solid rgba(28,69,125,0.08);
    border-radius: 12px;
    padding: 0.75rem 1rem;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.02);
}
.paper-med-row {
    display: grid;
    grid-template-columns: 90px 1fr 1fr 1fr 120px;
    gap: 1rem;
    align-items: center;
}
@media (max-width: 991.98px) {
    .paper-med-row {
        grid-template-columns: 1fr 1fr;
        gap: 0.5rem;
        padding-bottom: 0.5rem;
        border-bottom: 1px dashed rgba(28,69,125,0.08);
    }
    .paper-med-row:last-child { border-bottom: none; }
    .paper-med-row > div:first-child { grid-column: 1 / -1; }
}
.paper-table-wrap {
    border: 1px solid rgba(28,69,125,0.08);
    border-radius: 12px;
    overflow: hidden;
    background: rgba(255,255,255,0.6);
}
.paper-table-wrap table {
    width: 100%;
    margin-bottom: 0;
    color: #54627b;
    font-size: 0.9rem;
}
.paper-table-wrap th {
    background: rgba(244,247,249,0.8);
    color: #8a96a8;
    font-weight: 700;
    border-bottom: 1px solid rgba(28,69,125,0.08);
    padding: 0.6rem 1rem;
}
.paper-table-wrap td {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid rgba(28,69,125,0.08);
    font-weight: 600;
}
.paper-table-wrap tr:last-child td { border-bottom: none; }

/* =============================================================
   Ear (小耳症綜合評估) — Apple Inset Group 左右耳對比
   ============================================================= */
.ear-inset-group {
    background: rgba(255,255,255,0.6);
    border: 1px solid rgba(255,255,255,0.6);
    border-radius: 20px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.8), 0 2px 10px rgba(0,0,0,0.02);
    overflow: hidden;
}
.ear-list-header {
    background: rgba(255,255,255,0.8);
    border-bottom: 2px solid rgba(28,69,125,0.08);
    padding: 0.75rem 0;
    font-weight: 700;
    color: #1c457d;
}
.ear-list-row {
    border-bottom: 1px solid rgba(28,69,125,0.08);
    transition: background 0.2s;
}
.ear-list-row:last-child { border-bottom: none; }
.ear-list-row:hover { background: rgba(255,255,255,0.9); }
.ear-label {
    background: rgba(244,247,249,0.4);
    font-weight: 700;
    color: #8a96a8;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 1rem 1.5rem;
    text-align: right;
    border-right: 1px solid rgba(28,69,125,0.08);
}
.ear-cell {
    padding: 1rem 1.5rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    align-items: center;
}
.ear-tag {
    display: inline-flex;
    align-items: center;
    background: #fff;
    color: #1c457d;
    padding: 0.25rem 0.65rem;
    border-radius: 16px;
    font-size: 0.85rem;
    font-weight: 600;
    box-shadow: 0 2px 4px rgba(28,69,125,0.05);
    border: 1px solid #e8eff7;
}
.ear-tag-success {
    background: #e6f4ea;
    color: #1e6c43;
    border-color: #c3e6cb;
}
.ear-tag-warn {
    background: #fff3cd;
    color: #856404;
    border-color: #ffeeba;
}
@media (min-width: 768px) {
    .ear-border-mid { border-right: 1px dashed rgba(28,69,125,0.08); }
}
@media (max-width: 767.98px) {
    .ear-label {
        justify-content: flex-start;
        text-align: left;
        padding: 0.75rem 1rem 0.25rem 1rem;
        border-right: none;
        background: transparent;
        color: #1c457d;
    }
    .ear-cell { padding: 0.25rem 1rem 1rem 1rem; }
    .ear-border-mid { border-bottom: 1px dashed rgba(28,69,125,0.08); }
}

/* =============================================================
   Medicine Record table - wider columns for PC readability
   ============================================================= */
@media (min-width: 768px) {
    .medicine-record-table.hl-table td,
    .medicine-record-table.hl-table th {
        padding: 12px 16px;
        font-size: 14px;
    }
    .medicine-record-table.hl-table td:first-child {
        min-width: 200px;
        white-space: normal;
        word-break: break-word;
    }
    .medicine-record-table.hl-table td:nth-child(2) {
        min-width: 100px;
        text-align: center;
    }
    .medicine-record-table.hl-table td:nth-child(3) {
        min-width: 120px;
        white-space: nowrap;
    }
    .medicine-record-table.hl-table td:nth-child(4) {
        min-width: 140px;
        white-space: normal;
        word-break: break-word;
    }
}
.medicine-record-table.hl-table thead th {
    font-size: 12px;
    padding: 11px 16px;
}

/* =============================================================
   File toolbar confirm/unconfirm buttons - mobile responsive
   ============================================================= */
@media (max-width: 575.98px) {
    .btn-toolbar[role="toolbar"] {
        flex-wrap: wrap;
        gap: 4px;
    }
    .btn-toolbar[role="toolbar"] .btn-group {
        flex-wrap: wrap;
    }
    .btn-toolbar[role="toolbar"] .btn-group .btn {
        font-size: 0.75rem;
        padding: 0.25rem 0.5rem;
        white-space: nowrap;
    }
    .btn-toolbar[role="toolbar"] .btn-group .btn svg {
        width: 10px;
        height: 10px;
    }
}
