/* ==========================================================================
   MRS — Manajemen Rumah Sakit
   Modern Design System · mrs.izoel.com
   ========================================================================== */

:root {
    /* Brand & Semantic Colors */
    --primary:        #0ea5e9;
    --primary-50:     #f0f9ff;
    --primary-100:    #e0f2fe;
    --primary-500:    #0ea5e9;
    --primary-600:    #0284c7;
    --primary-700:    #0369a1;
    --primary-800:    #075985;
    --primary-900:    #0c4a6e;

    --success:  #10b981;
    --success-bg: #d1fae5;
    --warning:  #f59e0b;
    --warning-bg: #fef3c7;
    --danger:   #ef4444;
    --danger-bg: #fee2e2;
    --info:     #3b82f6;
    --info-bg:  #dbeafe;
    --purple:   #8b5cf6;
    --pink:     #ec4899;
    --teal:     #14b8a6;

    /* Neutral palette */
    --bg:           #f7fafc;
    --bg-elevated:  #ffffff;
    --bg-sidebar:   #ffffff;
    --bg-sidebar-active: #f0f9ff;
    --surface:      #ffffff;
    --surface-2:    #f8fafc;

    --text:         #0f172a;
    --text-muted:   #64748b;
    --text-light:   #94a3b8;
    --border:       #e2e8f0;
    --border-light: #f1f5f9;
    --border-strong:#cbd5e1;

    /* Spacing & Sizing */
    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 14px;
    --radius-xl: 20px;

    --shadow-sm:  0 1px 2px rgba(15,23,42,.04);
    --shadow:     0 1px 3px rgba(15,23,42,.06), 0 1px 2px rgba(15,23,42,.05);
    --shadow-md:  0 4px 6px -1px rgba(15,23,42,.07), 0 2px 4px -2px rgba(15,23,42,.05);
    --shadow-lg:  0 10px 15px -3px rgba(15,23,42,.08), 0 4px 6px -4px rgba(15,23,42,.06);
    --shadow-xl:  0 20px 25px -5px rgba(15,23,42,.10), 0 8px 10px -6px rgba(15,23,42,.06);

    --font-sans: 'Inter', 'Segoe UI', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'Fira Code', 'SF Mono', monospace;

    --sidebar-w: 256px;
    --topbar-h: 64px;

    --transition: 200ms cubic-bezier(.4, 0, .2, 1);
}

/* Dark mode */
[data-theme="dark"] {
    --bg:           #0f172a;
    --bg-elevated:  #1e293b;
    --bg-sidebar:   #1e293b;
    --bg-sidebar-active: #334155;
    --surface:      #1e293b;
    --surface-2:    #334155;
    --text:         #f1f5f9;
    --text-muted:   #94a3b8;
    --text-light:   #64748b;
    --border:       #334155;
    --border-light: #1e293b;
    --border-strong:#475569;
}

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html, body { height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--primary-600); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-800); }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font: inherit; color: inherit; }
table { border-collapse: collapse; width: 100%; }
ol, ul { list-style: none; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ============ LAYOUT ============ */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    grid-template-rows: var(--topbar-h) 1fr;
    grid-template-areas: "sidebar topbar" "sidebar main";
    min-height: 100vh;
}
.app-shell.sidebar-collapsed {
    --sidebar-w: 72px;
}

/* SIDEBAR */
.sidebar {
    grid-area: sidebar;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
    overflow-y: auto; overflow-x: hidden;
    transition: width var(--transition);
    z-index: 30;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.sidebar-brand {
    display: flex; align-items: center; gap: .75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    height: var(--topbar-h);
    flex-shrink: 0;
}
.sidebar-brand-logo {
    width: 40px; height: 40px; border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 800; font-size: 18px;
    box-shadow: 0 4px 8px rgba(14,165,233,.25);
    flex-shrink: 0;
}
.sidebar-brand-text { display: flex; flex-direction: column; min-width: 0; }
.sidebar-brand-text .name { font-weight: 700; font-size: 15px; color: var(--text); letter-spacing: -.01em; }
.sidebar-brand-text .sub  { font-size: 11px; color: var(--text-muted); }

.sidebar-collapsed .sidebar-brand-text,
.sidebar-collapsed .nav-group-title,
.sidebar-collapsed .nav-link span,
.sidebar-collapsed .sidebar-footer-text {
    display: none;
}

.sidebar-nav { padding: .75rem 0; flex: 1; }
.nav-group { margin-bottom: .75rem; }
.nav-group-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-light);
    padding: .5rem 1.25rem .25rem;
    font-weight: 600;
}
.nav-link {
    display: flex; align-items: center; gap: .75rem;
    padding: .55rem 1.25rem;
    color: var(--text-muted);
    font-size: 13.5px; font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    white-space: nowrap;
    position: relative;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); }
.nav-link.active {
    background: var(--bg-sidebar-active);
    color: var(--primary-700);
    border-left-color: var(--primary-500);
    font-weight: 600;
}
.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--border-light);
    flex-shrink: 0;
}
.sidebar-footer-text {
    font-size: 11px; color: var(--text-light);
}

/* TOPBAR */
.topbar {
    grid-area: topbar;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 1.5rem;
    gap: 1rem;
    height: var(--topbar-h);
    position: sticky; top: 0;
    z-index: 20;
}
.topbar-search {
    flex: 1; max-width: 460px;
    display: flex; align-items: center;
    background: var(--surface-2);
    border: 1px solid transparent;
    border-radius: var(--radius);
    padding: .5rem .85rem;
    transition: all var(--transition);
}
.topbar-search:focus-within {
    background: var(--bg-elevated);
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}
.topbar-search svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.topbar-search input {
    flex: 1; border: none; background: transparent;
    margin-left: .6rem; outline: none; font-size: 13.5px;
}

.topbar-actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.topbar-btn {
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border-radius: var(--radius);
    color: var(--text-muted);
    transition: all var(--transition);
    position: relative;
}
.topbar-btn:hover { background: var(--surface-2); color: var(--text); }
.topbar-btn svg { width: 18px; height: 18px; }
.topbar-btn .dot {
    position: absolute; top: 8px; right: 8px;
    width: 8px; height: 8px;
    background: var(--danger); border-radius: 50%;
    border: 2px solid var(--bg-elevated);
}

.topbar-user {
    display: flex; align-items: center; gap: .65rem;
    padding: .25rem .5rem .25rem .25rem;
    border-radius: var(--radius);
    transition: background var(--transition);
}
.topbar-user:hover { background: var(--surface-2); }
.topbar-user-info { display: flex; flex-direction: column; line-height: 1.2; }
.topbar-user-info .name { font-weight: 600; font-size: 13.5px; }
.topbar-user-info .role { font-size: 11.5px; color: var(--text-muted); }

.avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 600; font-size: 13.5px;
    background: linear-gradient(135deg, var(--primary-500), var(--primary-700));
    flex-shrink: 0;
    overflow: hidden;
}
.avatar.sm { width: 28px; height: 28px; font-size: 11.5px; }
.avatar.lg { width: 56px; height: 56px; font-size: 18px; }
.avatar.xl { width: 96px; height: 96px; font-size: 32px; }

/* MAIN */
.main {
    grid-area: main;
    padding: 1.75rem;
    overflow-x: hidden;
}
.page-header {
    display: flex; align-items: flex-end; justify-content: space-between;
    margin-bottom: 1.5rem;
    gap: 1rem;
    flex-wrap: wrap;
}
.page-header h1 {
    font-size: 1.5rem; font-weight: 700;
    letter-spacing: -.02em;
    color: var(--text);
    margin-bottom: .25rem;
}
.page-header .subtitle {
    color: var(--text-muted); font-size: 13.5px;
}
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: .35rem; }
.breadcrumb ol { display: flex; gap: .35rem; align-items: center; flex-wrap: wrap; }
.breadcrumb li::after { content: '/'; margin-left: .35rem; color: var(--text-light); }
.breadcrumb li:last-child::after { display: none; }
.breadcrumb li.active { color: var(--text); font-weight: 500; }

/* ============ CARDS ============ */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}
.card-header {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
}
.card-title { font-weight: 600; font-size: 15px; }
.card-subtitle { font-size: 12.5px; color: var(--text-muted); margin-top: 2px; }
.card-body { padding: 1.25rem; }
.card-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border-light); background: var(--surface-2); }

/* ============ KPI / STAT CARDS ============ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: all var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.stat-card-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    margin-bottom: .85rem;
}
.stat-card-icon svg { width: 22px; height: 22px; }
.stat-card-label {
    font-size: 12.5px; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .04em;
    font-weight: 600;
}
.stat-card-value {
    font-size: 1.85rem; font-weight: 800;
    margin: .25rem 0;
    letter-spacing: -.02em;
    line-height: 1.1;
}
.stat-card-trend {
    font-size: 12px; color: var(--text-muted);
    display: flex; align-items: center; gap: 4px;
    font-weight: 500;
}
.stat-card-trend.up    { color: var(--success); }
.stat-card-trend.down  { color: var(--danger); }

.stat-blue   { background: var(--info-bg);    color: var(--info); }
.stat-green  { background: var(--success-bg); color: var(--success); }
.stat-amber  { background: var(--warning-bg); color: var(--warning); }
.stat-red    { background: var(--danger-bg);  color: var(--danger); }
.stat-purple { background: #ede9fe;           color: var(--purple); }
.stat-pink   { background: #fce7f3;           color: var(--pink); }
.stat-teal   { background: #ccfbf1;           color: var(--teal); }

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex; align-items: center; gap: .5rem;
    padding: .55rem 1rem;
    background: var(--bg-elevated);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-weight: 500; font-size: 13.5px;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}
.btn:hover { background: var(--surface-2); border-color: var(--border-strong); }
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: 2px solid var(--primary-500); outline-offset: 2px; }
.btn svg { width: 16px; height: 16px; }
.btn-sm { padding: .35rem .7rem; font-size: 12.5px; }
.btn-sm svg { width: 14px; height: 14px; }
.btn-lg { padding: .8rem 1.5rem; font-size: 15px; }

.btn-primary { background: var(--primary-600); color: white; border-color: var(--primary-600); }
.btn-primary:hover { background: var(--primary-700); border-color: var(--primary-700); color: white; }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-success:hover { background: #059669; color: white; }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-danger:hover { background: #dc2626; color: white; }
.btn-warning { background: var(--warning); color: white; border-color: var(--warning); }
.btn-warning:hover { background: #d97706; color: white; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border); }
.btn-block { width: 100%; justify-content: center; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ============ FORMS ============ */
.form-group { margin-bottom: 1rem; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; }
.form-row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.form-row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

@media (max-width: 720px) {
    .form-row-2, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
}

.form-label {
    display: block; font-size: 12.5px; font-weight: 600;
    color: var(--text); margin-bottom: .35rem;
}
.form-label .required { color: var(--danger); }
.form-control {
    width: 100%;
    padding: .55rem .75rem;
    font-size: 13.5px;
    background: var(--bg-elevated);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    transition: all var(--transition);
    outline: none;
}
.form-control:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px var(--primary-100);
}
.form-control::placeholder { color: var(--text-light); }
.form-control:disabled { background: var(--surface-2); color: var(--text-muted); cursor: not-allowed; }
textarea.form-control { resize: vertical; min-height: 80px; font-family: inherit; }
select.form-control {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14L2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right .75rem center;
    padding-right: 2.25rem;
    appearance: none;
}
.form-error { color: var(--danger); font-size: 12px; margin-top: .25rem; }
.form-hint  { color: var(--text-muted); font-size: 12px; margin-top: .25rem; }

.input-group { display: flex; }
.input-group .form-control { border-radius: 0; }
.input-group .form-control:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.input-group .form-control:last-child  { border-radius: 0 var(--radius) var(--radius) 0; }
.input-group-prefix, .input-group-suffix {
    display: flex; align-items: center; padding: 0 .85rem;
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    color: var(--text-muted); font-size: 13px;
}
.input-group-prefix { border-radius: var(--radius) 0 0 var(--radius); border-right: 0; }
.input-group-suffix { border-radius: 0 var(--radius) var(--radius) 0; border-left: 0; }

.checkbox, .radio { display: inline-flex; align-items: center; gap: .5rem; cursor: pointer; }
.checkbox input, .radio input { width: 16px; height: 16px; accent-color: var(--primary-500); }

/* ============ TABLES ============ */
.table-wrap {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}
.table-wrap.scroll-x { overflow-x: auto; }
.table-toolbar {
    padding: .85rem 1.25rem;
    border-bottom: 1px solid var(--border-light);
    display: flex; align-items: center; gap: 1rem;
    flex-wrap: wrap;
}
.table-toolbar .grow { flex: 1; }

.table { width: 100%; }
.table th {
    text-align: left;
    padding: .65rem 1rem;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.table td {
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--border-light);
    font-size: 13.5px;
    vertical-align: middle;
}
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }

.table-empty { padding: 3rem 1.5rem; text-align: center; color: var(--text-muted); }
.table-empty svg { width: 48px; height: 48px; margin: 0 auto .75rem; color: var(--text-light); }

.pagination { display: flex; align-items: center; gap: .5rem; padding: 1rem 1.25rem; border-top: 1px solid var(--border-light); flex-wrap: wrap; }
.pagination .info { color: var(--text-muted); font-size: 12.5px; flex: 1; }
.pagination .pages { display: flex; gap: .25rem; }
.pagination a, .pagination span {
    padding: .35rem .7rem; font-size: 13px;
    border-radius: var(--radius-sm);
    color: var(--text-muted); border: 1px solid transparent;
}
.pagination a:hover { background: var(--surface-2); color: var(--text); }
.pagination .current { background: var(--primary-600); color: white; }
.pagination .disabled { opacity: .4; pointer-events: none; }

/* ============ BADGES ============ */
.badge {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px; font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}
.badge-success { background: var(--success-bg); color: #047857; }
.badge-warning { background: var(--warning-bg); color: #b45309; }
.badge-danger  { background: var(--danger-bg);  color: #b91c1c; }
.badge-info    { background: var(--info-bg);    color: #1e40af; }
.badge-purple  { background: #ede9fe;           color: #6d28d9; }
.badge-muted   { background: #f1f5f9;           color: #475569; }
.badge-bpjs    { background: #ecfdf5;           color: #047857; border: 1px solid #6ee7b7; }
.badge-umum    { background: #f1f5f9;           color: #334155; }
.badge-asuransi{ background: #fef3c7;           color: #92400e; }

.dot-status {
    width: 8px; height: 8px; border-radius: 50%;
    display: inline-block; margin-right: 4px;
}
.dot-success { background: var(--success); }
.dot-warning { background: var(--warning); }
.dot-danger  { background: var(--danger); }
.dot-info    { background: var(--info); }

.priority-p1 { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.priority-p2 { background: #ffedd5; color: #9a3412; border: 1px solid #fdba74; }
.priority-p3 { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.priority-p4 { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.priority-p5 { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }

/* ============ FLASH MESSAGES ============ */
.flash-container {
    position: fixed; top: 1rem; right: 1rem;
    display: flex; flex-direction: column; gap: .5rem;
    z-index: 1000; max-width: 420px;
}
.flash {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: var(--radius);
    padding: .85rem 1rem;
    box-shadow: var(--shadow-lg);
    display: flex; align-items: center; gap: .75rem;
    animation: slideInRight .25s ease-out;
}
.flash-success { border-left-color: var(--success); }
.flash-error,
.flash-danger  { border-left-color: var(--danger); }
.flash-warning { border-left-color: var(--warning); }
.flash-info    { border-left-color: var(--info); }
.flash-close { color: var(--text-muted); font-size: 18px; padding: 0 4px; }

@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }

/* ============ MODALS ============ */
.modal-backdrop {
    position: fixed; inset: 0;
    background: rgba(15,23,42,.5);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; padding: 1rem;
    animation: fadeIn .15s ease-out;
}
.modal {
    background: var(--bg-elevated);
    border-radius: var(--radius-lg);
    width: 100%; max-width: 540px;
    box-shadow: var(--shadow-xl);
    animation: zoomIn .2s ease-out;
    max-height: 90vh; display: flex; flex-direction: column;
}
.modal-header { padding: 1.25rem; border-bottom: 1px solid var(--border-light); }
.modal-body { padding: 1.25rem; overflow-y: auto; }
.modal-footer { padding: 1rem 1.25rem; border-top: 1px solid var(--border-light); display: flex; gap: .5rem; justify-content: flex-end; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes zoomIn { from { opacity: 0; transform: scale(.92); } to { opacity: 1; transform: scale(1); } }

/* ============ UTILITIES ============ */
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.justify-end { justify-content: flex-end; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.gap-1 { gap: .25rem; } .gap-2 { gap: .5rem; } .gap-3 { gap: .75rem; } .gap-4 { gap: 1rem; }

.mt-1 { margin-top: .25rem; } .mt-2 { margin-top: .5rem; } .mt-3 { margin-top: .75rem; } .mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: .25rem; } .mb-2 { margin-bottom: .5rem; } .mb-3 { margin-bottom: .75rem; } .mb-4 { margin-bottom: 1rem; }

.p-1 { padding: .25rem; } .p-2 { padding: .5rem; } .p-3 { padding: .75rem; } .p-4 { padding: 1rem; }

.text-xs { font-size: 11.5px; } .text-sm { font-size: 12.5px; } .text-base { font-size: 14px; }
.text-lg { font-size: 16px; } .text-xl { font-size: 18px; } .text-2xl { font-size: 22px; } .text-3xl { font-size: 28px; }
.font-medium { font-weight: 500; } .font-semibold { font-weight: 600; } .font-bold { font-weight: 700; }
.text-muted { color: var(--text-muted); }
.text-light { color: var(--text-light); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-info { color: var(--info); }
.text-primary { color: var(--primary-600); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-mono { font-family: var(--font-mono); }

.w-full { width: 100%; }
.rounded { border-radius: var(--radius); }
.shadow { box-shadow: var(--shadow); }

.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 1rem 0; }

/* ============ LAYOUT GRIDS ============ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
@media (max-width: 1024px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 720px)  { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* ============ AUTH PAGE ============ */
.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--bg);
}
.auth-hero {
    background: linear-gradient(135deg, var(--primary-700), var(--primary-900));
    color: white;
    display: flex; flex-direction: column;
    justify-content: center; padding: 3rem;
    position: relative; overflow: hidden;
}
.auth-hero::before {
    content: ''; position: absolute; inset: 0;
    background: radial-gradient(800px circle at 90% 20%, rgba(255,255,255,.08), transparent 50%),
                radial-gradient(600px circle at 10% 80%, rgba(255,255,255,.05), transparent 50%);
}
.auth-hero > * { position: relative; }
.auth-hero h1 { font-size: 2.5rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; margin-bottom: 1.25rem; }
.auth-hero p { font-size: 16px; opacity: .85; line-height: 1.65; margin-bottom: 1.5rem; max-width: 480px; }
.auth-features { display: flex; flex-direction: column; gap: .75rem; margin-top: 2rem; }
.auth-feature { display: flex; gap: .75rem; align-items: flex-start; max-width: 480px; }
.auth-feature-icon { width: 36px; height: 36px; border-radius: 10px; background: rgba(255,255,255,.12); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.auth-feature-icon svg { width: 18px; height: 18px; }
.auth-feature-text strong { display: block; font-weight: 600; margin-bottom: 2px; }
.auth-feature-text span { opacity: .8; font-size: 13.5px; }

.auth-form-wrap {
    display: flex; flex-direction: column;
    justify-content: center; padding: 3rem;
}
.auth-form { max-width: 420px; width: 100%; margin: 0 auto; }
.auth-logo { display: flex; align-items: center; gap: .75rem; margin-bottom: 2.25rem; }
.auth-logo .logo-mark { width: 44px; height: 44px; border-radius: 12px; background: linear-gradient(135deg, var(--primary-500), var(--primary-700)); display: flex; align-items: center; justify-content: center; color: white; font-weight: 800; font-size: 18px; }
.auth-logo .logo-text strong { font-size: 18px; }
.auth-form h2 { font-size: 1.75rem; font-weight: 700; letter-spacing: -.02em; margin-bottom: .35rem; }
.auth-form .lead { color: var(--text-muted); margin-bottom: 1.75rem; }

@media (max-width: 900px) { .auth-page { grid-template-columns: 1fr; } .auth-hero { display: none; } }

/* ============ TIMELINE ============ */
.timeline { position: relative; padding-left: 1.5rem; }
.timeline::before {
    content: ''; position: absolute; left: 7px; top: 8px; bottom: 8px;
    width: 2px; background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 1.25rem; }
.timeline-item::before {
    content: ''; position: absolute; left: -1.5rem; top: 4px;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--bg-elevated); border: 3px solid var(--primary-500);
}
.timeline-time { font-size: 11.5px; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.timeline-title { font-weight: 600; margin: 2px 0; }

/* ============ BED MAP ============ */
.bed-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: .75rem;
}
.bed-card {
    background: var(--bg-elevated);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: .85rem;
    text-align: center;
    transition: all var(--transition);
}
.bed-card.available { border-color: var(--success); background: var(--success-bg); }
.bed-card.occupied  { border-color: var(--danger);  background: var(--danger-bg); }
.bed-card.reserved  { border-color: var(--warning); background: var(--warning-bg); }
.bed-card.maintenance { border-color: var(--text-light); background: var(--surface-2); }
.bed-card .bed-icon { width: 32px; height: 32px; margin: 0 auto .5rem; }
.bed-card .bed-label { font-weight: 600; font-size: 13px; }
.bed-card .bed-status { font-size: 11.5px; color: var(--text-muted); margin-top: 2px; }

/* ============ INVOICE PRINT ============ */
.invoice-doc {
    background: white;
    max-width: 800px; margin: 0 auto;
    padding: 2.5rem;
    color: #111;
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-lg);
}
.invoice-header { display: flex; justify-content: space-between; padding-bottom: 1.5rem; border-bottom: 2px solid #111; margin-bottom: 2rem; }
.invoice-header h1 { font-size: 28px; }
.invoice-meta { text-align: right; font-size: 13px; }
.invoice-table { width: 100%; }
.invoice-table th, .invoice-table td { padding: .65rem; border-bottom: 1px solid #ddd; font-size: 13px; }
.invoice-table th { background: #f5f5f5; }
.invoice-totals { margin-left: auto; max-width: 320px; margin-top: 1rem; }
.invoice-totals .row { display: flex; justify-content: space-between; padding: .35rem 0; }
.invoice-totals .total { font-size: 18px; font-weight: 700; border-top: 2px solid #111; padding-top: .5rem; margin-top: .5rem; }

@media print {
    .sidebar, .topbar, .page-actions { display: none !important; }
    .main { padding: 0 !important; }
    .app-shell { display: block !important; }
    body { background: white !important; }
    .invoice-doc { box-shadow: none; border-radius: 0; }
}

/* ============ CHARTS ============ */
.chart-container { position: relative; height: 280px; }

/* ============ DROPDOWN ============ */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
    position: absolute; right: 0; top: calc(100% + 6px);
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 200px; padding: .35rem;
    display: none;
    z-index: 50;
}
.dropdown-menu.open { display: block; }
.dropdown-item {
    display: flex; align-items: center; gap: .5rem;
    padding: .5rem .75rem; font-size: 13.5px;
    color: var(--text); border-radius: var(--radius-sm);
}
.dropdown-item:hover { background: var(--surface-2); }
.dropdown-item.danger:hover { background: var(--danger-bg); color: var(--danger); }
.dropdown-divider { height: 1px; background: var(--border); margin: .25rem 0; }

/* ============ MOBILE ============ */
.mobile-toggle { display: none; }
@media (max-width: 1024px) {
    .app-shell { grid-template-columns: 1fr; grid-template-areas: "topbar" "main"; }
    .sidebar {
        position: fixed; top: 0; bottom: 0; left: 0;
        transform: translateX(-100%);
        transition: transform var(--transition);
        width: 280px;
        z-index: 50;
    }
    .sidebar.open { transform: translateX(0); box-shadow: var(--shadow-xl); }
    .topbar-search { max-width: none; }
    .mobile-toggle { display: flex; }
}

/* ============ ANIMATION ============ */
.fade-in { animation: fadeIn .3s ease-out; }
.slide-up { animation: slideUp .3s ease-out; }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
