/* ============================================================
   MERIDIAN PATIENT PORTAL — DESIGN SYSTEM
   ============================================================ */

/* --- Tokens --- */
:root {
  --bg: #f5f4f0;
  --ink: #0e1116;
  --muted-1: #6b6b6b;
  --muted-2: #8f8f8a;
  --muted-3: #a0a0a0;
  --warm: #c47f5a;
  --warm-dark: #8a5a34;
  --warm-light: #faede0;
  --green: #4a8259;
  --green-light: #eef3ec;
  --purple: #5a4a7a;
  --purple-light: #f0eef5;
  --blue-light: #eef2f7;
  --blue-dark: #3a4a5c;
  --card-radius: 18px;
  --border: rgba(0,0,0,.04);
  --shadow-card: 0 1px 3px rgba(0,0,0,.03), 0 8px 24px -12px rgba(0,0,0,.06);
  --shadow-card-hover: 0 4px 12px rgba(0,0,0,.08), 0 16px 40px -16px rgba(0,0,0,.12);
  --font-serif: 'Instrument Serif', serif;
  --font-sans: 'Geist', 'Inter', -apple-system, sans-serif;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* --- Ambient Background --- */
.bg-ambience {
  position: fixed; top: 0; left: calc(50% - 720px); width: 1440px; height: 100vh;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(90,120,180,.08), transparent 60%),
    radial-gradient(900px 500px at 10% 20%, rgba(180,140,110,.06), transparent 60%);
  pointer-events: none; z-index: 0;
}

/* --- Shell --- */
.shell { width: 1440px; margin: 0 auto; display: flex; min-height: 100vh; position: relative; }

/* --- Sidebar --- */
.sidebar {
  width: 260px; background: transparent; position: fixed; top: 0; left: calc(50% - 720px);
  height: 100vh; display: flex; flex-direction: column; padding: 24px 18px; z-index: 2;
}
.logo { display: flex; align-items: center; gap: 12px; padding: 6px 10px 24px; cursor: pointer; }
.logo-mark {
  width: 36px; height: 36px; background: linear-gradient(135deg,#1a1f2e,#2c3448); border-radius: 10px;
  display: flex; align-items: center; justify-content: center; color: #fff;
  font-family: var(--font-serif); font-size: 20px; font-style: italic;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}
.logo-text { font-weight: 600; font-size: 16px; color: var(--ink); letter-spacing: -.01em; }
.logo-text small { display: block; font-size: 11px; font-weight: 400; color: var(--muted-1); letter-spacing: 0; }
.nav-group { margin-top: 8px; }
.nav-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted-2); font-weight: 500; padding: 14px 12px 8px; }
.nav-item {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px;
  color: #3a3a3a; font-weight: 500; font-size: 13.5px; cursor: pointer; margin-bottom: 1px;
  justify-content: space-between; transition: all .15s; border: none; background: none;
  width: 100%; text-align: left; font-family: inherit;
}
.nav-item:hover { background: rgba(0,0,0,.04); }
.nav-item.active { background: var(--ink); color: #fff; box-shadow: 0 4px 12px rgba(14,17,22,.15); }
.nav-item.active .ico { color: #fff; }
.nav-left { display: flex; align-items: center; gap: 11px; }
.ico { width: 16px; height: 16px; color: var(--muted-1); display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.ico svg { width: 100%; height: 100%; }
.badge { background: var(--warm); color: #fff; font-size: 10.5px; padding: 1px 7px; border-radius: 20px; font-weight: 600; }
.nav-item.active .badge { background: rgba(255,255,255,.2); }
.badge.dot-b { background: #e4e2dc; color: #3a3a3a; }
.sidebar-footer {
  margin-top: auto; padding: 12px; border-radius: 14px;
  background: rgba(255,255,255,.6); backdrop-filter: blur(20px);
  border: 1px solid rgba(0,0,0,.05); cursor: pointer; transition: background .15s;
}
.sidebar-footer:hover { background: rgba(255,255,255,.85); }
.user-card { display: flex; align-items: center; gap: 11px; }
.avatar {
  width: 36px; height: 36px; border-radius: 12px;
  background: linear-gradient(135deg,#7a8ba8,#4a5568); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 12.5px; font-family: var(--font-sans); flex-shrink: 0;
}
.user-name { font-weight: 600; font-size: 13.5px; letter-spacing: -.01em; }
.user-meta { font-size: 11.5px; color: var(--muted-2); }
.logout-ico { color: var(--muted-2); display: flex; transition: color .15s; }
.sidebar-footer:hover .logout-ico { color: var(--ink); }

/* --- Main --- */
.main { margin-left: 260px; flex: 1; position: relative; z-index: 1; }

/* --- Header --- */
.header {
  padding: 22px 40px 8px; display: flex; align-items: center; gap: 20px;
  position: sticky; top: 0; z-index: 10;
  background: rgba(245,244,240,.85); backdrop-filter: blur(12px);
}
.breadcrumb { font-size: 12.5px; color: var(--muted-2); display: flex; align-items: center; gap: 6px; }
.crumb-current { color: var(--ink); font-weight: 500; display: inline-flex; align-items: center; gap: 4px; }
.crumb-link { cursor: pointer; display: inline-flex; align-items: center; gap: 4px; transition: color .15s; }
.crumb-link:hover { color: var(--ink); }
.crumb-sep { color: var(--muted-3); }
.breadcrumb b { color: var(--ink); font-weight: 500; }
.search { flex: 1; max-width: 440px; position: relative; margin-left: 20px; }
.search input {
  width: 100%; padding: 10px 14px 10px 38px; border: 1px solid rgba(0,0,0,.08);
  border-radius: 12px; font-family: inherit; font-size: 13px;
  background: rgba(255,255,255,.7); backdrop-filter: blur(8px); color: var(--ink);
}
.search input::placeholder { color: var(--muted-3); }
.search input:focus { outline: none; border-color: var(--ink); background: #fff; }
.search-icon { position: absolute; left: 13px; top: 12px; color: var(--muted-3); display: flex; }
.kbd { position: absolute; right: 12px; top: 9px; font-size: 11px; color: var(--muted-2); background: #ececea; padding: 2px 6px; border-radius: 5px; }
.header-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.iconbtn {
  width: 40px; height: 40px; border: 1px solid rgba(0,0,0,.06);
  background: rgba(255,255,255,.7); backdrop-filter: blur(8px); border-radius: 11px;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  color: #3a3a3a; position: relative; transition: background .15s; font-family: inherit;
}
.iconbtn:hover { background: #fff; }
.iconbtn .notif-dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; background: var(--warm); border-radius: 50%; border: 2px solid var(--bg); }

/* --- Buttons --- */
.btn {
  padding: 10px 16px; border-radius: 11px; font-family: inherit; font-size: 13px;
  font-weight: 500; cursor: pointer; border: 1px solid transparent;
  display: inline-flex; align-items: center; gap: 7px; letter-spacing: -.005em;
  transition: all .15s; line-height: 1.2;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary { background: var(--ink); color: #fff; box-shadow: 0 4px 12px rgba(14,17,22,.18); }
.btn-primary:hover:not(:disabled) { background: #1e232e; }
.btn-ghost { background: rgba(255,255,255,.7); color: var(--ink); border-color: rgba(0,0,0,.06); backdrop-filter: blur(8px); }
.btn-ghost:hover:not(:disabled) { background: #fff; }
.btn-warm { background: var(--warm); color: #fff; border-color: transparent; }
.btn-warm:hover:not(:disabled) { background: #b3704e; }
.btn-glass { background: rgba(255,255,255,.1); color: #fff; border-color: rgba(255,255,255,.18); backdrop-filter: blur(8px); }
.btn-glass:hover:not(:disabled) { background: rgba(255,255,255,.18); }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }

/* --- Content Area --- */
.content { padding: 16px 40px 60px; }

/* --- Page Title --- */
.page-title { padding: 8px 0 24px; }
.page-title h1 { font-family: var(--font-serif); font-size: 34px; font-weight: 400; letter-spacing: -.02em; }
.page-title p { font-size: 14.5px; color: var(--muted-1); margin-top: 4px; }
.page-title-row { display: flex; justify-content: space-between; align-items: center; }

/* --- Hero / Greeting --- */
.hero { padding: 8px 0 28px; }
.greet { font-family: var(--font-serif); font-size: 44px; font-weight: 400; color: var(--ink); letter-spacing: -.02em; line-height: 1.05; }
.greet em { font-style: italic; color: #8a6f4f; }
.hero-sub { font-size: 14.5px; color: var(--muted-1); margin-top: 8px; max-width: 640px; }
.hero-meta { display: flex; gap: 24px; margin-top: 16px; font-size: 13px; color: #3a3a3a; }
.hero-meta span { display: inline-flex; align-items: center; gap: 6px; }
.hero-meta .sync-dot { width: 6px; height: 6px; background: #5a8a5a; border-radius: 50%; animation: syncPulse 2s ease-in-out infinite; }
@keyframes syncPulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }

/* --- Featured Card --- */
.featured {
  background: linear-gradient(135deg,#1a1f2e 0%,#2d3548 55%,#3d4863 100%);
  color: #fff; border-radius: 20px; padding: 28px 32px; margin-bottom: 24px;
  position: relative; overflow: hidden;
  box-shadow: 0 20px 50px -20px rgba(14,17,22,.35);
}
.featured::before {
  content: ''; position: absolute; top: -40%; right: -10%; width: 500px; height: 500px;
  background: radial-gradient(circle,rgba(196,127,90,.25),transparent 60%); pointer-events: none;
  animation: glowDrift 8s ease-in-out infinite alternate;
}
.featured::after {
  content: ''; position: absolute; bottom: -60%; left: 20%; width: 400px; height: 400px;
  background: radial-gradient(circle,rgba(120,150,200,.2),transparent 60%); pointer-events: none;
  animation: glowDrift 10s ease-in-out infinite alternate-reverse;
}
@keyframes glowDrift { 0% { transform: translate(0, 0); } 100% { transform: translate(20px, -10px); } }
.featured-inner { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 32px; }
.featured-tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 20px;
  background: rgba(255,255,255,.12); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.15); font-size: 11.5px; font-weight: 500;
  letter-spacing: .02em; text-transform: uppercase; color: #e5d4c4;
}
.featured h2 { font-family: var(--font-serif); font-size: 30px; font-weight: 400; letter-spacing: -.01em; margin-top: 14px; line-height: 1.2; max-width: 520px; }
.featured p { font-size: 14px; color: rgba(255,255,255,.72); margin-top: 10px; max-width: 520px; }
.featured-actions { display: flex; gap: 10px; margin-top: 20px; }
.featured-actions .btn { padding: 11px 18px; }
.featured-side { width: 200px; flex-shrink: 0; text-align: right; }
.countdown { font-family: var(--font-serif); font-size: 64px; font-style: italic; line-height: 1; color: #fff; }
.countdown small { font-size: 14px; font-style: normal; font-family: var(--font-sans); color: rgba(255,255,255,.6); display: block; margin-top: 6px; letter-spacing: .05em; text-transform: uppercase; font-weight: 500; }

/* --- Progress Bar --- */
.progress-mini { margin-top: 16px; }
.progress-mini-label { display: flex; justify-content: space-between; font-size: 11.5px; color: rgba(255,255,255,.7); margin-bottom: 6px; letter-spacing: .03em; text-transform: uppercase; font-weight: 500; }
.progress-bar { height: 5px; background: rgba(255,255,255,.15); border-radius: 10px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg,var(--warm),#e5a582); border-radius: 10px; transition: width .6s ease; }

/* --- Stats Bar --- */
.stats-bar {
  display: grid; grid-template-columns: repeat(4,1fr); gap: 0; background: #fff;
  border-radius: 16px; padding: 0; margin-bottom: 24px;
  box-shadow: var(--shadow-card); border: 1px solid var(--border);
}
.stat { padding: 20px 24px; border-right: 1px solid #f0eee9; }
.stat:last-child { border-right: none; }
.stat-lbl { font-size: 11.5px; color: var(--muted-2); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.stat-val { font-size: 26px; font-weight: 500; color: var(--ink); margin-top: 6px; letter-spacing: -.02em; display: flex; align-items: baseline; gap: 8px; }
.stat-val small { font-size: 12px; color: var(--muted-2); font-weight: 400; letter-spacing: 0; }
.stat-trend { margin-top: 6px; font-size: 12px; color: var(--muted-1); display: flex; align-items: center; gap: 6px; }
.trend-up { color: var(--green); font-weight: 500; }
.trend-down { color: var(--warm); font-weight: 500; }

/* --- Layout Grid --- */
.layout { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; }
.col-stack { display: flex; flex-direction: column; gap: 20px; }

/* --- Cards --- */
.card {
  background: #fff; border-radius: var(--card-radius); overflow: hidden;
  box-shadow: var(--shadow-card); border: 1px solid var(--border);
}
.card-head { padding: 20px 24px 16px; display: flex; justify-content: space-between; align-items: flex-start; }
.card-head h3 { font-size: 16px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.card-head p { font-size: 12.5px; color: var(--muted-2); margin-top: 3px; }
.card-head-r { display: flex; align-items: center; gap: 8px; }
.link { color: var(--ink); font-size: 12.5px; font-weight: 500; text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 8px; transition: background .15s; }
.link:hover { background: var(--bg); }

/* --- Tabs --- */
.tabs { display: inline-flex; background: var(--bg); border-radius: 10px; padding: 3px; font-size: 12.5px; }
.tab { padding: 5px 11px; border-radius: 8px; cursor: pointer; color: var(--muted-1); font-weight: 500; transition: all .15s; }
.tab.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.tab:hover:not(.active) { color: var(--ink); }

/* --- Pills --- */
.pill { font-size: 11px; padding: 3px 9px; border-radius: 20px; font-weight: 500; letter-spacing: .01em; border: 1px solid transparent; display: inline-flex; align-items: center; gap: 4px; }
.pill.slate { background: var(--blue-light); color: var(--blue-dark); border-color: #dfe6ee; }
.pill.moss { background: var(--green-light); color: #4a6b4a; border-color: #dbe5d7; }
.pill.warm { background: var(--warm-light); color: var(--warm-dark); border-color: #f0dcc4; }
.pill.mist { background: var(--purple-light); color: var(--purple); border-color: #e3ddf0; }

/* --- Appointments --- */
.appt { display: flex; gap: 16px; padding: 16px 24px; border-top: 1px solid var(--bg); align-items: center; }
.appt-time { width: 64px; text-align: left; }
.appt-time .day-num { font-family: var(--font-serif); font-size: 26px; color: var(--ink); line-height: 1; font-weight: 400; }
.appt-time .day-label { font-size: 11px; text-transform: uppercase; color: var(--muted-2); font-weight: 500; margin-top: 3px; letter-spacing: .05em; }
.appt-time .day-time { font-size: 12px; color: #3a3a3a; margin-top: 6px; font-weight: 500; }
.appt-divider { width: 1px; background: #f0eee9; align-self: stretch; }
.appt-body { flex: 1; }
.appt-body h4 { font-size: 14.5px; font-weight: 600; color: var(--ink); letter-spacing: -.005em; }
.appt-detail { font-size: 12.5px; color: var(--muted-1); margin-top: 4px; display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.appt-detail span { display: inline-flex; align-items: center; gap: 5px; }
.appt-pills { margin-top: 8px; display: flex; gap: 6px; flex-wrap: wrap; }

/* --- Health Snapshot --- */
.snapshot { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 0 24px 24px; }
.metric { padding: 16px; border-radius: 14px; background: linear-gradient(180deg,#faf9f6,var(--bg)); border: 1px solid var(--border); position: relative; overflow: hidden; transition: box-shadow .2s; }
.metric:hover { box-shadow: 0 4px 16px -4px rgba(0,0,0,.08); }
.metric-top { display: flex; justify-content: space-between; align-items: center; }
.metric-lbl { font-size: 11.5px; color: var(--muted-2); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; }
.metric-src { font-size: 10.5px; color: var(--muted-3); background: rgba(255,255,255,.6); padding: 2px 7px; border-radius: 6px; font-weight: 500; }
.metric-val { font-family: var(--font-serif); font-size: 34px; font-weight: 400; color: var(--ink); margin-top: 8px; letter-spacing: -.02em; line-height: 1; }
.metric-val small { font-size: 12px; color: var(--muted-2); font-family: var(--font-sans); margin-left: 4px; }
.metric-status { margin-top: 8px; font-size: 12px; display: flex; align-items: center; gap: 6px; color: var(--muted-1); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.status-good { background: var(--green); }
.status-warn { background: var(--warm); }
.sparkline-wrap { margin-top: 10px; height: 32px; position: relative; width: 100%; }

/* --- Activity Items --- */
.activity-item { padding: 16px 24px; border-top: 1px solid var(--bg); display: flex; gap: 14px; align-items: flex-start; transition: background .1s; }
.activity-item:hover { background: #faf9f6; }
.item-ico { width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.item-flex { flex: 1; }
.activity-item h4 { font-size: 13.5px; font-weight: 600; color: var(--ink); letter-spacing: -.005em; }
.activity-item p { font-size: 12.5px; color: var(--muted-1); margin-top: 3px; }
.activity-item .time { font-size: 11.5px; color: var(--muted-3); margin-top: 5px; display: flex; gap: 8px; align-items: center; }

/* --- Bills Card --- */
.bill-hero { padding: 24px; background: linear-gradient(160deg,#faf6f0,#f5ede0); position: relative; overflow: hidden; }
.bill-hero::before { content: ''; position: absolute; top: -50%; right: -30%; width: 300px; height: 300px; background: radial-gradient(circle,rgba(196,127,90,.15),transparent 60%); }
.bill-lbl { font-size: 11.5px; color: var(--warm-dark); font-weight: 500; text-transform: uppercase; letter-spacing: .06em; position: relative; }
.bill-amt { font-family: var(--font-serif); font-size: 48px; font-weight: 400; color: var(--ink); margin-top: 6px; letter-spacing: -.02em; line-height: 1; position: relative; }
.bill-due { font-size: 12.5px; color: var(--warm-dark); margin-top: 8px; font-weight: 500; position: relative; display: flex; align-items: center; gap: 6px; }
.bill-list { padding: 8px 0; }
.bill-row { padding: 12px 24px; display: flex; justify-content: space-between; align-items: center; font-size: 13px; border-top: 1px solid var(--bg); transition: background .1s; }
.bill-row:first-child { border-top: none; }
.bill-row:hover { background: #faf9f6; }
.bill-row .desc { color: #3a3a3a; }
.bill-row .desc small { display: block; font-size: 11px; color: var(--muted-2); margin-top: 2px; }
.bill-row .amt-c { color: var(--ink); font-weight: 600; }
.bill-cta { padding: 16px 24px; display: flex; gap: 8px; }
.bill-cta .btn { flex: 1; justify-content: center; }

/* --- Quick Actions --- */
.qa-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 8px 20px 20px; }
.qa { padding: 14px; border: 1px solid rgba(0,0,0,.05); border-radius: 12px; text-align: left; background: #faf9f6; cursor: pointer; transition: all .18s; font-family: inherit; }
.qa:hover { background: #fff; border-color: var(--ink); transform: translateY(-2px); box-shadow: 0 6px 20px -8px rgba(0,0,0,.15); }
.qa-ico { width: 34px; height: 34px; border-radius: 10px; background: var(--ink); color: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: 10px; }
.qa b { font-size: 13px; color: var(--ink); font-weight: 600; display: block; letter-spacing: -.005em; }
.qa p { font-size: 11.5px; color: var(--muted-2); margin-top: 3px; }

/* --- Messages Preview --- */
.msg-row { padding: 14px 24px; border-top: 1px solid var(--bg); display: flex; gap: 12px; align-items: flex-start; cursor: pointer; transition: background .1s; }
.msg-row:hover { background: #faf9f6; }
.msg-av { width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12px; }
.msg-flex { flex: 1; min-width: 0; }
.msg-top { display: flex; justify-content: space-between; align-items: center; }
.msg-top b { font-size: 13.5px; font-weight: 600; color: var(--ink); letter-spacing: -.005em; }
.msg-top .ts { font-size: 11px; color: var(--muted-3); }
.msg-row p { font-size: 12.5px; color: var(--muted-1); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.msg-row.unread .msg-top b::before { content: ''; display: inline-block; width: 6px; height: 6px; background: var(--warm); border-radius: 50%; margin-right: 7px; vertical-align: middle; }
.msg-role { font-size: 10.5px; color: var(--muted-3); margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; font-weight: 500; }

/* --- Care Team --- */
.team { padding: 6px 24px 20px; }
.team-row { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--bg); }
.team-row:first-child { border-top: none; }
.team-av { width: 40px; height: 40px; border-radius: 12px; flex-shrink: 0; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 12.5px; }
.team-info { flex: 1; }
.team-info b { font-size: 13.5px; color: var(--ink); font-weight: 600; letter-spacing: -.005em; }
.team-info p { font-size: 12px; color: var(--muted-2); margin-top: 1px; }
.team-btn { width: 32px; height: 32px; border: 1px solid rgba(0,0,0,.06); background: #fff; border-radius: 10px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: #3a3a3a; transition: all .15s; font-family: inherit; }
.team-btn:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

/* --- Footer --- */
footer { padding: 24px 0; font-size: 12px; color: var(--muted-2); display: flex; justify-content: space-between; }
footer a, .footer-link { color: var(--muted-1); margin-left: 16px; text-decoration: none; cursor: pointer; transition: color .15s; }
.footer-link:hover { color: var(--ink); }

/* --- Toast --- */
#toast-container { position: fixed; top: 24px; right: 24px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 12px 18px; background: var(--ink); color: #fff; border-radius: 12px; font-size: 13px; box-shadow: 0 8px 30px -8px rgba(0,0,0,.3); transform: translateX(120%); transition: transform .3s cubic-bezier(.4,0,.2,1), opacity .3s; opacity: 0; max-width: 380px; }
.toast.toast-show { transform: translateX(0); opacity: 1; }
.toast.toast-hide { transform: translateX(120%); opacity: 0; }
.toast-icon { display: flex; flex-shrink: 0; }
.toast-success { background: #1a3a24; }
.toast-error { background: #3a1a1a; }
.toast-warning { background: #3a2a1a; }

/* --- Modal --- */
.modal-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; z-index: 1000; background: rgba(14,17,22,.5); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .2s; }
.modal-overlay.modal-visible { opacity: 1; }
.modal-box { background: #fff; border-radius: 20px; width: 500px; max-height: 85vh; overflow-y: auto; box-shadow: 0 24px 60px -12px rgba(0,0,0,.3); transform: scale(.95); transition: transform .2s cubic-bezier(.4,0,.2,1); }
.modal-visible .modal-box { transform: scale(1); }
.modal-head { padding: 24px 24px 16px; display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-size: 18px; font-weight: 600; }
.modal-close-btn { background: none; border: none; cursor: pointer; color: var(--muted-2); padding: 4px; border-radius: 8px; display: flex; font-family: inherit; transition: all .15s; }
.modal-close-btn:hover { background: var(--bg); color: var(--ink); }
.modal-body { padding: 0 24px 20px; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--bg); display: flex; gap: 8px; justify-content: flex-end; }
.detail-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f5f4f0; font-size: 13.5px; }
.detail-label { color: var(--muted-2); font-weight: 500; }
.modal-check { display: flex; align-items: center; gap: 8px; font-size: 13px; margin-top: 8px; cursor: pointer; }
.modal-check input { accent-color: var(--ink); }

/* --- Forms --- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 500; color: var(--muted-2); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 6px; }
.form-input { width: 100%; padding: 10px 14px; border: 1px solid rgba(0,0,0,.1); border-radius: 10px; font-family: inherit; font-size: 13.5px; color: var(--ink); background: #fff; transition: border-color .15s; }
.form-input:focus { outline: none; border-color: var(--ink); }
select.form-input { cursor: pointer; }

/* --- Dropdown --- */
.dropdown { position: relative; display: inline-block; }
.dropdown-trigger { display: flex; align-items: center; gap: 8px; padding: 9px 14px; border: 1px solid rgba(0,0,0,.08); border-radius: 10px; background: #fff; font-family: inherit; font-size: 13px; cursor: pointer; color: var(--ink); min-width: 140px; justify-content: space-between; transition: border-color .15s; }
.dropdown-trigger:hover { border-color: rgba(0,0,0,.15); }
.dropdown.open .dropdown-trigger { border-color: var(--ink); }
.dropdown-menu { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: #fff; border: 1px solid rgba(0,0,0,.08); border-radius: 12px; box-shadow: 0 8px 30px -8px rgba(0,0,0,.15); z-index: 100; display: none; overflow: hidden; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-option { padding: 9px 14px; font-size: 13px; cursor: pointer; transition: background .1s; }
.dropdown-option:hover { background: var(--bg); }
.dropdown-option.selected { background: var(--bg); font-weight: 500; }
.filter-bar { display: flex; gap: 10px; padding: 0 24px 20px; flex-wrap: wrap; }

/* --- Login --- */
.login-page { width: 1440px; margin: 0 auto; min-height: 100vh; display: flex; align-items: center; justify-content: center; position: relative; }
.login-bg { position: absolute; inset: 0; background: radial-gradient(800px 400px at 30% 20%, rgba(90,120,180,.1), transparent 60%), radial-gradient(600px 400px at 70% 80%, rgba(196,127,90,.08), transparent 60%); pointer-events: none; }
.login-container { position: relative; text-align: center; width: 440px; }
.login-logo { display: flex; align-items: center; gap: 14px; justify-content: center; margin-bottom: 32px; }
.login-title { font-family: var(--font-serif); font-size: 38px; font-weight: 400; margin-bottom: 8px; letter-spacing: -.02em; }
.login-subtitle { font-size: 15px; color: var(--muted-1); margin-bottom: 32px; }
.login-cards { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.login-card { display: flex; align-items: center; gap: 14px; padding: 16px 20px; background: rgba(255,255,255,.7); backdrop-filter: blur(12px); border: 2px solid rgba(0,0,0,.06); border-radius: 16px; cursor: pointer; transition: all .18s; text-align: left; }
.login-card:hover { border-color: rgba(0,0,0,.12); background: rgba(255,255,255,.9); }
.login-card.selected { border-color: var(--ink); background: #fff; box-shadow: 0 4px 16px -4px rgba(14,17,22,.15); }
.login-avatar { width: 48px; height: 48px; border-radius: 14px; color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 16px; flex-shrink: 0; }
.login-card-info { flex: 1; }
.login-card-name { font-weight: 600; font-size: 15px; }
.login-card-role { font-size: 12px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .04em; font-weight: 500; margin-top: 2px; }
.login-card-meta { font-size: 12px; color: var(--muted-3); margin-top: 2px; }
.login-card-check { width: 24px; height: 24px; border: 2px solid rgba(0,0,0,.1); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: transparent; transition: all .15s; }
.login-card.selected .login-card-check { background: var(--ink); border-color: var(--ink); color: #fff; }
.login-submit { width: 100%; justify-content: center; padding: 14px; font-size: 15px; }
.login-footer { font-size: 12px; color: var(--muted-3); margin-top: 20px; }

/* --- Schedule Screen --- */
.slots-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 0 24px 24px; }
.slot-card { padding: 16px; border: 1px solid var(--border); border-radius: 14px; background: #faf9f6; transition: all .18s; }
.slot-card:hover { border-color: rgba(0,0,0,.1); background: #fff; box-shadow: var(--shadow-card); transform: translateY(-1px); }
.slot-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.slot-provider { font-weight: 600; font-size: 13.5px; }
.slot-details { display: flex; gap: 16px; font-size: 12.5px; color: var(--muted-1); margin-bottom: 8px; }
.slot-details span { display: flex; align-items: center; gap: 4px; }
.slot-location { font-size: 12px; color: var(--muted-2); display: flex; align-items: center; gap: 4px; margin-bottom: 12px; }
.slot-book { width: 100%; justify-content: center; }

/* --- Pre-admission --- */
.pre-admission-item { border-top: 1px solid var(--bg); }
.pre-admission-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; cursor: pointer; transition: background .1s; }
.pre-admission-header:hover { background: #faf9f6; }
.pre-admission-header h4 { font-size: 14.5px; font-weight: 600; }
.pre-admission-meta { font-size: 12.5px; color: var(--muted-2); margin-top: 4px; display: flex; align-items: center; gap: 8px; }
.pre-chevron { transition: transform .2s; display: flex; }
.pre-admission-item.expanded .pre-chevron { transform: rotate(180deg); }
.pre-admission-body { display: none; padding: 0 24px 16px; }
.pre-admission-item.expanded .pre-admission-body { display: block; }
.chk-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid #f5f4f0; }
.chk-row:last-child { border-bottom: none; }
.chk-done { color: var(--green); display: flex; }
.chk-pending { color: var(--muted-3); display: flex; }
.chk-label { flex: 1; font-size: 13.5px; }
.chk-row.complete .chk-label { color: var(--muted-2); text-decoration: line-through; }
.chk-caregiver-note { font-size: 12px; color: var(--warm); display: flex; align-items: center; gap: 4px; }

/* --- Records Screen --- */
.record-card { display: flex; gap: 14px; padding: 16px 20px; background: #fff; border-radius: 14px; margin-bottom: 8px; border: 1px solid var(--border); box-shadow: var(--shadow-card); align-items: flex-start; transition: all .18s; }
.record-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-1px); }
.record-card.restricted { opacity: .6; }
.record-card.restricted:hover { box-shadow: var(--shadow-card); transform: none; }
.record-info { flex: 1; }
.record-info h4 { font-size: 14px; font-weight: 600; }
.record-info p { font-size: 12.5px; color: var(--muted-1); margin-top: 4px; }
.record-meta { display: flex; gap: 12px; margin-top: 6px; font-size: 11.5px; color: var(--muted-3); }
.record-source { background: var(--bg); padding: 1px 8px; border-radius: 6px; font-weight: 500; }
.record-actions { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.restricted-msg { font-size: 13px; color: var(--warm); font-style: italic; }

/* --- Lab table --- */
.lab-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.lab-table th { text-align: left; padding: 8px 12px; background: var(--bg); font-weight: 500; color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.lab-table td { padding: 10px 12px; border-bottom: 1px solid #f5f4f0; }
.lab-value { font-weight: 600; }
.lab-high td { color: var(--warm-dark); }
.interpretation { margin-top: 16px; padding: 12px 16px; background: var(--bg); border-radius: 10px; font-size: 13px; color: var(--muted-1); }
.mono-text { font-family: 'SF Mono', 'Fira Code', monospace; font-size: 11px; color: var(--muted-2); }

/* --- Billing Screen --- */
.billing-content { padding: 0; }
.billing-row { display: flex; align-items: center; gap: 16px; padding: 16px 24px; border-top: 1px solid var(--bg); transition: background .1s; }
.billing-row:first-child { border-top: none; }
.billing-row:hover { background: #faf9f6; }
.billing-info { flex: 1; }
.billing-info h4 { font-size: 14px; font-weight: 600; }
.billing-info p { font-size: 12.5px; color: var(--muted-2); margin-top: 2px; }
.billing-status { margin-right: 8px; }
.billing-amount { font-weight: 600; font-size: 15px; min-width: 80px; text-align: right; }
.billing-actions { display: flex; gap: 6px; align-items: center; }
.billing-total { padding: 16px 24px; border-top: 1px solid var(--bg); display: flex; justify-content: flex-end; }
.payment-methods { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.payment-option { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border: 1px solid rgba(0,0,0,.08); border-radius: 10px; cursor: pointer; transition: all .15s; }
.payment-option.selected { border-color: var(--ink); background: var(--bg); }
.payment-option-label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.plan-card { padding: 24px; }
.plan-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.plan-header h4 { font-size: 16px; font-weight: 600; }
.plan-details { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.plan-stat { text-align: center; padding: 16px; background: var(--bg); border-radius: 12px; }
.plan-label { font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .04em; font-weight: 500; display: block; }
.plan-value { font-size: 18px; font-weight: 600; margin-top: 4px; display: block; }
.caregiver-note { font-size: 12px; color: var(--warm); display: flex; align-items: center; gap: 4px; }

/* --- Caregiver Lock Block --- */
.caregiver-lock { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; color: var(--muted-2); text-align: center; }
.caregiver-lock .lock-icon { color: var(--muted-3); margin-bottom: 12px; display: flex; }
.caregiver-lock p { font-size: 13px; }

/* --- Messages Screen --- */
.messages-layout { display: flex; min-height: 600px; }
.thread-list { width: 320px; border-right: 1px solid var(--bg); overflow-y: auto; }
.thread-item { display: flex; gap: 12px; padding: 14px 16px; cursor: pointer; border-bottom: 1px solid var(--bg); transition: background .1s; }
.thread-item:hover { background: #faf9f6; }
.thread-item.active { background: var(--bg); }
.thread-item.unread .thread-name::before { content: ''; display: inline-block; width: 6px; height: 6px; background: var(--warm); border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.thread-info { flex: 1; min-width: 0; }
.thread-top { display: flex; justify-content: space-between; align-items: center; }
.thread-name { font-size: 13.5px; font-weight: 600; }
.thread-ts { font-size: 11px; color: var(--muted-3); }
.thread-preview { font-size: 12.5px; color: var(--muted-1); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.message-view { flex: 1; display: flex; flex-direction: column; }
.message-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; flex: 1; color: var(--muted-2); }
.message-empty h3 { margin-top: 12px; font-size: 16px; font-weight: 600; color: var(--ink); }
.message-empty p { font-size: 13px; margin-top: 4px; }
.msg-thread-header { display: flex; gap: 12px; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--bg); }
.msg-thread-header h3 { font-size: 15px; font-weight: 600; }
.msg-thread-body { flex: 1; overflow-y: auto; padding: 16px 20px; display: flex; flex-direction: column; gap: 16px; max-height: 400px; }
.message-bubble { max-width: 80%; }
.message-bubble.self { align-self: flex-end; }
.msg-bubble-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.msg-sender-name { font-size: 12.5px; font-weight: 600; }
.msg-sender-role { font-size: 10.5px; color: var(--muted-3); text-transform: uppercase; }
.msg-bubble-ts { font-size: 10.5px; color: var(--muted-3); margin-left: auto; }
.msg-content { padding: 12px 16px; background: var(--bg); border-radius: 14px; font-size: 13.5px; line-height: 1.5; color: var(--ink); }
.message-bubble.self .msg-content { background: var(--ink); color: #fff; }
.msg-compose { padding: 16px 20px; border-top: 1px solid var(--bg); }
.compose-wrap { display: flex; flex-direction: column; gap: 8px; }
.compose-input { width: 100%; padding: 12px 14px; border: 1px solid rgba(0,0,0,.08); border-radius: 12px; font-family: inherit; font-size: 13.5px; resize: none; background: #faf9f6; transition: border-color .15s; }
.compose-input:focus { outline: none; border-color: var(--ink); background: #fff; }
.compose-btns { display: flex; justify-content: flex-end; gap: 8px; }

/* --- Access Screen --- */
.consent-row { display: flex; justify-content: space-between; align-items: flex-start; padding: 16px 24px; border-top: 1px solid var(--bg); transition: background .1s; }
.consent-row:hover { background: #faf9f6; }
.consent-info { flex: 1; }
.consent-info h4 { font-size: 14px; font-weight: 600; }
.consent-info p { font-size: 13px; color: var(--muted-1); margin-top: 2px; }
.consent-scope { font-size: 12.5px; color: var(--muted-2); margin-top: 6px; }
.consent-dates { display: flex; gap: 16px; margin-top: 8px; font-size: 11.5px; color: var(--muted-3); }
.consent-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.consent-history-section { border-top: 1px solid var(--bg); }
.consent-hist-toggle { display: flex; justify-content: space-between; align-items: center; padding: 16px 24px; cursor: pointer; transition: background .1s; }
.consent-hist-toggle:hover { background: #faf9f6; }
.consent-hist-toggle h4 { font-size: 14px; font-weight: 500; color: var(--muted-1); }
.consent-hist-body { display: none; padding: 0 24px 16px; }
.consent-hist-body.open { display: block; }
.hist-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid #f5f4f0; font-size: 12.5px; }
.hist-date { color: var(--muted-2); min-width: 90px; font-weight: 500; }
.hist-desc { color: var(--muted-1); }

/* --- Empty State --- */
.empty-state { text-align: center; padding: 48px 24px; color: var(--muted-2); }
.empty-state h3 { font-size: 16px; font-weight: 600; color: var(--ink); margin-top: 8px; }
.empty-state p { font-size: 13px; margin-top: 4px; }
.empty-icon { display: flex; justify-content: center; color: var(--muted-3); margin-bottom: 4px; }

/* --- Animations --- */
.animate-in { animation: fadeSlideIn .4s ease both; }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.card { animation: cardIn .4s ease both; }
@keyframes cardIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.col-stack .card:nth-child(1) { animation-delay: 0s; }
.col-stack .card:nth-child(2) { animation-delay: .06s; }
.col-stack .card:nth-child(3) { animation-delay: .12s; }
.col-stack .card:nth-child(4) { animation-delay: .18s; }
.featured { animation: featuredIn .5s ease both; }
@keyframes featuredIn { from { opacity: 0; transform: scale(.98); } to { opacity: 1; transform: scale(1); } }
.stats-bar { animation: cardIn .4s ease both; animation-delay: .08s; }
.metric { animation: metricIn .3s ease both; }
@keyframes metricIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.metric:nth-child(1) { animation-delay: 0s; }
.metric:nth-child(2) { animation-delay: .06s; }
.metric:nth-child(3) { animation-delay: .12s; }
.metric:nth-child(4) { animation-delay: .18s; }
.appt { animation: slideIn .3s ease both; }
.appt:nth-child(2) { animation-delay: .06s; }
.appt:nth-child(3) { animation-delay: .12s; }
.appt:nth-child(4) { animation-delay: .18s; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: translateX(0); } }
.progress-fill { animation: fillBar .8s ease both .3s; }
@keyframes fillBar { from { width: 0; } }
.bill-amt { animation: scaleIn .4s ease both .1s; }
@keyframes scaleIn { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: scale(1); } }
.sparkline-wrap { animation: sparkDraw .6s ease both .2s; }
@keyframes sparkDraw { from { opacity: 0; clip-path: inset(0 100% 0 0); } to { opacity: 1; clip-path: inset(0 0 0 0); } }
.record-card { animation: slideIn .3s ease both; }
.record-card:nth-child(2) { animation-delay: .04s; }
.record-card:nth-child(3) { animation-delay: .08s; }
.record-card:nth-child(4) { animation-delay: .12s; }
.slot-card { animation: cardIn .3s ease both; }
.slot-card:nth-child(2) { animation-delay: .05s; }
.slot-card:nth-child(3) { animation-delay: .1s; }
.login-card { animation: cardIn .4s ease both; }
.login-card:nth-child(2) { animation-delay: .1s; }
.thread-item { animation: slideIn .2s ease both; }
.thread-item:nth-child(2) { animation-delay: .05s; }
.thread-item:nth-child(3) { animation-delay: .1s; }
.consent-row { animation: fadeSlideIn .3s ease both; }
.consent-row:nth-child(2) { animation-delay: .05s; }
.consent-row:nth-child(3) { animation-delay: .1s; }
.consent-row:nth-child(4) { animation-delay: .15s; }
