/* Front Desk Pre-Chart. iPad first: 48px touch targets, 17px base text, one column. */
:root {
  --navy: #1F3A5F; --navy-2: #2C4D7A; --trim: #B9C2CC; --box: #EEF1F4; --page: #F7F8FA; --ink: #1A1A1A;
  --muted: #4B5563; --good: #1D7A55; --warn: #9A5B0B; --bad: #A32D2D; --white: #FFFFFF;
}
* { box-sizing: border-box; }
[x-cloak] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--ink); font: 17px/1.45 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
h2 { font-size: 1.25rem; margin: 22px 0 10px; }
button, input, select, textarea { font: inherit; color: inherit; }

/* fields: white face, grey trim, soft shadow, navy when active */
label { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; color: var(--muted); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], select, textarea {
  min-height: 48px; padding: 10px 12px; background: var(--white); border: 1.5px solid var(--trim); border-radius: 8px;
  box-shadow: 0 1px 3px rgba(31, 58, 95, .12); color: var(--ink); width: 100%;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy); box-shadow: 0 0 0 3px rgba(31, 58, 95, .18); }
label.check { flex-direction: row; align-items: center; gap: 10px; font-size: 1rem; color: var(--ink); }
label.check input { width: 22px; height: 22px; }

.btn { min-height: 48px; padding: 10px 18px; border-radius: 8px; border: 1.5px solid var(--trim); background: var(--white);
       font-weight: 700; cursor: pointer; box-shadow: 0 1px 3px rgba(31, 58, 95, .12); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: var(--white); }
.btn.big { min-height: 60px; padding: 14px 30px; font-size: 1.15rem; }
.btn.small { min-height: 40px; padding: 6px 12px; font-size: .9rem; }
.btn.ghost { background: transparent; border-color: rgba(255, 255, 255, .45); color: var(--white); box-shadow: none; }
.btn.block { width: 100%; }
.link { background: none; border: 0; padding: 8px 4px; color: var(--navy); text-decoration: underline; cursor: pointer; }

/* sign in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: 100%; max-width: 440px; background: var(--white); border: 1px solid var(--trim); border-top: 6px solid var(--navy);
              border-radius: 12px; padding: 28px; box-shadow: 0 6px 24px rgba(31, 58, 95, .12); }
.login-card form { display: flex; flex-direction: column; gap: 14px; margin-top: 16px; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { width: 52px; height: 52px; border-radius: 12px; background: var(--navy); color: var(--white); display: grid; place-items: center; font-weight: 800; letter-spacing: .5px; }
.brand-1 { font-size: 1.4rem; font-weight: 800; color: var(--navy); line-height: 1.1; }
.brand-2 { color: var(--muted); }
.links { text-align: center; margin: 0; }
.foot { margin: 18px 0 0; text-align: center; font-size: .85rem; color: var(--muted); }
.error { color: var(--bad); font-weight: 600; }
.error.banner { margin: 10px 16px 0; padding: 12px 14px; background: #FCEBEB; border: 1px solid #F7C1C1; border-radius: 8px; }
.notice { padding: 10px 12px; background: var(--box); border-radius: 8px; color: var(--muted); }

/* frame */
.band { background: var(--navy); color: var(--white); display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
        padding: 10px 16px; padding-top: calc(10px + env(safe-area-inset-top)); position: sticky; top: 0; z-index: 5; }
.band-title { font-size: 1.25rem; font-weight: 800; }
.tabs { display: flex; gap: 6px; flex: 1; }
.tabs button { min-height: 44px; padding: 8px 16px; border-radius: 8px; border: 0; background: transparent; color: #DCE4EE; font-weight: 700; cursor: pointer; }
.tabs button.on { background: var(--white); color: var(--navy); }
.who { display: flex; align-items: center; gap: 8px; font-size: .95rem; }
.page { padding: 14px 16px 40px; max-width: 1180px; margin: 0 auto; }

.controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.controls label { min-width: 200px; }
.controls .grow { flex: 1; min-width: 260px; }
.clinic-name { font-size: 1.35rem; font-weight: 800; color: var(--navy); align-self: center; padding-right: 8px; }

.days { display: flex; gap: 8px; margin: 14px 0 4px; overflow-x: auto; padding-bottom: 4px; }
.day { min-height: 56px; min-width: 120px; padding: 6px 14px; border-radius: 10px; border: 1.5px solid var(--trim); background: var(--white);
       display: flex; flex-direction: column; align-items: flex-start; cursor: pointer; font-weight: 700; }
.day small { font-weight: 400; color: var(--muted); }
.day.on { background: var(--navy); border-color: var(--navy); color: var(--white); }
.day.on small { color: #DCE4EE; }

.tiles { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin: 12px 0; }
.tile { background: var(--box); border: 1px solid var(--trim); border-radius: 10px; padding: 10px 12px; }
.tile-k { color: var(--navy); font-weight: 600; font-size: .9rem; }
.tile-v { font-size: 1.9rem; font-weight: 700; line-height: 1.2; }
.tile.warn .tile-v { color: var(--warn); }

/* queue: one tall tappable row per patient */
.list { display: flex; flex-direction: column; gap: 8px; }
.row { width: 100%; min-height: 68px; display: grid; grid-template-columns: 118px 86px 1fr minmax(120px, 190px) 84px; gap: 12px; align-items: center;
       text-align: left; padding: 10px 14px; background: var(--white); border: 1.5px solid var(--trim); border-left: 6px solid var(--navy);
       border-radius: 10px; cursor: pointer; box-shadow: 0 1px 3px rgba(31, 58, 95, .08); }
.row:active { background: var(--box); }
.row-time { font-weight: 700; }
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-name { font-size: 1.12rem; font-weight: 700; }
.row-sub { color: var(--muted); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-cov { color: var(--muted); font-size: .95rem; }
.row-todo { font-weight: 700; color: var(--navy); text-align: right; }
.row-todo.zero { color: var(--trim); }

.pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .85rem; font-weight: 700; text-align: center; white-space: nowrap; }
.pill.big { font-size: 1rem; padding: 8px 18px; }
.p-ready { background: var(--navy); color: var(--white); }
.p-progress { background: #FAEEDA; color: #633806; }
.p-done { background: #E1F5EE; color: #085041; }
.p-none { background: var(--box); color: var(--muted); }

/* card */
.card-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.box { background: var(--box); border: 1px solid var(--trim); border-left: 5px solid var(--navy); border-radius: 10px; padding: 14px 16px; margin: 10px 0; }
.box.item { border-left-color: var(--trim); display: flex; flex-direction: column; gap: 8px; }
.box.item.needed { border-left-color: var(--navy); background: var(--white); }
.pt-name { font-size: 1.75rem; font-weight: 800; line-height: 1.15; }
.pt-sub { color: var(--muted); margin-top: 3px; }
.chips { margin: 8px 0 4px; display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--white); border: 1px solid var(--trim); border-radius: 999px; padding: 3px 12px; font-size: .9rem; color: var(--navy); font-weight: 600; }
.item-title { font-size: 1.25rem; font-weight: 700; color: #6B7280; }
.needed .item-title, .funnel .item-title, .reveal .item-title { color: var(--navy); }
.item-why { color: var(--muted); }
.ctx { margin: 0; padding-left: 20px; color: #374151; }
.ctx li { margin: 2px 0; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.choice { min-height: 54px; padding: 10px 18px; border-radius: 10px; border: 2px solid var(--trim); background: var(--white); font-weight: 700; cursor: pointer; flex: 1 1 200px; }
.choice.on { background: var(--navy); border-color: var(--navy); color: var(--white); }
.choice:disabled { cursor: default; opacity: .75; }
.visit-note { margin-top: 14px; }
.info, .ok { padding: 12px 14px; border-radius: 8px; margin: 10px 0; }
.info { background: #E6F1FB; color: #0C447C; }
.ok { background: #E1F5EE; color: #085041; font-weight: 600; }
.actions { display: flex; gap: 12px; align-items: center; margin-top: 18px; position: sticky; bottom: 0; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--page) 70%, transparent); }
.spacer { flex: 1; }
.stamp { color: var(--muted); font-size: .9rem; margin-top: 12px; }
.empty { color: var(--muted); padding: 18px 4px; }

/* manager */
.funnels { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.funnel { margin: 0; }
.bar-row { display: grid; grid-template-columns: 70px 1fr 110px; gap: 10px; align-items: center; margin: 6px 0; font-size: .95rem; }
.bar-row b { text-align: right; font-variant-numeric: tabular-nums; }
.bar { height: 16px; background: var(--white); border: 1px solid var(--trim); border-radius: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--trim); }
.bar i.mid { background: var(--navy-2); }
.bar i.good { background: var(--good); }
.two { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--trim); border-radius: 10px; background: var(--white); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--box); white-space: nowrap; }
th { background: var(--box); color: var(--navy); font-weight: 700; }
td:nth-child(n+2), th:nth-child(n+2) { font-variant-numeric: tabular-nums; }
tr.off td { color: #9CA3AF; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.reveal code { font: 700 1.3rem ui-monospace, Consolas, monospace; background: var(--white); padding: 4px 10px; border-radius: 6px; border: 1px solid var(--trim); user-select: all; }

@media (max-width: 820px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .row { grid-template-columns: 104px 1fr 70px; grid-template-areas: "pill main todo" "time main todo"; row-gap: 2px; }
  .row .pill { grid-area: pill; } .row-time { grid-area: time; } .row-main { grid-area: main; } .row-todo { grid-area: todo; } .row-cov { display: none; }
  .who span { display: none; }
  .actions .btn.big { padding: 14px 18px; }
}
