/* Today 2.0 — Phase 1 Home. Scoped to .today2-home; no legacy premium-home-* / ht-home-* classes.
   Breakpoints mirror the global header search visibility in clinic-os-v287.css:
   >=1240 global search visible · <=1239 Home-local search visible. */

.today2-home{
  --t2-surface:var(--ht-surface,#fff);
  --t2-elevated:var(--ht-elevated,#fbfcfe);
  --t2-border:var(--ht-border,#e2e8f0);
  --t2-text:var(--ht-text,#18212f);
  --t2-secondary:var(--ht-secondary,#4b5565);
  --t2-muted:var(--ht-muted,#7b8794);
  --t2-primary:var(--ht-primary,#4f6fdb);
  --t2-primary-tint:var(--ht-primary-tint,#eef2ff);
  --t2-success:var(--ht-success,#2f855a);
  --t2-warning:var(--ht-warning,#b7791f);
  --t2-warning-tint:var(--ht-warning-tint,#fff7e6);
  --t2-critical:var(--ht-critical,#c2413b);
  --t2-critical-tint:var(--ht-critical-tint,#fff0ef);
  --t2-allergy:var(--ht-allergy,#a23b72);
  --t2-allergy-tint:var(--ht-allergy-tint,#fbeaf3);
  --t2-pending:var(--ht-pending,#8b6fb3);
  --t2-pending-tint:var(--ht-pending-tint,#f4f0fa);
  --t2-radius:var(--ht-radius-card,8px);
  display:grid;gap:14px;max-width:1320px;margin:0 auto;color:var(--t2-text);
}
.today2-home *{box-sizing:border-box}
.today2-home ul{list-style:none;margin:0;padding:0}
.today2-home p{margin:0}

/* Header */
.today2-home .today2-header{display:grid;grid-template-columns:minmax(0,1fr) auto;gap:6px 16px;align-items:center;padding:4px 0 10px;border-bottom:1px solid var(--t2-border)}
.today2-home h1.today2-date{margin:0!important;font-size:20px!important;line-height:28px!important;font-weight:700!important;color:var(--t2-text)!important;text-transform:none}
.today2-home .today2-stats{grid-column:1;color:var(--t2-secondary);font-size:13px;line-height:20px}
.today2-home .today2-fresh{grid-column:2;grid-row:1 / span 2;display:flex;align-items:center;gap:8px;color:var(--t2-muted);font-size:12px}
.today2-home .today2-search{grid-column:1 / -1;position:relative;display:none}
.today2-home .today2-search input{width:100%;min-height:44px;padding:9px 12px}
.today2-home .today2-search-results{position:absolute;z-index:30;left:0;right:0;top:calc(100% + 4px);display:grid;gap:2px;padding:6px;background:var(--t2-surface);border:1px solid var(--t2-border);border-radius:var(--t2-radius);box-shadow:var(--ht-shadow-elevated,0 6px 18px rgba(15,23,42,.08));max-height:320px;overflow:auto}
.today2-home .today2-search-results[hidden]{display:none}
.today2-home .today2-search-result{display:flex;align-items:center;justify-content:space-between;gap:10px;width:100%;min-height:44px;padding:8px 10px;border:0;border-radius:6px;background:transparent;color:var(--t2-text);text-align:left;cursor:pointer}
.today2-home .today2-search-result:hover,.today2-home .today2-search-result:focus-visible{background:var(--t2-elevated)}
.today2-home .today2-search-result strong{display:block;font-size:14px}
.today2-home .today2-search-result small{display:block;color:var(--t2-muted);font-size:12px}
.today2-home .today2-search-empty{padding:10px;color:var(--t2-muted);font-size:13px}

/* Shared controls */
.today2-home .today2-btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;min-height:40px;padding:8px 14px;border-radius:6px;border:1px solid var(--t2-border);background:var(--t2-surface);color:var(--t2-secondary);font-size:13px;font-weight:600;line-height:18px;text-decoration:none;cursor:pointer;white-space:nowrap;box-shadow:none}
.today2-home .today2-btn-primary{background:var(--t2-primary);border-color:var(--t2-primary);color:#fff;min-height:44px;padding:10px 20px;font-size:14px}
.today2-home .today2-btn-outline{background:transparent;border-color:var(--t2-border);color:var(--t2-primary)}
.today2-home .today2-btn-danger{background:transparent;border-color:var(--t2-critical);color:var(--t2-critical)}
.today2-home .today2-btn-sm{min-height:34px;padding:6px 10px;font-size:12px}
.today2-home .today2-btn:focus-visible,.today2-home .today2-link:focus-visible,.today2-home .today2-icon-btn:focus-visible{outline:2px solid var(--t2-primary);outline-offset:2px}
.today2-home .today2-link{padding:0;border:0;background:transparent;color:var(--t2-primary);font-size:13px;font-weight:600;cursor:pointer;text-decoration:none}
.today2-home .today2-link-warn{color:var(--t2-warning)}
.today2-home .today2-icon-btn{display:inline-grid;place-items:center;min-width:36px;min-height:36px;padding:0 8px;border:1px solid var(--t2-border);border-radius:6px;background:transparent;color:var(--t2-secondary);font-size:15px;text-decoration:none;cursor:pointer}
.today2-home .today2-icon-btn:disabled{opacity:.5;cursor:progress}
.today2-home .today2-zone-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:8px}
.today2-home h2.today2-zone-title{margin:0!important;font-size:11px!important;line-height:16px!important;font-weight:700!important;letter-spacing:.08em!important;color:var(--t2-muted)!important}
.today2-home h3.today2-group-title{margin:0!important;font-size:13px!important;line-height:20px!important;font-weight:700!important;color:var(--t2-text)!important}
.today2-home .today2-count{display:inline-grid;place-items:center;min-width:22px;height:20px;padding:0 6px;margin-left:4px;border-radius:999px;background:var(--t2-elevated);border:1px solid var(--t2-border);color:var(--t2-secondary);font-size:11px;font-weight:600}
.today2-home .today2-empty{padding:10px 2px;color:var(--t2-success);font-size:13px}
.today2-home .today2-signals{display:flex;flex-wrap:wrap;gap:6px}
.today2-home .today2-signal{display:inline-flex;align-items:center;padding:2px 8px;border-radius:999px;font-size:12px;font-weight:600;font-style:normal;line-height:18px;background:var(--t2-elevated);border:1px solid var(--t2-border);color:var(--t2-secondary)}
.today2-home .today2-signal-allergy{background:var(--t2-allergy-tint);border-color:transparent;color:var(--t2-allergy)}
.today2-home .today2-signal-previsit{background:var(--t2-primary-tint);border-color:transparent;color:var(--t2-primary)}
.today2-home .today2-signal-online{background:var(--t2-pending-tint);border-color:transparent;color:var(--t2-pending)}

/* Urgent strip */
.today2-home .today2-urgent-slot[hidden]{display:none}
.today2-home .today2-urgent{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;padding:12px 14px;border:1px solid var(--t2-critical);border-left-width:4px;border-radius:var(--t2-radius);background:var(--t2-critical-tint);color:var(--t2-text)}
.today2-home .today2-urgent-main{display:flex;flex-wrap:wrap;align-items:baseline;gap:6px 10px;font-size:14px}
.today2-home .today2-urgent-label{color:var(--t2-critical);letter-spacing:.04em}
.today2-home .today2-urgent-more{font-style:normal;color:var(--t2-critical);font-size:12px;font-weight:600}
.today2-home .today2-urgent-actions{display:flex;gap:8px}

/* Layout */
.today2-home .today2-grid{display:grid;grid-template-columns:minmax(0,3fr) minmax(0,2fr);gap:16px;align-items:start}
.today2-home .today2-main{display:grid;gap:16px;min-width:0}
.today2-home .today2-now,.today2-home .today2-flow,.today2-home .today2-pending,.today2-home .today2-also{background:var(--t2-surface);border:1px solid var(--t2-border);border-radius:var(--t2-radius);padding:14px}
.today2-home .today2-pending{position:sticky;top:84px;max-height:calc(100vh - 100px);overflow:auto;display:grid;gap:14px;background:var(--t2-elevated)}
.today2-home .today2-mobile-extra{display:none}

/* NOW */
.today2-home .today2-now-card{display:grid;gap:8px;padding:14px;border:1px solid var(--t2-primary);border-radius:var(--t2-radius);background:var(--t2-surface)}
.today2-home .today2-now-card.is-active,.today2-home .today2-now-card.is-direct{border-color:var(--t2-success)}
.today2-home .today2-now-time{display:flex;align-items:baseline;gap:10px}
.today2-home .today2-now-time strong{font-size:22px;line-height:28px}
.today2-home .today2-now-time span{color:var(--t2-secondary);font-size:14px;font-weight:600}
.today2-home .today2-now-who{display:flex;align-items:baseline;flex-wrap:wrap;gap:4px 10px}
.today2-home .today2-now-name{padding:0;border:0;background:transparent;color:var(--t2-text);font-size:20px;line-height:26px;font-weight:700;text-align:left;cursor:pointer}
.today2-home .today2-now-name:hover{text-decoration:underline}
.today2-home .today2-now-age{color:var(--t2-secondary);font-size:14px}
.today2-home .today2-now-reason{color:var(--t2-secondary);font-size:15px}
.today2-home .today2-now-actions{display:flex;align-items:center;flex-wrap:wrap;gap:10px 16px;margin-top:4px}
.today2-home .today2-now-line{padding:12px 14px;border:1px dashed var(--t2-border);border-radius:var(--t2-radius);color:var(--t2-secondary);font-size:14px}
.today2-home .today2-now-line.is-complete{color:var(--t2-success);border-style:solid}
.today2-home .today2-without-start{display:grid;gap:6px;margin-top:10px}
.today2-home .today2-without-start-row{display:flex;align-items:center;justify-content:space-between;gap:10px;padding:8px 10px;border-radius:6px;background:var(--t2-warning-tint);color:var(--t2-text);font-size:13px}
.today2-home .today2-after{margin-top:10px;color:var(--t2-muted);font-size:13px}
.today2-home .today2-after span{color:var(--t2-secondary)}

/* PENDING */
.today2-home h2.today2-pending-title{margin-bottom:-4px!important}
.today2-home .today2-group{display:grid;gap:6px}
.today2-home .today2-group-head{display:flex;align-items:center;justify-content:space-between;gap:8px}
.today2-home .today2-mobile-toggle{display:none}
.today2-home .today2-list{display:grid;gap:4px}
.today2-home .today2-item{display:flex;align-items:center;gap:10px;padding:8px 10px;border:1px solid var(--t2-border);border-radius:6px;background:var(--t2-surface)}
.today2-home .today2-item.is-urgent{border-left:3px solid var(--t2-critical)}
.today2-home .today2-item-online{border-left:3px solid var(--t2-pending)}
.today2-home .today2-item.is-quiet{opacity:.72}
.today2-home .today2-item.is-overdue .today2-item-main small{color:var(--t2-warning)}
.today2-home .today2-item-main{display:grid;gap:1px;min-width:0;flex:1}
.today2-home .today2-item-main-btn{padding:0;border:0;background:transparent;color:inherit;text-align:left;cursor:pointer}
.today2-home .today2-item-type{color:var(--t2-muted);font-size:11px;font-weight:600;text-transform:none}
.today2-home .today2-item-main strong{font-size:14px;line-height:20px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.today2-home .today2-item-main small{color:var(--t2-secondary);font-size:12px;line-height:17px}
.today2-home .today2-item-actions{display:flex;align-items:center;gap:6px;flex-shrink:0}
.today2-home .today2-check{width:22px;height:22px;min-width:22px;border:1.5px solid var(--t2-muted);border-radius:6px;background:var(--t2-surface);cursor:pointer;padding:0}
.today2-home .today2-check:hover{border-color:var(--t2-primary)}
.today2-home .today2-more{justify-self:start;margin-top:2px}
.today2-home .today2-group-foot{display:flex;justify-content:flex-end;padding-top:2px}

/* DAY FLOW */
.today2-home .today2-flow-done-toggle{margin:0 0 6px}
.today2-home .today2-flow-list{display:grid;gap:2px}
.today2-home .today2-flow-row{display:flex;align-items:center;gap:8px;padding:4px 6px;border-radius:6px}
.today2-home .today2-flow-row.is-now{background:var(--t2-primary-tint)}
.today2-home .today2-flow-row.is-late{background:var(--t2-warning-tint)}
.today2-home .today2-flow-row.is-done{opacity:.7}
.today2-home .today2-flow-open{display:grid;grid-template-columns:128px 48px minmax(0,1.1fr) minmax(0,1.4fr);align-items:center;gap:10px;flex:1;min-width:0;min-height:40px;padding:4px 2px;border:0;background:transparent;color:var(--t2-text);text-align:left;cursor:pointer;font-size:13px}
.today2-home .today2-flow-state{display:flex;align-items:center;gap:6px;color:var(--t2-secondary);font-size:12px}
.today2-home .today2-flow-state b{display:inline-grid;place-items:center;width:18px;font-size:13px}
.today2-home .is-late .today2-flow-state,.today2-home .is-pending .today2-flow-state{color:var(--t2-warning)}
.today2-home .is-pending .today2-flow-state{color:var(--t2-pending)}
.today2-home .is-active .today2-flow-state,.today2-home .is-done .today2-flow-state{color:var(--t2-success)}
.today2-home .today2-flow-time{font-weight:700;font-variant-numeric:tabular-nums}
.today2-home .today2-flow-who{display:flex;align-items:baseline;gap:6px;min-width:0}
.today2-home .today2-flow-who strong{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.today2-home .today2-flow-who small{color:var(--t2-muted);white-space:nowrap}
.today2-home .today2-flow-reason{color:var(--t2-secondary);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.today2-home .today2-flow-reason .today2-signal{margin-left:4px;padding:0 6px;font-size:11px}

/* TODAY ALSO */
.today2-home .today2-also[hidden]{display:none}
.today2-home .today2-also-row{display:flex;align-items:center;flex-wrap:wrap;gap:8px 14px}
.today2-home .today2-also-chips{display:flex;flex-wrap:wrap;gap:8px}
.today2-home .today2-also-chip{min-height:36px;padding:6px 12px;border:1px solid var(--t2-border);border-radius:999px;background:var(--t2-elevated);color:var(--t2-secondary);font-size:13px;font-weight:600;cursor:pointer}
.today2-home .today2-also-chip.is-open{border-color:var(--t2-primary);color:var(--t2-primary);background:var(--t2-primary-tint)}
.today2-home .today2-also-content{margin-top:12px}

/* 1024–1239: global search hidden → Home-local search visible; two columns kept. */
@media (max-width:1239px){
  .today2-home .today2-search{display:block}
  .today2-home .today2-flow-open{grid-template-columns:112px 44px minmax(0,1fr) minmax(0,1.2fr)}
}

/* 821–1023: single column NOW → PENDING → DAY FLOW. */
@media (max-width:1023px){
  .today2-home .today2-grid{display:flex;flex-direction:column;align-items:stretch;gap:14px}
  .today2-home .today2-main{display:contents}
  .today2-home .today2-now{order:1}
  .today2-home .today2-pending{order:2;position:static;max-height:none;overflow:visible}
  .today2-home .today2-flow{order:3}
  .today2-home .today2-flow-open{grid-template-columns:auto 44px minmax(0,1fr)}
  .today2-home .today2-flow-reason{grid-column:2 / -1}
}

/* <=820: mobile companion. */
@media (max-width:820px){
  .today2-home{gap:10px}
  .today2-home .today2-header{padding-top:6px}
  /* Sticky patient search just below the sticky mobile app header (56px). */
  .today2-home .today2-search{position:sticky;top:56px;z-index:20;padding:6px 0;background:var(--ht-bg,#f5f7fa)}
  .today2-home h1.today2-date{font-size:17px!important;line-height:24px!important}
  .today2-home .today2-stats{font-size:12px}
  .today2-home .today2-search input{font-size:16px}
  .today2-home .today2-pending{display:contents}
  .today2-home h2.today2-pending-title{display:none}
  .today2-home #today2Waiting{order:2;background:var(--t2-surface);border:1px solid var(--t2-border);border-radius:var(--t2-radius);padding:12px}
  .today2-home .today2-flow{order:3}
  .today2-home #today2Clinic{order:4;background:var(--t2-surface);border:1px solid var(--t2-border);border-radius:var(--t2-radius);padding:12px}
  .today2-home .today2-mobile-toggle{display:inline-flex;min-height:44px;align-items:center}
  .today2-home #today2Clinic.is-mobile-collapsible:not(.is-mobile-open) .today2-group-body{display:none}
  .today2-home .today2-flow-row.is-past,.today2-home .today2-flow-done-toggle{display:none}
  .today2-home .today2-flow-open{grid-template-columns:44px minmax(0,1fr);gap:2px 10px}
  .today2-home .today2-flow-state{display:none}
  .today2-home .today2-flow-reason{grid-column:2}
  .today2-home .today2-now-card{padding:12px}
  .today2-home .today2-now-actions{display:grid;grid-template-columns:1fr}
  .today2-home .today2-btn,.today2-home .today2-btn-sm,.today2-home .today2-icon-btn{min-height:44px}
  .today2-home .today2-icon-btn{min-width:44px}
  .today2-home .today2-check{width:28px;height:28px;min-width:28px}
  .today2-home .today2-item{min-height:56px}
  .today2-home .today2-urgent{flex-direction:column;align-items:stretch}
  .today2-home .today2-mobile-extra{display:flex;justify-content:center;padding:4px 0 12px}
}

/* Mobile: Patient Card is the visually dominant NOW action; the existing visit path stays available. */
@media (max-width:820px){
  .today2-home .today2-now-card-link{order:-1;display:flex;align-items:center;justify-content:center;min-height:44px;border:1px solid var(--t2-primary);border-radius:6px;color:var(--t2-primary)}
  .today2-home .today2-now-actions .today2-btn-primary{background:transparent;color:var(--t2-primary)}
}
