*,*::before,*::after{box-sizing:border-box;margin:0;padding:0}
html{font-size:17px;-webkit-text-size-adjust:100%}
body{
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif;
  background:linear-gradient(180deg,#eef2ff 0%,#f0f4f8 100%);
  color:#1e293b;min-height:100dvh;-webkit-font-smoothing:antialiased;
  overscroll-behavior-y:contain;
}
.hidden{display:none!important}
.muted{color:#94a3b8}
.mono{font-family:ui-monospace,Menlo,Consolas,monospace;font-size:12px;word-break:break-all;text-align:right}
.error{color:#dc2626;font-size:13px;font-weight:600}
.msg{color:#166534;font-size:13px;font-weight:600}
.tiny{font-size:12px;padding:8px 10px}
small{font-size:12px}
button{-webkit-tap-highlight-color:transparent}

/* ---------- login ---------- */
.login-screen{min-height:100dvh;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:18px;padding:24px 16px calc(env(safe-area-inset-bottom) + 24px)}
.brand{display:flex;flex-direction:column;align-items:center;gap:8px;text-align:center}
.logo{width:78px;height:78px;border-radius:22px;background:linear-gradient(135deg,#4f46e5,#7c3aed);display:flex;align-items:center;justify-content:center;font-weight:800;font-size:28px;color:#fff;letter-spacing:1px;box-shadow:0 10px 26px rgba(79,70,229,.4)}
.brand h1{font-size:23px;font-weight:800}
.brand p{font-size:13px;color:#64748b}
#login-form{width:100%;max-width:420px}
.hint{font-size:12px;color:#94a3b8;text-align:center}

/* ---------- generic ---------- */
label{display:flex;flex-direction:column;gap:6px;font-size:12px;color:#475569;font-weight:600}
input,select{
  font:inherit;font-size:16px;padding:12px 13px;border:2px solid #e2e8f0;border-radius:12px;
  background:#f8fafc;width:100%;outline:none;transition:border .2s,background .2s;color:#1e293b;
}
input:focus,select:focus{border-color:#4f46e5;background:#fff}
input[type="datetime-local"]{font-size:15px}

button{cursor:pointer;border:none;border-radius:13px;font:inherit;font-size:15px;font-weight:700;padding:13px 16px;transition:transform .15s,filter .15s}
button:active{transform:scale(.97)}
button:disabled{opacity:.45;cursor:not-allowed}
.primary{background:linear-gradient(135deg,#4f46e5,#6d28d9);color:#fff;box-shadow:0 5px 16px rgba(79,70,229,.3)}
.primary.big{width:100%;padding:15px;font-size:16px}
.ghost{background:transparent;color:#4f46e5;padding:8px 12px;font-size:14px}
.ghost.danger,.danger{color:#dc2626}
.icon-btn{
  width:44px;height:44px;padding:0;display:flex;align-items:center;justify-content:center;font-size:20px;
  background:#fff;color:#334155;border:1px solid #e2e8f0;border-radius:14px;box-shadow:0 2px 6px rgba(30,41,59,.06);flex-shrink:0;
}
.icon-btn:active{transform:scale(.92);background:#f1f5f9}
.burger{display:flex;flex-direction:column;gap:4px}
.burger i{display:block;width:19px;height:2px;border-radius:2px;background:#334155}

/* ---------- app shell ---------- */
#app{display:flex;flex-direction:column;min-height:100dvh}
.appbar{
  position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:10px;
  padding:calc(env(safe-area-inset-top) + 10px) 14px 10px;
  background:rgba(240,244,248,.92);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);
}
.appbar-title{display:flex;align-items:center;gap:9px;min-width:0;flex:1}
.appbar-title strong{font-size:18px;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.dot{width:9px;height:9px;border-radius:50%;background:#22c55e;flex-shrink:0;box-shadow:0 0 0 3px rgba(34,197,94,.18)}
.content{flex:1;padding:4px 14px calc(env(safe-area-inset-bottom) + 30px)}
.view{display:flex;flex-direction:column;gap:14px;max-width:560px;width:100%;margin:0 auto}
.view:not(.hidden){animation:fade .28s ease both}
@keyframes fade{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}

/* ---------- cards ---------- */
.card{
  background:#fff;border-radius:18px;padding:16px;box-shadow:0 2px 10px rgba(30,41,59,.07);
  display:flex;flex-direction:column;gap:12px;
}
.card h2{font-size:15px;font-weight:800;color:#334155}
.card .sub{font-size:12px;color:#94a3b8;margin-top:-6px}
.row-between{display:flex;align-items:center;justify-content:space-between;gap:10px}
.page-title{font-size:21px;font-weight:800}
.list{display:flex;flex-direction:column;gap:9px}

/* ---------- metrics ---------- */
.metrics{display:grid;grid-template-columns:1fr 1fr;gap:9px}
.metric{background:#f8fafc;border:1px solid #eef2f7;border-radius:14px;padding:12px;display:flex;flex-direction:column;gap:3px}
.metric span{font-size:11.5px;color:#64748b;font-weight:700}
.metric b{font-size:20px;font-weight:800;color:#1e293b;letter-spacing:-.5px}
.metric b i{font-size:12px;font-weight:700;color:#94a3b8;font-style:normal}
.metric.accent{background:linear-gradient(135deg,#eef2ff,#f5f3ff);border-color:#e0e7ff}
.metric.accent b{color:#4338ca}

/* ---------- kv ---------- */
.kv{display:flex;flex-direction:column;gap:2px}
.kv-row{display:flex;justify-content:space-between;align-items:center;gap:10px;font-size:14px;color:#475569;padding:8px 0;border-bottom:1px solid #f1f5f9}
.kv-row:last-child{border:none}
.kv-row b{color:#1e293b;font-size:14px;text-align:right}

/* ---------- chips / tags ---------- */
.chips{display:flex;flex-wrap:wrap;gap:6px}
.chip{background:#ede9fe;color:#5b21b6;font-size:12px;padding:5px 10px;border-radius:9px;font-weight:700}
.tag{font-size:11.5px;font-weight:800;padding:4px 10px;border-radius:9px;white-space:nowrap}
.tag-open{background:#dcfce7;color:#166534}
.tag-closed{background:#fef2f2;color:#991b1b}
.badge{font-size:10px;font-weight:800;padding:3px 8px;border-radius:8px;white-space:nowrap}
.badge-carry{background:#ffedd5;color:#9a3412}
.badge-hidden{background:#fef2f2;color:#b91c1c}
.badge-delivered{background:#dcfce7;color:#166534}

/* ---------- list items ---------- */
.item{background:#fafbfd;border:1px solid #eef2f7;border-radius:14px;padding:13px;display:flex;justify-content:space-between;align-items:center;gap:10px}
.item:active{border-color:#c7d2fe}
.item .info{display:flex;flex-direction:column;gap:3px;min-width:0}
.item .info b{font-size:15px}
.item .info small{color:#94a3b8}
.item .nums{text-align:right;display:flex;flex-direction:column;gap:2px;flex-shrink:0}
.item .nums b{font-size:15px;color:#1e293b}
.item .nums small{color:#94a3b8}

/* person */
.person{background:#fafbfd;border:1px solid #eef2f7;border-radius:14px;padding:12px 13px;display:flex;justify-content:space-between;align-items:center;gap:10px}
.person.off{opacity:.55}
.person-main{display:flex;flex-direction:column;gap:4px;min-width:0}
.person-main b{font-size:15px}
.person-main small{color:#94a3b8}
.person-actions{display:flex;gap:2px;flex-shrink:0}
.person-actions .ghost{padding:9px;font-size:16px}

/* ---------- order cards (shift detail) ---------- */
.order-card{background:#f8fafc;border:1px solid #e2e8f0;border-radius:14px;padding:13px;display:flex;flex-direction:column;gap:9px}
.order-card.deleted{background:#fff7ed;border-color:#fed7aa}
.order-head{display:flex;justify-content:space-between;align-items:flex-start;gap:8px}
.order-head .nm{display:flex;flex-direction:column;gap:4px;min-width:0}
.order-head .nm b{font-size:15.5px;word-break:break-word}
.badges{display:flex;flex-direction:column;align-items:flex-end;gap:4px;flex-shrink:0}
.slots{display:flex;flex-wrap:wrap;gap:5px}
.slot{background:#fff;border:1px solid #e8edf5;border-radius:8px;padding:4px 8px;font-size:11px;font-weight:700;color:#475569;white-space:nowrap}
.order-actions{display:flex;gap:7px;flex-wrap:wrap}
.order-actions button{flex:1;min-width:110px;font-size:13px;padding:11px 8px;background:#fff;border:1px solid #e2e8f0}
.order-actions select{flex:1;min-width:130px;font-size:13px;padding:9px 10px}

/* ---------- calc ---------- */
.calc{background:#f8fafc;border-radius:12px;padding:12px;font-size:13.5px;color:#475569;display:flex;justify-content:space-between;align-items:center}
.calc b{font-size:18px;color:#1e293b}

/* ---------- server details ---------- */
.server-details{border:1px solid #eef2f7;border-radius:12px;padding:10px 12px;background:#fafbfd}
.server-details summary{cursor:pointer;font-size:13px;font-weight:700;color:#475569;outline:none}
.server-row{display:flex;gap:8px;margin-top:10px}
.server-quick{display:flex;gap:8px;margin-top:8px}

/* ---------- drawer (боковое меню) ---------- */
.drawer{position:fixed;inset:0;z-index:50}
.drawer-overlay{position:absolute;inset:0;background:rgba(15,23,42,.5);animation:fade .2s ease both}
.drawer-panel{
  position:absolute;top:0;left:0;bottom:0;width:min(330px,86vw);
  background:#0f172a;color:#e2e8f0;display:flex;flex-direction:column;
  padding:calc(env(safe-area-inset-top) + 16px) 12px calc(env(safe-area-inset-bottom) + 14px);
  box-shadow:8px 0 30px rgba(0,0,0,.35);animation:slideIn .28s cubic-bezier(.2,.8,.3,1.05) both;
}
@keyframes slideIn{from{transform:translateX(-100%)}to{transform:none}}
.drawer-header{display:flex;align-items:center;gap:11px;padding:6px 8px 18px}
.drawer-header .logo.small{width:42px;height:42px;font-size:16px;border-radius:12px}
.drawer-who{flex:1;min-width:0;display:flex;flex-direction:column}
.drawer-who strong{font-size:15px;color:#fff;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.drawer-who small{font-size:11px;color:#94a3b8}
.drawer-header .icon-btn{background:#1e293b;border-color:#334155;color:#cbd5e1;box-shadow:none}
.drawer-nav{display:flex;flex-direction:column;gap:4px}
.drawer-item{
  display:flex;align-items:center;gap:12px;width:100%;text-align:left;
  background:transparent;color:#cbd5e1;padding:13px 14px;border-radius:13px;font-size:15px;font-weight:600;
}
.drawer-item i{font-size:20px;font-style:normal;width:26px;text-align:center;flex-shrink:0}
.drawer-item span{flex:1}
.drawer-item em{font-style:normal;color:#64748b;font-size:18px}
.drawer-item:active{background:#1e293b}
.drawer-item.active{background:linear-gradient(135deg,#4f46e5,#6d28d9);color:#fff}
.drawer-item.active em{color:#e0e7ff}
.drawer-item.danger{color:#f87171}
.drawer-item.danger:active{background:#1e293b}
.drawer-foot{margin-top:auto;display:flex;flex-direction:column;gap:10px;padding-top:12px;border-top:1px solid #1e293b}
.drawer-server{display:flex;flex-direction:column;gap:3px;padding:2px 8px}
.drawer-server small{color:#64748b;font-size:11px}
.drawer-server b{color:#94a3b8;text-align:left}

/* ---------- sheet ---------- */
.sheet{position:fixed;inset:0;z-index:60;display:flex;flex-direction:column;justify-content:flex-end}
.sheet-overlay{position:absolute;inset:0;background:rgba(15,23,42,.5);animation:fade .2s ease both}
.sheet-panel{
  position:relative;background:#fff;border-radius:22px 22px 0 0;padding:8px 16px calc(env(safe-area-inset-bottom) + 18px);
  max-height:92dvh;overflow-y:auto;overscroll-behavior:contain;animation:up .3s cubic-bezier(.2,.8,.3,1.05) both;
}
.sheet-panel.full{min-height:88dvh}
@keyframes up{from{transform:translateY(100%)}to{transform:none}}
.sheet-grip{width:44px;height:5px;border-radius:3px;background:#dbe2ea;margin:6px auto 12px}
#sheet-body{display:flex;flex-direction:column;gap:14px}
#sheet-body h3{font-size:18px;font-weight:800}
#sheet-body .sub{font-size:12px;color:#94a3b8}
.sheet-btns{display:flex;gap:10px;margin-top:4px}
.sheet-btns button{flex:1;padding:14px}
.danger-line{display:flex;justify-content:center}
.danger-line button{color:#dc2626;font-size:13px;padding:8px}

/* ---------- toast ---------- */
#toast{position:fixed;left:50%;bottom:calc(28px + env(safe-area-inset-bottom));transform:translate(-50%,20px);z-index:80;
  background:#0f172a;color:#fff;padding:12px 18px;border-radius:14px;font-size:14px;font-weight:700;
  opacity:0;pointer-events:none;transition:opacity .25s,transform .25s;max-width:90vw;text-align:center;box-shadow:0 10px 30px rgba(0,0,0,.3)}
#toast.show{opacity:1;transform:translate(-50%,0)}
#toast.ok{background:#166534}
#toast.err{background:#991b1b}

/* ---------- loading ---------- */
.loading{padding:24px;text-align:center;color:#94a3b8;font-size:14px}

/* ---------- крупный телефон / планшет ---------- */
@media (min-width:600px){
  html{font-size:18px}
  .content{padding-left:20px;padding-right:20px}
}
