:root{
  --blue:#1F6FB2;--blue-d:#175A93;--blue-soft:#E8F2FB;--bg:#F6F9FC;--card:#fff;
  --ink:#12263A;--mute:#566778;--line:#DFE8F0;
  --ok:#2A7653;--ok-soft:#E4F3EB;--warn:#8A5D0B;--warn-soft:#FBF0D9;--bad:#A8362F;--bad-soft:#FBE9E7;
  --r:14px;--sh:0 1px 2px rgba(18,38,58,.05),0 4px 14px rgba(18,38,58,.05)
}
*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;font:16px/1.5 system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;color:var(--ink);background:var(--bg)}
h1,h2,h3,p{margin:0}
h1{font-size:1.5rem;line-height:1.25}h2{font-size:1.2rem;line-height:1.3}h3{font-size:1.05rem;line-height:1.3}
a{color:var(--blue)}
.ic{width:22px;height:22px;flex:none}
.muted{color:var(--mute)}.small{font-size:.875rem}
:focus-visible{outline:3px solid #7DB4E6;outline-offset:2px}
@media (prefers-reduced-motion:reduce){*{transition:none!important;animation:none!important}}

.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:48px;padding:0 20px;border-radius:12px;border:1px solid var(--blue);background:var(--blue);color:#fff;font-family:inherit;font-size:1rem;font-weight:600;cursor:pointer;text-decoration:none;transition:background .2s}
.btn:hover{background:var(--blue-d)}
.btn.ghost{background:#fff;color:var(--blue)}.btn.ghost:hover{background:var(--blue-soft)}
.btn.block{display:flex;width:100%}
.btn.sm{min-height:40px;padding:0 14px;font-size:.9rem}
.btn[disabled]{opacity:.55;cursor:not-allowed}

.card{background:var(--card);border:1px solid var(--line);border-radius:var(--r);padding:16px;box-shadow:var(--sh)}
.chip{display:inline-block;padding:3px 10px;border-radius:999px;background:var(--blue-soft);color:var(--blue-d);font-size:.8rem;font-weight:600}
.badge{display:inline-block;padding:3px 10px;border-radius:999px;font-size:.8rem;font-weight:600}
.b-Pending{background:var(--warn-soft);color:var(--warn)}
.b-Confirmed{background:var(--blue-soft);color:var(--blue-d)}
.b-Completed,.b-Active{background:var(--ok-soft);color:var(--ok)}
.b-Cancelled,.b-Inactive{background:var(--bad-soft);color:var(--bad)}

label{display:block;font-weight:600;font-size:.9rem;margin:14px 0 6px}
input,select,textarea{width:100%;min-height:48px;padding:10px 14px;border:1px solid #C5D3E0;border-radius:12px;background:#fff;color:var(--ink);font:inherit}
input:focus,select:focus,textarea:focus{border-color:var(--blue);outline:3px solid #BFDDF6;outline-offset:0}
.err{color:var(--bad);font-size:.85rem;margin-top:4px;min-height:1.2em}

.logo{display:inline-flex;align-items:center;gap:10px;color:var(--ink);text-decoration:none}
.logo b{display:grid;place-items:center;width:36px;height:36px;border-radius:10px;background:var(--blue);color:#fff;font-size:1.15rem}
.logo span{font-weight:700;letter-spacing:.06em;font-size:1.1rem}

#toast{position:fixed;left:50%;bottom:92px;transform:translate(-50%,12px);max-width:90%;padding:12px 18px;border-radius:12px;background:#12263A;color:#fff;font-size:.95rem;opacity:0;pointer-events:none;transition:opacity .25s,transform .25s;z-index:50}
#toast.on{opacity:1;transform:translate(-50%,0)}

/* patient app shell */
.shell{max-width:480px;margin:0 auto;min-height:100vh;background:var(--bg);padding-bottom:84px;position:relative}
@media (min-width:520px){body.app{background:#E9F0F7}.shell{box-shadow:0 0 0 1px var(--line),0 12px 40px rgba(18,38,58,.12)}}
.top{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:8px;height:60px;padding:0 16px;background:#fff;border-bottom:1px solid var(--line)}
.top .back{display:grid;place-items:center;width:44px;height:44px;margin-left:-10px;border:0;background:none;color:var(--ink);cursor:pointer;border-radius:12px}
.top .ttl{font-weight:700;flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.pad{padding:16px;display:grid;gap:14px}
.nav{position:fixed;bottom:0;left:50%;transform:translateX(-50%);width:min(100%,480px);display:grid;grid-template-columns:repeat(5,1fr);background:#fff;border-top:1px solid var(--line);z-index:30}
.nav a{display:flex;flex-direction:column;align-items:center;gap:2px;padding:8px 0 10px;min-height:64px;color:var(--mute);text-decoration:none;font-size:.75rem;font-weight:600}
.nav a[aria-current=page]{color:var(--blue)}
.hero{background:linear-gradient(160deg,#1F6FB2,#2C86CE);color:#fff;border-radius:18px;padding:20px}
.hero p{opacity:.92;margin-top:6px}
.search{display:flex;gap:8px;margin-top:16px}
.search input{border:0}
.grid{display:grid;grid-template-columns:repeat(2,1fr);gap:12px}
.tile{display:flex;flex-direction:column;gap:10px;padding:16px;min-height:104px;background:#fff;border:1px solid var(--line);border-radius:var(--r);box-shadow:var(--sh);color:var(--ink);text-decoration:none;font-weight:600;transition:border-color .2s,background .2s}
.tile:hover{border-color:var(--blue);background:#FBFDFF}
.tile .ic{width:28px;height:28px;color:var(--blue)}
.tile small{font-weight:400;color:var(--mute);font-size:.8rem;line-height:1.3}
.list{display:grid;gap:12px}
a.card{display:block;color:inherit;text-decoration:none}
.row{display:flex;align-items:center;justify-content:space-between;gap:10px}
.chips{display:flex;flex-wrap:wrap;gap:6px;margin-top:10px}
.kv{display:grid;grid-template-columns:auto 1fr;gap:6px 14px;font-size:.95rem}
.kv dt{color:var(--mute)}.kv dd{margin:0}
.sec{font-size:.8rem;font-weight:700;letter-spacing:.06em;text-transform:uppercase;color:var(--mute)}
.note{background:var(--blue-soft);color:var(--blue-d);border-radius:12px;padding:12px 14px;font-size:.9rem}
.empty{text-align:center;padding:36px 16px;color:var(--mute)}
.price{font-weight:700;font-size:1.05rem}
.done{display:grid;place-items:center;width:64px;height:64px;margin:0 auto 12px;border-radius:50%;background:var(--ok-soft);color:var(--ok)}
.done .ic{width:32px;height:32px}

/* admin */
.adm{display:grid;grid-template-columns:240px 1fr;min-height:100vh}
.side{background:#fff;border-right:1px solid var(--line);padding:18px 14px;position:sticky;top:0;height:100vh;overflow:auto}
.side nav{display:grid;gap:4px;margin-top:22px}
.side nav a{display:flex;align-items:center;gap:10px;min-height:44px;padding:0 12px;border-radius:10px;color:var(--ink);text-decoration:none;font-weight:600}
.side nav a:hover{background:var(--bg)}
.side nav a[aria-current=page]{background:var(--blue-soft);color:var(--blue-d)}
.main{padding:24px;min-width:0}
.main>*+*{margin-top:18px}
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(170px,1fr));gap:12px}
.kpi b{display:block;font-size:1.7rem;margin-top:4px}
.tw{overflow-x:auto;background:#fff;border:1px solid var(--line);border-radius:var(--r)}
table{width:100%;border-collapse:collapse;font-size:.92rem}
th,td{text-align:left;padding:11px 14px;border-bottom:1px solid var(--line);white-space:nowrap}
th{font-size:.78rem;text-transform:uppercase;letter-spacing:.05em;color:var(--mute);background:#FAFCFE}
tr:last-child td{border-bottom:0}
.bar{height:10px;border-radius:6px;background:var(--blue-soft);overflow:hidden}.bar i{display:block;height:100%;background:var(--blue)}
.tools{display:flex;flex-wrap:wrap;gap:10px;align-items:center}
.tools select{width:auto;min-height:44px}
@media (max-width:860px){
  .adm{grid-template-columns:1fr}
  .side{position:static;height:auto;border-right:0;border-bottom:1px solid var(--line)}
  .side nav{display:flex;overflow-x:auto;margin-top:12px}
  .side nav a{white-space:nowrap}
  .main{padding:16px}
}

/* landing */
.wrap{max-width:960px;margin:0 auto;padding:24px 16px 48px}
.two{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:16px;margin-top:24px}
.big{display:flex;flex-direction:column;gap:12px;padding:24px}
.big .ic{width:34px;height:34px;color:var(--blue)}
ul.ticks{margin:0;padding-left:20px;color:var(--mute)}

/* admin dialog and sign-in */
dialog{width:min(560px,94vw);max-height:90vh;overflow:auto;border:0;border-radius:18px;padding:22px;color:var(--ink);box-shadow:0 20px 60px rgba(18,38,58,.3)}
dialog::backdrop{background:rgba(18,38,58,.45)}
#login{min-height:100vh;display:grid;place-items:center;padding:16px}
.login{width:min(400px,100%);padding:28px}

/* avatars, media rows, map */
.media{display:flex;gap:14px;align-items:flex-start}.media>div{flex:1;min-width:0}
.av{flex:none;display:grid;place-items:center;width:48px;height:48px;border-radius:50%;background:var(--blue-soft);color:var(--blue-d);font-weight:700;letter-spacing:.02em}
.av.sq{border-radius:12px}.av.sq .ic{width:24px;height:24px}
.av.big{width:64px;height:64px;font-size:1.3rem}
.map{display:block;width:100%;height:220px;border:1px solid var(--line);border-radius:12px;margin-top:14px;background:var(--blue-soft)}

/* wide website layout for computers and large tablets */
@media (min-width:900px){
  body.app{background:var(--bg)}
  .shell{max-width:none;box-shadow:none;background:transparent;padding-bottom:48px}
  .top{height:68px;padding:0 max(24px,calc((100% - 1120px)/2))}
  .top .ttl{max-width:calc(100% - 640px)}
  #view{max-width:1120px;margin:0 auto}
  .pad{padding:28px 24px 40px;gap:18px}
  .nav{top:0;left:0;bottom:auto;transform:none;width:100%;height:68px;display:flex;justify-content:flex-end;align-items:center;gap:4px;padding:0 max(24px,calc((100% - 1120px)/2));background:none;border:0;pointer-events:none}
  .nav a{flex-direction:row;gap:8px;min-height:44px;padding:0 14px;border-radius:12px;font-size:.95rem;pointer-events:auto}
  .nav a:hover{background:var(--bg)}.nav a[aria-current=page]{background:var(--blue-soft)}
  .hero{padding:44px}.hero h1{font-size:2.2rem;max-width:640px}.hero p{font-size:1.1rem}.search{max-width:520px}
  .grid{grid-template-columns:repeat(4,1fr);gap:16px}
  .list{grid-template-columns:repeat(auto-fill,minmax(340px,1fr));gap:16px}
  .pad>.card,.pad>form.card,.pad>.btn.block,.pad>input,.pad>select,.pad>.note{max-width:640px}
  #toast{bottom:32px}
}

#view:focus,#view:focus-visible{outline:0}
