/* SAMARITANUS · App Medic — mobile-first */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin:0; padding:0; height:100%; overflow-x:hidden; }
body {
  font: 16px/1.5 -apple-system, "Segoe UI", system-ui, Arial, sans-serif;
  background: #0f1f33;
  color: #1a2233;
  -webkit-font-smoothing: antialiased;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

/* ===== ECRANE ===== */
.screen { display:none; min-height:100vh; flex-direction:column; }
.screen.active { display:flex; }

/* ===== LOGIN ===== */
#screen-login {
  background: linear-gradient(160deg, #1a3656 0%, #0f1f33 100%);
  color:#fff; padding:40px 24px; justify-content:center;
}
.login-brand { text-align:center; margin-bottom:32px; }
.login-logo  { font-size:64px; margin-bottom:8px; }
.login-title { font-size:28px; font-weight:800; letter-spacing:2px; }
.login-sub   { opacity:.7; font-size:14px; margin-top:4px; }
.login-card  { background:#fff; color:#1a2233; border-radius:16px; padding:24px; box-shadow:0 12px 36px rgba(0,0,0,0.3); }
.login-hint  { color:#647088; font-size:12px; margin-top:14px; text-align:center; line-height:1.6; }
.lbl         { display:block; font-size:13px; font-weight:600; color:#3a4961; margin:14px 0 6px; }
.big-select, .big-input {
  width:100%; padding:14px 12px; font-size:17px; border:1.5px solid #cfd6e0;
  border-radius:10px; background:#fff; color:#1a2233; appearance:none;
}
.big-input { letter-spacing:8px; text-align:center; font-family:monospace; }
.big-select:focus, .big-input:focus { outline:none; border-color:#1a3656; }

/* ===== BUTOANE GENERALE ===== */
.btn-primary, .btn-secondary, .btn-amber, .btn-danger, .btn-ghost {
  width:100%; padding:14px 18px; font-size:16px; font-weight:600;
  border:none; border-radius:12px; cursor:pointer; margin-top:10px;
  transition: transform .1s, box-shadow .2s;
}
.btn-primary { background:#1a7f3e; color:#fff; }
.btn-primary:hover { background:#156631; }
.btn-secondary { background:#3a86c4; color:#fff; }
.btn-amber { background:#e89b1c; color:#fff; }
.btn-amber:disabled, .btn-secondary:disabled, .btn-danger:disabled, .btn-primary:disabled { opacity:.4; cursor:not-allowed; }
.btn-danger { background:#c1272d; color:#fff; }
.btn-ghost  { background:transparent; color:#647088; border:1.5px solid #cfd6e0; }
.big { font-size:18px; padding:18px; }
.btn-primary:active, .btn-secondary:active, .btn-amber:active, .btn-danger:active { transform: scale(.98); }

/* ===== STANDBY ===== */
#screen-standby { background:#f4f6f9; }
.topbar {
  background:#1a3656; color:#fff;
  display:flex; align-items:center; padding:12px 16px; gap:12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.tb-doc { flex:1; }
.tb-name { font-weight:700; font-size:15px; }
.tb-status { font-size:12px; opacity:.85; display:flex; align-items:center; gap:6px; }
.tb-status .dot { width:8px; height:8px; border-radius:50%; background:#3dd87a; }
.tb-status .dot.live { animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.4;transform:scale(.85)} }
.tb-x, .tb-back, .tb-timer {
  background:rgba(255,255,255,0.15); color:#fff; border:none; padding:8px 12px;
  border-radius:8px; font-size:16px; cursor:pointer;
}
.tb-timer { font-family:monospace; font-size:15px; }
.tb-case { flex:1; }
.tb-case-id { font-size:11px; opacity:.7; letter-spacing:1px; }
.tb-case-name { font-weight:700; font-size:15px; }

.standby-body { flex:1; display:flex; flex-direction:column; align-items:center; padding:30px 20px; gap:24px; }
.big-clock { font-size:72px; font-weight:200; font-family:monospace; color:#1a3656; }
.standby-msg { color:#647088; font-size:16px; }
.standby-stats { display:flex; gap:16px; width:100%; }
.stat { flex:1; background:#fff; border-radius:12px; padding:16px 8px; text-align:center; box-shadow:0 2px 8px rgba(0,0,0,0.05); }
.stat-n { font-size:24px; font-weight:800; color:#1a3656; }
.stat-l { font-size:11px; color:#647088; margin-top:4px; }
.standby-tip {
  background:#fffbeb; border:1px solid #fde68a; padding:12px 16px;
  border-radius:10px; font-size:13px; line-height:1.6; color:#78461c; text-align:center;
}

/* ===== CAZ ACTIV ===== */
#screen-case { background:#f4f6f9; }
.free-bar {
  background:#0c1828; color:#fff; padding:8px 14px;
  display:flex; align-items:center; gap:10px; font-size:12px;
}
.fb-lbl { flex:0 0 auto; opacity:.85; }
.fb-track { flex:1; height:8px; background:#1a2a3e; border-radius:4px; overflow:hidden; }
.fb-fill { height:100%; background:#3dd87a; transition:width .5s, background .3s; }
.free-bar.warn .fb-fill { background:#ffb84d; }
.free-bar.danger .fb-fill { background:#ff4d57; animation: blink 1s infinite; }
.fb-cd { font-family:monospace; min-width:50px; text-align:right; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.4} }

.case-body { flex:1; padding:14px; display:flex; flex-direction:column; gap:14px; }
.card { background:#fff; border-radius:12px; padding:14px; box-shadow:0 2px 8px rgba(0,0,0,0.06); }
.card-h { font-size:13px; font-weight:700; color:#3a4961; margin-bottom:10px; letter-spacing:.3px; }
.card.ai { border-left:4px solid #3a86c4; background:#f0f6fc; }
.card-more { margin-top:10px; }
.card-more summary { cursor:pointer; color:#3a86c4; font-size:13px; padding:6px 0; }

.pb-ident { font-size:18px; font-weight:700; color:#1a2233; }
.pb-reason {
  margin-top:6px; padding:8px 10px; background:#fff5e6; border-left:3px solid #e89b1c;
  border-radius:6px; font-size:14px; color:#78461c;
}
.pb-vitals { display:grid; grid-template-columns:repeat(2,1fr); gap:8px; margin-top:12px; }
.vit { background:#f4f6f9; padding:8px 10px; border-radius:8px; text-align:center; }
.vit-l { font-size:10px; color:#647088; letter-spacing:.5px; }
.vit-v { font-size:16px; font-weight:700; margin-top:2px; color:#1a2233; }
.vit.ok   .vit-v { color:#1a7f3e; }
.vit.warn .vit-v { color:#b86b00; }
.vit.crit .vit-v { color:#c1272d; }

textarea {
  width:100%; padding:10px; border:1.5px solid #cfd6e0; border-radius:8px;
  font-size:15px; font-family:inherit; resize:vertical;
}

.actions { display:flex; flex-direction:column; gap:0; }
.actions button { margin-top:8px; }

/* ===== MODALE ===== */
.modal {
  position:fixed; inset:0; background:rgba(15,31,51,0.85); z-index:9999;
  display:flex; align-items:center; justify-content:center; padding:16px;
  animation: fadeIn .2s;
}
.modal.hidden { display:none; }
@keyframes fadeIn { from{opacity:0} to{opacity:1} }
.modal-box {
  background:#fff; border-radius:16px; width:100%; max-width:480px;
  max-height:92vh; overflow-y:auto; display:flex; flex-direction:column;
}
.modal-h { padding:16px; font-size:18px; font-weight:700; display:flex; justify-content:space-between; align-items:center;
  border-bottom:1px solid #e5e9ef; }
.modal-x { background:none; border:none; font-size:22px; cursor:pointer; color:#647088; }
.modal-b { padding:16px; flex:1; }
.modal-f { padding:12px 16px; display:flex; gap:8px; border-top:1px solid #e5e9ef; }
.modal-f button { margin:0; flex:1; }

.dec-list { display:flex; flex-direction:column; gap:6px; margin-top:6px; }
.dec-list label { display:block; cursor:pointer; }
.dec-list input { display:none; }
.dec {
  display:block; padding:10px 12px; border:2px solid #e5e9ef; border-radius:10px;
  font-size:14px; font-weight:600;
}
.dec.ok     { background:#e8f5ec; color:#1a7f3e; }
.dec.warn   { background:#fff5e6; color:#b86b00; }
.dec.info   { background:#e8f0fa; color:#1a4d8c; }
.dec.alert  { background:#ffedd5; color:#9a3412; }
.dec.danger { background:#fde2e4; color:#c1272d; border-color:#c1272d; }
.dec-list input:checked + .dec { border-color:#1a3656; box-shadow:0 0 0 3px rgba(26,54,86,0.18); transform: scale(1.02); }

/* ===== INCOMING CALL MODAL ===== */
.modal-box.incoming {
  background: linear-gradient(160deg, #c1272d 0%, #8b1a1f 100%);
  color:#fff; text-align:center; padding:32px 20px;
  animation: shake .4s 3;
}
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-8px)} 75%{transform:translateX(8px)} }
.inc-pulse { font-size:72px; animation: pulseBig 1s infinite; }
@keyframes pulseBig { 0%,100%{transform:scale(1)} 50%{transform:scale(1.15)} }
.inc-title { font-size:13px; letter-spacing:3px; opacity:.9; margin:10px 0 6px; }
.inc-name { font-size:24px; font-weight:800; margin-bottom:6px; }
.inc-reason { font-size:15px; opacity:.95; margin-bottom:14px; padding:0 12px; }
.inc-from { font-size:12px; opacity:.7; margin-bottom:24px; }
.inc-actions button { margin-top:8px; }
.inc-actions .btn-primary { background:#fff; color:#c1272d; }
.inc-actions .btn-ghost { color:#fff; border-color:rgba(255,255,255,0.4); }

/* ===== TOASTS ===== */
#toaster {
  position:fixed; top:env(safe-area-inset-top); left:0; right:0;
  display:flex; flex-direction:column; align-items:center; gap:6px;
  pointer-events:none; padding:10px; z-index:10000;
}
.toast {
  background:#1a2233; color:#fff; padding:10px 16px; border-radius:24px;
  font-size:14px; max-width:90%; box-shadow:0 4px 12px rgba(0,0,0,0.25);
  transition: opacity .4s;
}
.toast.ok { background:#1a7f3e; }
.toast.warn { background:#e89b1c; }
.toast.err { background:#c1272d; }

/* ===== Hide video mount default (sam-video.js shows it when call active) ===== */
#sam-video-mount:empty { display:none; }

/* ===== Tablet/desktop refinement ===== */
@media (min-width: 768px) {
  body { background:#0f1f33; }
  .screen { max-width:480px; margin:0 auto; min-height:100vh; background:#f4f6f9; box-shadow:0 0 32px rgba(0,0,0,0.2); }
  #screen-login { background: linear-gradient(160deg, #1a3656 0%, #0f1f33 100%); }
}

/* === Dictation button === */
.dict-btn{
  display:inline-flex; align-items:center; justify-content:center;
  width:30px; height:30px;
  border:0; border-radius:50%;
  background:#1a3656; color:#fff;
  font-size:14px; cursor:pointer;
  margin-left:8px; vertical-align:middle;
  transition:background .15s, transform .1s;
}
.dict-btn:active{ transform:scale(.9); }
.dict-btn.recording{
  background:#d22; animation: dict-pulse 1s infinite;
}
@keyframes dict-pulse{ 0%,100%{ opacity:1 } 50%{ opacity:.55 } }
.card-h{ display:flex; align-items:center; justify-content:space-between; }
.lbl{ display:flex; align-items:center; justify-content:space-between; }
