/* Kabyar shared mockup styles */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Padauk:wght@400;700&family=Noto+Sans+Myanmar:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  color-scheme: dark;

  /* ─── Color palette ──────────────────────────── */
  --bg-0: #0B0D11;
  --bg-1: #0F1115;
  --bg-2: #15181F;
  --glass: rgba(255,255,255,0.06);
  --glass-stroke: rgba(255,255,255,0.10);
  --text-hi: #F5F7FA;
  --text-mid: #A8B0BD;
  --text-lo: #5C6473;
  --cyan: #22D3EE;
  --violet: #8B5CF6;
  --blue: #3B82F6;
  --mint: #34D399;
  --amber: #FBBF24;
  --rose: #FB7185;
  --rose-deep: #E11D48;
  --emerald: #34D399;
  --red: #EF4444;
  --success: #34D399;
  --text: #F5F7FA;
  --border: rgba(255,255,255,0.10);
  --card: rgba(15,17,21,0.92);

  /* ─── Gradients ──────────────────────────────── */
  --grad-ko: linear-gradient(135deg, var(--cyan) 0%, var(--violet) 100%);
  --grad-urgent: linear-gradient(135deg, var(--rose) 0%, var(--violet) 100%);
  --grad-wellness: linear-gradient(135deg, var(--mint) 0%, var(--cyan) 100%);
  --grad-glass-hi: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.02));

  /* ─── Shadows & glows ────────────────────────── */
  --shadow-1: 0 2px 8px rgba(0,0,0,0.35);
  --shadow-2: 0 8px 24px rgba(0,0,0,0.45);
  --shadow-3: 0 24px 64px rgba(0,0,0,0.55);
  --glow-ko: 0 0 24px rgba(34,211,238,0.45);
  --glow-violet: 0 0 24px rgba(139,92,246,0.40);
  --glow-urgent: 0 0 20px rgba(251,113,133,0.40);

  /* ─── Type scale ─────────────────────────────── */
  --font-display: 34px;
  --font-h1: 26px;
  --font-h2: 20px;
  --font-lg: 16px;
  --font-body: 14px;
  --font-caption: 12px;
  --font-mono: 12px;
  --font-small: 12px;

  /* ─── Spacing (4px grid) ─────────────────────── */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 20px;
  --space-2xl: 24px;
  --space-3xl: 32px;
  --space-4xl: 40px;
  --space-5xl: 48px;

  /* ─── Radii ──────────────────────────────────── */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-pill: 999px;

  /* ─── Animation timing (1.5× scale) ──────────── */
  --dur-press: 120ms;
  --dur-fast: 150ms;
  --dur-normal: 200ms;
  --dur-transition: 300ms;
  --dur-modal: 400ms;
  --dur-slow: 600ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  /* ─── Glass opacity ─────────────────────────── */
  --glass-lo: 0.04;
  --glass-md: 0.06;
  --glass-hi: 0.10;
  --glass-solid: 0.88;
}

/* ─── Light mode ──────────────────────────────── */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg-0: #F5F5F7;
    --bg-1: #EBEBF0;
    --bg-2: #E0E0E8;
    --glass: rgba(0,0,0,0.04);
    --glass-stroke: rgba(0,0,0,0.08);
    --text-hi: #1A1A1E;
    --text-mid: #666670;
    --text-lo: #9999A5;
    --text: #1A1A1E;
    --border: rgba(0,0,0,0.10);
    --card: rgba(255,255,255,0.92);
    --shadow-1: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-2: 0 8px 24px rgba(0,0,0,0.12);
    --shadow-3: 0 24px 64px rgba(0,0,0,0.18);
    --glow-ko: 0 0 24px rgba(34,211,238,0.25);
    --glow-violet: 0 0 24px rgba(139,92,246,0.20);
    --glow-urgent: 0 0 20px rgba(251,113,133,0.20);
  }
}
[data-theme="light"] {
  color-scheme: light;
  --bg-0: #F5F5F7;
  --bg-1: #EBEBF0;
  --bg-2: #E0E0E8;
  --glass: rgba(0,0,0,0.04);
  --glass-stroke: rgba(0,0,0,0.08);
  --text-hi: #1A1A1E;
  --text-mid: #666670;
  --text-lo: #9999A5;
  --text: #1A1A1E;
  --border: rgba(0,0,0,0.10);
  --card: rgba(255,255,255,0.92);
  --shadow-1: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-2: 0 8px 24px rgba(0,0,0,0.12);
  --shadow-3: 0 24px 64px rgba(0,0,0,0.18);
  --glow-ko: 0 0 24px rgba(34,211,238,0.25);
  --glow-violet: 0 0 24px rgba(139,92,246,0.20);
  --glow-urgent: 0 0 20px rgba(251,113,133,0.20);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

html, body {
  background: var(--bg-0);
  color: var(--text-hi);
  font-family: 'Inter', 'Padauk', 'Noto Sans Myanmar', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: '';
  position: fixed; inset: 0;
  background:
    radial-gradient(800px 600px at 10% -10%, rgba(34,211,238,0.12), transparent 60%),
    radial-gradient(700px 500px at 110% 20%, rgba(139,92,246,0.14), transparent 60%),
    radial-gradient(600px 400px at 50% 110%, rgba(59,130,246,0.10), transparent 60%);
  z-index: -1;
  pointer-events: none;
}

.my { font-family: 'Padauk', 'Noto Sans Myanmar', sans-serif; line-height: 1.8; text-rendering: optimizeLegibility; }
.mono { font-family: 'JetBrains Mono', monospace; font-size: 12px; }

/* Phone frame */
.phone {
  width: 390px;
  height: 844px;
  background: var(--bg-1);
  border-radius: 38px;
  border: 1px solid var(--glass-stroke);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  position: relative;
  display: flex;
  flex-direction: column;
}
.phone::before {
  content: '';
  position: absolute; top: 12px; left: 50%;
  transform: translateX(-50%);
  width: 120px; height: 28px;
  background: #000;
  border-radius: 0 0 18px 18px;
  z-index: 100;
}

.statusbar {
  height: 44px;
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 28px;
  font-size: 13px; font-weight: 600;
  color: var(--text-hi);
  flex-shrink: 0;
}

.screen {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-sm) var(--space-lg) 96px;
  position: relative;
}

/* Glass card */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-stroke);
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  border-radius: 20px;
  box-shadow: var(--shadow-1);
  padding: 12px;
  position: relative;
  overflow: hidden;
}
.glass.glow-ko { box-shadow: var(--shadow-1), var(--glow-ko); }
.glass.glow-violet { box-shadow: var(--shadow-1), var(--glow-violet); }
.glass.glow-urgent { box-shadow: var(--shadow-1), var(--glow-urgent); }

.row { display: flex; gap: var(--space-sm); align-items: center; }
.col { display: flex; flex-direction: column; gap: var(--space-sm); }
.between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-20 { gap: 20px; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-20 { margin-top: 20px; } .mt-24 { margin-top: 24px; }

/* Typography */
h1, .h1 { font-size: var(--font-h1); font-weight: 700; letter-spacing: -0.3px; }
h2, .h2 { font-size: var(--font-h2); font-weight: 600; }
.display { font-size: var(--font-display); font-weight: 700; letter-spacing: -0.5px; }
.muted { color: var(--text-mid); }
.dim { color: var(--text-lo); }
.caption { font-size: var(--font-caption); color: var(--text-mid); letter-spacing: 0.2px; }

/* Ko avatar */
.ko-avatar {
  border-radius: 50%;
  background: var(--grad-ko);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  color: #0B0D11;
  position: relative;
  flex-shrink: 0;
}
.ko-avatar::after { display: none; }
.ko-avatar.md::after, .ko-avatar.lg::after, .ko-avatar.hero::after {
  content: ''; display: block;
  position: absolute; inset: -4px;
  border-radius: 50%;
  border: 1px solid rgba(34,211,238,0.3);
  animation: breathe 4s ease-in-out infinite;
}
.ko-avatar.xs { width: 24px; height: 24px; font-size: 11px; }
.ko-avatar.sm { width: 36px; height: 36px; font-size: 14px; }
.ko-avatar.md { width: 48px; height: 48px; font-size: 20px; }
.ko-avatar.lg { width: 96px; height: 96px; font-size: 32px; }
.ko-avatar.hero { width: 160px; height: 160px; font-size: 52px; }
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.12); opacity: 0.2; }
}

/* Buttons */
.btn {
  border: none; cursor: pointer;
  padding: var(--space-md) var(--space-lg); border-radius: var(--radius-pill);
  font-family: inherit; font-size: var(--font-body); font-weight: 600;
  display: inline-flex; align-items: center; gap: var(--space-sm);
  transition: transform var(--dur-press) var(--ease-out);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--grad-ko); color: #0B0D11; box-shadow: var(--glow-ko); }
.btn-ghost { background: var(--glass); border: 1px solid var(--glass-stroke); color: var(--text-hi); }
.btn-urgent { background: var(--grad-urgent); color: #fff; box-shadow: var(--glow-urgent); }

/* Chips */
.chip {
  display: inline-flex; align-items: center; gap: var(--space-xs);
  padding: var(--space-xs) var(--space-md); border-radius: var(--radius-pill);
  font-size: var(--font-caption); font-weight: 600;
  min-height: 44px;
  background: var(--glass);
  border: 1px solid var(--glass-stroke);
  color: var(--text-hi);
  transition: transform var(--dur-press) var(--ease-out), background var(--dur-fast);
}
.chip:active { transform: scale(0.96); }
.chip.urgent { background: rgba(251,113,133,0.15); color: #FECDD3; border-color: rgba(251,113,133,0.4); }
.chip.followup { background: rgba(251,191,36,0.12); color: #FDE68A; border-color: rgba(251,191,36,0.35); }
.chip.routine { background: rgba(59,130,246,0.12); color: #BFDBFE; border-color: rgba(59,130,246,0.35); }
.chip.wellness { background: rgba(52,211,153,0.12); color: #A7F3D0; border-color: rgba(52,211,153,0.35); }
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip.active { background: rgba(34,211,238,0.15); color: var(--cyan); border-color: rgba(34,211,238,0.4); }

/* Form inputs */
input[type="checkbox"], input[type="radio"] { accent-color: var(--cyan); width: 16px; height: 16px; cursor: pointer; }

/* Global form elements — dark theme for all inputs, selects, textareas */
select,
input[type="text"],
input[type="number"],
input[type="date"],
input[type="email"],
input[type="tel"],
input[type="password"],
input[type="search"],
input[type="url"],
input[type="time"],
input[type="datetime-local"],
input:not([type]),
textarea {
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--text-hi);
  font-family: 'Padauk', 'Noto Sans Myanmar', 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.6;
  outline: none;
  transition: border-color 0.2s;
}
select:focus,
input:not([type="checkbox"]):not([type="radio"]):focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 2px rgba(34,211,238,0.15);
}
/* Fix option elements which use OS-native styling */
select option {
  background: #1a1d24;
  color: #f5f7fa;
  padding: 8px;
}
select {
  cursor: pointer;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a8b0bd' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
}
textarea { resize: vertical; }
::placeholder { color: var(--text-mid); opacity: 1; }
input::-webkit-calendar-picker-indicator { filter: invert(0.7); }
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }
.ko-bar .ko-avatar::after { animation: none; }

/* Ko command bar */
.ko-bar {
  position: absolute;
  left: var(--space-lg); right: var(--space-lg); bottom: var(--space-lg);
  background: rgba(15,17,21, var(--glass-solid));
  border: 1px solid var(--glass-stroke);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 22px;
  box-shadow: var(--shadow-2), 0 0 20px rgba(34,211,238,0.15);
  padding: var(--space-md);
  z-index: 50;
}
.ko-bar .input-row { display: flex; align-items: center; gap: var(--space-md); }
.ko-bar input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--text-hi); font-family: 'Padauk', 'Noto Sans Myanmar', 'Inter', sans-serif;
  font-size: 14px; line-height: 1.6;
  padding: 6px 0;
}
.ko-bar input::placeholder { color: var(--text-mid); }
.ko-bar .icon-btn {
  width: 48px; height: 48px; border-radius: 50%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--glass-stroke);
  display: flex; align-items: center; justify-content: center;
  color: var(--cyan); cursor: pointer; flex-shrink: 0;
  font-size: 20px; transition: transform 0.15s, box-shadow 0.15s;
}
.ko-bar .icon-btn:active { transform: scale(0.88); }
.ko-bar .icon-btn.send {
  background: var(--grad-ko); color: #0B0D11; border: none;
  box-shadow: 0 2px 10px rgba(34,211,238,0.25);
}
.ko-bar .icon-btn.send:active { box-shadow: 0 0 4px rgba(34,211,238,0.15); }
.ko-bar .ko-home-btn { background: rgba(34,211,238,0.08); border: 1px solid rgba(34,211,238,0.2); color: var(--cyan); text-decoration: none; font-size: 16px; width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all 0.2s; }
.ko-bar .ko-home-btn:hover { background: rgba(34,211,238,0.18); border-color: rgba(34,211,238,0.4); }
.ko-bar .suggestions {
  display: flex; gap: 8px; padding: 8px 4px 4px;
  overflow-x: auto;
}
.ko-bar .suggestions::-webkit-scrollbar { display: none; }
.ko-bar .suggestions .chip { white-space: nowrap; cursor: pointer; }

/* Chat bubble */
.bubble {
  max-width: 78%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 13px;
  line-height: 1.6;
  position: relative;
}
.bubble.ko {
  background: rgba(34,211,238,0.08);
  border: 1px solid rgba(34,211,238,0.25);
  color: var(--text-hi);
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  box-shadow: 0 0 16px rgba(34,211,238,0.12);
}
.bubble.may {
  background: rgba(139,92,246,0.10);
  border: 1px solid rgba(139,92,246,0.30);
  color: var(--text-hi);
  align-self: flex-end;
  border-bottom-right-radius: 6px;
}
.chat-row { display: flex; gap: 8px; margin-bottom: 12px; }
.chat-row.ko { justify-content: flex-start; align-items: flex-end; }
.chat-row.may { justify-content: flex-end; }

/* Timeline */
.timeline { position: relative; padding-left: 24px; }
.timeline::before {
  content: ''; position: absolute; left: 6px; top: 6px; bottom: 6px;
  width: 2px; background: linear-gradient(180deg, var(--cyan), var(--violet));
  opacity: 0.3;
}
.timeline-item { position: relative; padding-bottom: 16px; }
.timeline-item::before {
  content: ''; position: absolute; left: -24px; top: 6px;
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--cyan); box-shadow: var(--glow-ko);
}

/* Header bar */
.appheader {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px 16px;
}
.appheader .title { font-size: 18px; font-weight: 700; }

/* Waveform */
.waveform {
  display: flex; align-items: center; justify-content: center;
  gap: 4px; height: 80px;
}
.waveform .bar {
  width: 4px; border-radius: 2px;
  background: var(--grad-ko);
  animation: wave 800ms ease-in-out infinite;
}
@keyframes wave {
  0%, 100% { height: 8px; }
  50% { height: 60px; }
}
.waveform .bar:nth-child(2n) { animation-delay: 100ms; }
.waveform .bar:nth-child(3n) { animation-delay: 200ms; }
.waveform .bar:nth-child(5n) { animation-delay: 320ms; }
.waveform .bar:nth-child(7n) { animation-delay: 480ms; }

/* Insight tile */
.tile { padding: 16px; min-height: 100px; }
.tile .num { font-size: 28px; font-weight: 700; background: var(--grad-ko); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tile .label { font-size: 11px; color: var(--text-mid); text-transform: uppercase; letter-spacing: 1px; }

/* Patient card */
.patient-card { padding: 16px; }
.patient-card .pname { font-size: 16px; font-weight: 600; }
.patient-card .pmeta { font-size: 12px; color: var(--text-mid); }

/* Gallery hub */
.hub { padding: 40px 24px; max-width: 1400px; margin: 0 auto; }
.hub h1 { margin-bottom: 8px; }
.hub .grid {
  display: grid; gap: 24px;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  margin-top: 32px;
}
.hub .card {
  background: var(--glass);
  border: 1px solid var(--glass-stroke);
  border-radius: var(--radius-xl);
  padding: var(--space-xl);
  text-decoration: none;
  color: var(--text-hi);
  transition: transform var(--dur-normal) var(--ease-out), box-shadow var(--dur-normal);
  display: block;
}
.hub .card:hover { transform: translateY(-4px) scale(1.01); box-shadow: var(--glow-ko); }
.hub .card .num { font-size: 11px; color: var(--cyan); letter-spacing: 2px; }
.hub .card h3 { font-size: 18px; margin-top: 6px; }
.hub .card p { color: var(--text-mid); margin-top: 6px; font-size: 13px; }

.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand .logo {
  width: 48px; height: 48px; border-radius: 14px;
  background: var(--grad-ko); display: flex; align-items: center; justify-content: center;
  box-shadow: var(--glow-ko); font-weight: 700; color: #0B0D11; font-size: 22px;
}

/* ─── Accessibility ───────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 8px;
  z-index: 10000;
  background: var(--cyan);
  color: var(--bg-0);
  padding: 8px 16px;
  border-radius: 0 0 8px 8px;
  font-weight: 600;
  text-decoration: none;
  transition: top .2s;
}
.skip-link:focus {
  top: 0;
}
:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
button:focus-visible, .chip:focus-visible, a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
button { cursor: pointer; }
a { color: inherit; }

/* ─── Responsive ──────────────────────────── */

/* Mobile — full screen, no phone frame */
@media (max-width: 428px) {
  .phone { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; border: none; box-shadow: none; }
  .phone::before { display: none; }
  body { padding: 0 !important; display: block !important; min-height: 100vh; min-height: 100dvh; }
  .statusbar { display: none; }
  .screen { padding: var(--space-xs) var(--space-sm) 96px; }
  .ko-bar { left: var(--space-xs); right: var(--space-xs); bottom: var(--space-xs); padding: var(--space-sm) var(--space-md); border-radius: 20px; }
  .ko-bar input { font-size: 15px; }
  .ko-bar .icon-btn { width: 44px; height: 44px; font-size: 18px; }
  .glass { padding: var(--space-md); border-radius: 16px; }
  .appheader { padding: var(--space-xs) var(--space-sm) var(--space-sm); }
  .bubble { max-width: 90%; padding: var(--space-md) var(--space-lg); font-size: 14px; }
  .tab-nav a { padding: var(--space-sm) var(--space-md); min-height: 44px; }
  .tab-nav .tab-label { font-size: 10px; }
  h1, .h1 { font-size: var(--font-h2); }
  h2, .h2 { font-size: var(--font-lg); }
  .tile .num { font-size: 22px; }
  .stat-grid { grid-template-columns: 1fr 1fr !important; gap: var(--space-sm) !important; }
  .chip { padding: 6px 14px; font-size: 12px; min-height: 44px; display: inline-flex; align-items: center; }
  .form-input, input[type="text"], input[type="password"], textarea, select { font-size: 16px !important; }
  button, .btn, [role="button"] { min-height: 44px; }
  .gen-btn { padding: 16px 24px; font-size: 15px; }
  .prompt-box { font-size: 16px; }
  .login-card { max-width: 100%; margin: 0 12px; }
  .img-result { border-radius: 12px; }
}

/* Tablet — wider phone frame */
@media (min-width: 429px) and (max-width: 820px) {
  body { padding: var(--space-lg); }
  .phone { width: 100%; max-width: 480px; height: 90vh; border-radius: 32px; }
  .screen { padding: 8px 14px 100px; }
}

/* Desktop — full-width responsive layout, no phone frame */
@media (min-width: 821px) {
  body { padding: 0; display: block; background: var(--bg-0); }
  .phone {
    width: 100%; max-width: 960px; height: 100vh; height: 100dvh;
    margin: 0 auto;
    border-radius: 0; border-left: 1px solid var(--glass-stroke); border-right: 1px solid var(--glass-stroke);
    box-shadow: none;
  }
  .phone::before { display: none; }
  .statusbar { display: none; }
  .screen { padding: 16px 24px 140px; }
  .ko-bar { left: 24px; right: 24px; bottom: 16px; border-radius: 28px; }
  .bubble { max-width: 65%; }
  .glass { border-radius: 24px; }
  .appheader { padding: 12px 16px 20px; }
  .tab-nav { max-width: 960px; margin: 0 auto; }
  .stat-grid { grid-template-columns: repeat(4, 1fr) !important; }
}

/* Wide desktop — sidebar potential */
@media (min-width: 1200px) {
  .phone { max-width: 1100px; }
  .screen { padding: 20px 32px 140px; }
  .ko-bar { left: 32px; right: 32px; max-width: 700px; margin: 0 auto; position: absolute; left: 50%; right: auto; transform: translateX(-50%); width: calc(100% - 64px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ─── Consistent back button ─────────────── */
.back-btn {
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(34,211,238,0.1); border: 1px solid rgba(34,211,238,0.2);
  color: var(--cyan); text-decoration: none; transition: all 0.2s; flex-shrink: 0;
}
.back-btn:active { transform: scale(0.9); background: rgba(34,211,238,0.2); }
.back-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }

/* ─── Global toast ────────────────────────── */
.ko-toast-global {
  position: fixed; bottom: 100px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--card); border: 1px solid var(--glass-stroke);
  color: var(--text-hi); padding: var(--space-md) var(--space-2xl); border-radius: var(--radius-xl); font-size: 13px;
  z-index: 500; opacity: 0; transition: all var(--dur-transition) var(--ease-spring); pointer-events: none;
  font-family: 'Padauk', 'Noto Sans Myanmar', 'Inter', sans-serif;
  box-shadow: var(--shadow-2); white-space: nowrap;
}
.ko-toast-global.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.ko-toast-global.error { border-color: rgba(251,113,133,0.4); }
.ko-toast-global.success { border-color: rgba(52,211,153,0.4); }

/* ─── Skeleton loading ────────────────────── */
.skeleton { background: linear-gradient(90deg, var(--glass) 25%, rgba(255,255,255,0.08) 50%, var(--glass) 75%); background-size: 200% 100%; border-radius: var(--radius-sm); animation: skeleton-shimmer 1.5s ease-in-out infinite; }
.skeleton-text { height: 14px; margin-bottom: 8px; border-radius: 4px; }
.skeleton-text.short { width: 40%; }
.skeleton-text.medium { width: 65%; }
.skeleton-text.long { width: 90%; }
.skeleton-circle { border-radius: 50%; }
.skeleton-card { height: 80px; border-radius: 16px; margin-bottom: 12px; }
@keyframes skeleton-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes skeleton-pulse { 0%,100% { opacity: 0.4; } 50% { opacity: 0.8; } }

/* ─── Print stylesheet ────────────────────── */
@media print {
  body { background: #fff !important; color: #000 !important; padding: 0 !important; }
  body::before { display: none !important; }
  .phone { width: 100% !important; height: auto !important; border-radius: 0 !important; border: none !important; box-shadow: none !important; }
  .phone::before, .statusbar, .ko-bar, .tab-nav, .search-overlay, .ko-toast-global { display: none !important; }
  .screen { padding: 8px !important; overflow: visible !important; height: auto !important; }
  .glass { background: rgba(0,0,0,0.03) !important; border: 1px solid #ddd !important; backdrop-filter: none !important; -webkit-backdrop-filter: none !important; box-shadow: none !important; }
  .glass::before { display: none !important; }
  .chip { border: 1px solid #ccc !important; background: transparent !important; }
  .btn { box-shadow: none !important; }
  a { color: #000 !important; }
  .ko-avatar { background: #eee !important; color: #333 !important; }
  .ko-avatar::after { display: none !important; }
}

/* ─── Smooth page entrance ─────────────────────────────────── */
.screen { animation: fadeSlideIn var(--dur-normal) var(--ease-out); }
@keyframes fadeSlideIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ─── Staggered list entrance ──────────────────────────── */
.stagger-item { opacity: 0; animation: fadeSlideIn var(--dur-transition) var(--ease-out) forwards; }
.stagger-item:nth-child(1) { animation-delay: 0ms; }
.stagger-item:nth-child(2) { animation-delay: 60ms; }
.stagger-item:nth-child(3) { animation-delay: 120ms; }
.stagger-item:nth-child(4) { animation-delay: 180ms; }
.stagger-item:nth-child(5) { animation-delay: 240ms; }
.stagger-item:nth-child(6) { animation-delay: 300ms; }
.stagger-item:nth-child(7) { animation-delay: 360ms; }
.stagger-item:nth-child(8) { animation-delay: 420ms; }

/* ─── Empty state ──────────────────────────────────────────── */
.empty-state { text-align: center; padding: 40px 20px; color: var(--text-mid); }
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state .msg { font-size: 14px; line-height: 1.5; }

/* ─── Loading spinner ──────────────────────────────────────── */
.ko-spinner { width: 24px; height: 24px; border: 3px solid var(--glass-stroke); border-top-color: var(--cyan); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Breathing modal ──────────────────────────────────────── */
.breathe-overlay { position:fixed;inset:0;background:rgba(6,8,11,0.92);display:flex;flex-direction:column;align-items:center;justify-content:center;z-index:9999;opacity:0;transition:opacity 0.4s;pointer-events:none }
.breathe-overlay.open { opacity:1;pointer-events:auto }
.breathe-close { position:absolute;top:16px;right:18px;background:none;border:none;color:var(--text-mid);font-size:28px;cursor:pointer;z-index:10 }
.breath-circle { width:180px;height:180px;border-radius:50%;border:3px solid rgba(34,211,238,0.4);display:flex;align-items:center;justify-content:center;flex-direction:column;transition:transform 0.15s,box-shadow 0.15s;box-shadow:0 0 40px rgba(34,211,238,0.08) }
.breath-circle.inhale { animation:bInhale var(--phase-dur,4s) ease-in-out forwards }
.breath-circle.hold   { animation:bHold var(--phase-dur,4s) linear forwards }
.breath-circle.exhale  { animation:bExhale var(--phase-dur,4s) ease-in-out forwards }
@keyframes bInhale { 0%{transform:scale(0.7);box-shadow:0 0 20px rgba(34,211,238,0.1)} 100%{transform:scale(1.15);box-shadow:0 0 60px rgba(34,211,238,0.35)} }
@keyframes bHold   { 0%,100%{transform:scale(1.15);box-shadow:0 0 60px rgba(34,211,238,0.35)} }
@keyframes bExhale  { 0%{transform:scale(1.15);box-shadow:0 0 60px rgba(34,211,238,0.35)} 100%{transform:scale(0.7);box-shadow:0 0 20px rgba(34,211,238,0.1)} }
.breath-phase { font-size:18px;font-weight:700;color:var(--cyan);margin-top:14px;min-height:24px;letter-spacing:1px }
.breath-timer { font-size:32px;font-weight:200;color:var(--text-hi);font-variant-numeric:tabular-nums }
.breath-round { font-size:12px;color:var(--text-mid);margin-top:8px }
.breath-ko-msg { margin-top:20px;max-width:280px;text-align:center;font-size:13px;line-height:1.7;color:var(--text-mid);opacity:0;transition:opacity 0.6s }
.breath-ko-msg.show { opacity:1 }

/* ─── Badge ────────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; border-radius: 10px; font-size: 11px; font-weight: 700; padding: 0 5px; }

/* ─── KoModal ──────────────────────────────────────────────── */
.ko-modal-overlay { position:fixed;inset:0;background:rgba(6,8,11,0.88);display:flex;align-items:center;justify-content:center;z-index:9998;opacity:0;transition:opacity 0.3s;pointer-events:none;padding:16px }
.ko-modal-overlay.open { opacity:1;pointer-events:auto }
.ko-modal-card { position:relative;width:100%;max-width:360px;background:rgba(17,19,24,0.95);backdrop-filter:blur(24px) saturate(140%);border:1px solid var(--glass-stroke);border-radius:16px;padding:18px 16px 16px;box-shadow:0 8px 40px rgba(0,0,0,0.5) }
.ko-modal-close { position:absolute;top:12px;right:14px;background:none;border:none;color:var(--text-mid);font-size:24px;cursor:pointer;line-height:1 }
.ko-modal-title { font-size:16px;font-weight:700;color:var(--text-hi);margin-bottom:14px;padding-right:24px }
.ko-modal-body { margin-bottom:14px;color:var(--text-mid) }
.ko-modal-field { margin-bottom:8px }
.ko-modal-label { display:block;font-size:11px;font-weight:600;color:var(--text-mid);margin-bottom:5px;letter-spacing:0.5px }
.ko-modal-input { width:100%;background:rgba(255,255,255,0.04);border:1px solid var(--glass-stroke);border-radius:10px;padding:8px 10px;color:var(--text-hi);font-family:inherit;font-size:14px;outline:none;transition:border-color 0.2s;box-sizing:border-box }
.ko-modal-input:focus { border-color:var(--cyan) }
select.ko-modal-input { appearance:auto }
textarea.ko-modal-input { resize:vertical;min-height:60px }
.ko-modal-actions { display:flex;gap:8px;margin-top:12px;justify-content:flex-end }
.badge-rose { background: var(--rose); color: #fff; }
.badge-cyan { background: var(--cyan); color: #0B0D11; }
.badge-amber { background: var(--amber); color: #0B0D11; }

/* ─── Swipe hint ───────────────────────────────────────────── */
.swipe-hint { text-align: center; color: var(--text-lo); font-size: 11px; padding: 8px; animation: swipeHint 2s ease-in-out infinite; }
@keyframes swipeHint { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(8px); } }

/* ─── Tooltip ──────────────────────────────────────────────── */
[data-tooltip] { position: relative; }
[data-tooltip]:hover::after { content: attr(data-tooltip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); padding: 4px 10px; background: var(--bg-2); color: var(--text-hi); font-size: 11px; border-radius: 6px; white-space: nowrap; z-index: 100; pointer-events: none; margin-bottom: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.3); }

/* ─── Scroll to top FAB ────────────────────────────────────── */
.scroll-top { position: fixed; bottom: 80px; right: 16px; width: 36px; height: 36px; border-radius: 50%; background: var(--glass); backdrop-filter: blur(8px); border: 1px solid var(--glass-stroke); color: var(--text-hi); font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.2s; z-index: 100; }
.scroll-top.visible { opacity: 1; pointer-events: auto; }

/* ─── Offline banner ───────────────────────────────────────── */
.offline-banner { position: fixed; top: 0; left: 0; right: 0; padding: 6px; text-align: center; background: var(--rose); color: #fff; font-size: 12px; font-weight: 600; z-index: 10002; transform: translateY(-100%); transition: transform 0.3s; }
.offline-banner.show { transform: translateY(0); }

/* ─── Progress bar ─────────────────────────────────────────── */
.progress-bar { height: 4px; border-radius: 2px; background: var(--glass); overflow: hidden; }
.progress-bar .fill { height: 100%; border-radius: 2px; background: var(--grad-ko); transition: width 0.4s ease; }

/* ─── Accordion ────────────────────────────────────────────── */
.accordion-header { cursor: pointer; display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; }
.accordion-header::after { content: '▸'; transition: transform 0.2s; }
.accordion-header.open::after { transform: rotate(90deg); }
.accordion-body { max-height: 0; overflow: hidden; transition: max-height 0.3s ease; }
.accordion-body.open { max-height: 500px; }

/* ─── Highlight animation ──────────────────────────────────── */
.highlight-flash { animation: flash 0.6s ease; }
@keyframes flash { 0%, 100% { background: transparent; } 50% { background: rgba(34,211,238,0.15); } }

/* ─── Button press ripple ──────────────────────────────────── */
.btn, .chip, .glass.tile, .back-btn, .ko-bar .icon-btn {
  position: relative;
  overflow: hidden;
}
.btn::after, .chip::after, .glass.tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--ripple-x, 50%) var(--ripple-y, 50%), rgba(255,255,255,0.25) 0%, transparent 60%);
  opacity: 0;
  transition: opacity var(--dur-transition);
  pointer-events: none;
}
.btn:active::after, .chip:active::after, .glass.tile:active::after {
  opacity: 1;
  transition: opacity 0s;
}

/* ─── Card hover 3D lift ───────────────────────────────────── */
.glass.tile {
  transition: transform var(--dur-normal) var(--ease-out), box-shadow var(--dur-normal);
}
.glass.tile:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: var(--shadow-2);
}
.glass.tile:active {
  transform: scale(0.98);
}

/* ─── Ko avatar idle wink ──────────────────────────────────── */
@keyframes koWink {
  0%, 94%, 100% { transform: scaleY(1); }
  97% { transform: scaleY(0.1); }
}
.ko-avatar.wink { animation: koWink 6s ease-in-out; }

/* ─── Confetti celebration ─────────────────────────────────── */
.confetti-container {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 10001;
  overflow: hidden;
}
.confetti {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  animation: confettiFall var(--fall-dur, 3s) var(--ease-out) forwards;
  opacity: 0;
}
@keyframes confettiFall {
  0% { transform: translateY(-20px) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ─── SW update banner ─────────────────────────────────────── */
.sw-update-banner {
  position: fixed; bottom: 80px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--card); border: 1px solid var(--cyan);
  color: var(--text-hi); padding: var(--space-md) var(--space-xl);
  border-radius: var(--radius-xl); font-size: 13px;
  z-index: 501; opacity: 0; transition: all var(--dur-transition) var(--ease-spring);
  pointer-events: none; display: flex; align-items: center; gap: var(--space-md);
  font-family: 'Padauk', 'Noto Sans Myanmar', 'Inter', sans-serif;
  box-shadow: var(--shadow-2), var(--glow-ko);
}
.sw-update-banner.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.sw-update-banner .sw-reload-btn {
  background: var(--grad-ko); color: var(--bg-0); border: none;
  padding: var(--space-xs) var(--space-md); border-radius: var(--radius-pill);
  font-weight: 600; font-size: var(--font-caption); cursor: pointer;
  font-family: inherit;
}

/* ─── Milestone badge ──────────────────────────────────────── */
.milestone-toast {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.8);
  background: rgba(17,19,24,0.96); backdrop-filter: blur(24px);
  border: 1px solid var(--glass-stroke); border-radius: var(--radius-xl);
  padding: var(--space-3xl) var(--space-4xl); text-align: center;
  z-index: 10000; opacity: 0; transition: all var(--dur-modal) var(--ease-spring);
  pointer-events: none; box-shadow: var(--shadow-3);
}
.milestone-toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); pointer-events: auto; }
.milestone-toast .ms-icon { font-size: 48px; margin-bottom: var(--space-md); }
.milestone-toast .ms-title { font-size: var(--font-h2); font-weight: 700; color: var(--text-hi); }
.milestone-toast .ms-msg { font-size: var(--font-body); color: var(--text-mid); margin-top: var(--space-sm); line-height: 1.7; }

/* ─── A6: Bottom Sheet Modal ──────────────────────────────── */
.bottom-sheet-backdrop {
  position: fixed; inset: 0; background: rgba(6,8,11,0.6);
  z-index: 9990; opacity: 0; pointer-events: none;
  transition: opacity var(--dur-transition);
}
.bottom-sheet-backdrop.open { opacity: 1; pointer-events: auto; }
.bottom-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  max-height: 60vh; min-height: 120px;
  background: rgba(17,19,24,0.97);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border-top: 1px solid var(--glass-stroke);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 40px rgba(0,0,0,0.5);
  transform: translateY(100%);
  transition: transform var(--dur-modal) var(--ease-out);
  z-index: 9991; overflow-y: auto; padding: 0 16px 24px;
}
.bottom-sheet.open { transform: translateY(0); }
.bottom-sheet-handle {
  width: 40px; height: 4px; border-radius: 2px;
  background: rgba(255,255,255,0.2); margin: 10px auto 12px;
}
.bottom-sheet-title {
  font-size: 15px; font-weight: 700; color: var(--text-hi);
  margin-bottom: 12px; padding-right: 24px;
}
.bottom-sheet-actions {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.bottom-sheet-action {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 8px; border-radius: 14px;
  background: var(--glass); border: 1px solid var(--glass-stroke);
  cursor: pointer; text-decoration: none; color: inherit;
  transition: transform var(--dur-press), background var(--dur-fast);
}
.bottom-sheet-action:active { transform: scale(0.95); background: rgba(34,211,238,0.10); }
.bottom-sheet-action .bsa-icon { font-size: 22px; }
.bottom-sheet-action .bsa-label { font-size: 11px; color: var(--text-mid); text-align: center; }

/* ─── A5: Swipe-to-action ─────────────────────────────────── */
.swipe-container { position: relative; overflow: hidden; border-radius: 14px; }
.swipe-actions { position: absolute; inset: 0; display: flex; }
.swipe-action-left { flex: 1; display: flex; align-items: center; justify-content: flex-start; padding-left: 20px; background: rgba(52,211,153,0.25); color: #34D399; font-weight: 700; font-size: 13px; }
.swipe-action-right { flex: 1; display: flex; align-items: center; justify-content: flex-end; padding-right: 20px; background: rgba(251,191,36,0.25); color: #FBBF24; font-weight: 700; font-size: 13px; }
.swipe-content { position: relative; z-index: 1; transition: transform 0.2s ease; touch-action: pan-y; }

/* ─── B1: Triage Board ────────────────────────────────────── */
.triage-board { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.triage-col { min-height: 80px; border-radius: 12px; padding: 8px 6px; }
.triage-col.urgent-col { background: rgba(251,113,133,0.06); border: 1px solid rgba(251,113,133,0.2); }
.triage-col.followup-col { background: rgba(251,191,36,0.06); border: 1px solid rgba(251,191,36,0.2); }
.triage-col.routine-col { background: rgba(59,130,246,0.06); border: 1px solid rgba(59,130,246,0.2); }
.triage-col-header { font-size: 10px; font-weight: 700; text-align: center; margin-bottom: 6px; letter-spacing: 0.5px; }
.triage-card { padding: 6px 8px; border-radius: 8px; background: var(--glass); border: 1px solid var(--glass-stroke); margin-bottom: 4px; cursor: pointer; font-size: 11px; }
.triage-card:active { transform: scale(0.97); }

/* ─── B4: Appointment urgency borders ─────────────────────── */
.appt-urgent { border-left: 3px solid var(--rose) !important; }
.appt-followup { border-left: 3px solid var(--amber) !important; }
.appt-routine { border-left: 3px solid var(--blue) !important; }

/* ─── C2: Ko Quick Actions Panel ──────────────────────────── */
.ko-bar .caret-btn {
  width: 36px; height: 28px; border-radius: 8px;
  background: rgba(34,211,238,0.08); border: 1px solid rgba(34,211,238,0.2);
  color: var(--cyan); cursor: pointer; display: flex;
  align-items: center; justify-content: center; font-size: 14px;
  transition: transform var(--dur-press);
}
.ko-bar .caret-btn:active { transform: scale(0.9); }

/* ─── C3: Image gallery grid ──────────────────────────────── */
.img-gallery-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.img-gallery-item { border-radius: 12px; overflow: hidden; cursor: pointer; position: relative; aspect-ratio: 1; background: var(--glass); border: 1px solid var(--glass-stroke); }
.img-gallery-item img { width: 100%; height: 100%; object-fit: cover; }
.img-gallery-item .prompt-overlay { position: absolute; bottom: 0; left: 0; right: 0; padding: 6px 8px; background: linear-gradient(transparent, rgba(0,0,0,0.8)); font-size: 10px; color: #fff; }

