:root{
  --brand:#17A589; --brand-d:#0E7C63; --brand-l:#E8F8F4;
  --ink:#16222C; --ink-2:#5A6B76; --ink-3:#8A98A2;
  --line:#E5EAEE; --bg:#F4F7F9; --card:#fff;
  --wait:#F39C12; --pick:#2E86DE; --done:#17A589; --prob:#E74C3C; --hold:#8E44AD;
  --tap:52px; --tabh:62px;
  --safeb:env(safe-area-inset-bottom,0px);
}
*{box-sizing:border-box; -webkit-tap-highlight-color:transparent}
html,body{margin:0;padding:0;height:100%}
body{
  font:15px/1.45 system-ui,-apple-system,"Segoe UI","Noto Sans JP",sans-serif;
  background:var(--bg); color:var(--ink); -webkit-text-size-adjust:100%;
  overscroll-behavior-y:none;
}
button{font:inherit}

/* ---------- màn hình + thanh dưới ---------- */
.screen{display:flex; flex-direction:column; min-height:100%;
        padding-bottom:var(--safeb)}
.screen[hidden]{display:none}

.tabbar{
  position:fixed; left:0; right:0; bottom:0; z-index:30;
  display:flex; background:var(--card); border-top:1px solid var(--line);
  padding-bottom:var(--safeb);
  box-shadow:0 -2px 12px rgba(20,35,45,.06);
}
.tab{
  flex:1; border:none; background:none; cursor:pointer;
  display:flex; flex-direction:column; align-items:center; gap:2px;
  padding:9px 4px 8px; font-size:11px; font-weight:600; color:var(--ink-3);
  min-height:var(--tabh);
}
.tab .ic{font-size:21px; line-height:1}
.tab.active{color:var(--brand)}
.tab .badge{
  position:absolute; transform:translate(16px,-4px);
  background:var(--prob); color:#fff; font-size:10px; font-weight:800;
  min-width:18px; height:18px; border-radius:9px; padding:0 5px;
  display:flex; align-items:center; justify-content:center;
}

/* ---------- header ---------- */
.top{
  position:sticky; top:0; z-index:20; background:var(--brand); color:#fff;
  padding:calc(10px + env(safe-area-inset-top,0px)) 12px 12px;
}
/* thanh tieu de cho man Thiet lap */
.top-bar{display:flex; align-items:center; gap:10px; padding-bottom:14px}
.back-btn{
  background:rgba(255,255,255,.2); border:none; color:#fff; width:38px; height:38px;
  border-radius:50%; font-size:26px; line-height:1; cursor:pointer; flex:0 0 38px;
  display:flex; align-items:center; justify-content:center; padding-bottom:4px;
}
.bar-title{flex:1; font-size:19px; font-weight:800}
.top-row{display:flex; align-items:flex-start; gap:10px}
.top-title{flex:1; min-width:0}
.top h1{margin:0; font-size:19px; font-weight:800; letter-spacing:-.2px;
        white-space:nowrap; overflow:hidden; text-overflow:ellipsis}
.top-sub{font-size:12.5px; opacity:.85; margin-top:3px}
.top-right{display:flex; flex-direction:column; align-items:flex-end; gap:6px}
.pill-btn{
  background:#fff; color:var(--brand-d); border:none; border-radius:20px;
  padding:7px 13px; font-size:12px; font-weight:800; cursor:pointer; white-space:nowrap;
}
.pill-btn:disabled{opacity:.6}
.conn{display:flex; align-items:center; gap:5px; font-size:11px;
      background:rgba(0,0,0,.2); padding:4px 9px; border-radius:20px; white-space:nowrap}
.conn .dot{width:8px;height:8px;border-radius:50%;background:#F1C40F}
.conn.ok .dot{background:#2ECC71} .conn.bad .dot{background:#E74C3C}

/* 6 ô trên một hàng: vừa là số liệu, vừa là bộ lọc. Ô cuối là nút Thiết lập. */
.stats{display:flex; gap:5px}
.stat{
  flex:1 1 0; min-width:0; background:rgba(255,255,255,.16); border-radius:10px;
  padding:8px 2px; text-align:center; border:none; color:#fff; font:inherit;
  cursor:pointer; position:relative;
}
.stat.on{background:rgba(255,255,255,.34)}
.stat b{display:block; font-size:18px; font-weight:800; line-height:1.15}
.stat span{font-size:9.5px; opacity:.92; display:block; overflow:hidden;
           text-overflow:ellipsis; white-space:nowrap}
/* Ô thứ 5: nút Thiết lập kiêm đèn báo trạng thái trạm */
.stat-set{flex:0 0 62px}
.stat-set b{font-size:18px}
.stat-set .dot{
  position:absolute; top:7px; right:7px; width:9px; height:9px; border-radius:50%;
  background:#F1C40F;
}
.stat-set.ok .dot{background:#2ECC71}
.stat-set.bad .dot{background:#E74C3C}

/* Nút tới cửa hàng: khác màu để không bấm nhầm với nút tới nhà khách. */
.qbtn.pick{background:var(--brand-l); color:var(--brand-d); font-weight:700}

/* Nút Nghỉ: đang nghỉ thì phải NHÌN LÀ BIẾT, vì lúc đó app im hoàn toàn —
   không có dấu hiệu rõ ràng thì tưởng app hỏng. */
.pill-btn.on{background:#F1C40F; color:#4A3A00}
.top-bar .pill-btn{font-size:13px; padding:0 12px}
.row .cnt.ok{background:var(--brand-l); color:var(--brand-d)}

/* Đơn chậm phải đập vào mắt: đây là thứ quyết định giao trước hay giao sau. */
.tag.cham{background:#FFE8CC; color:#8A4B00; font-weight:800}
.ord.cham{box-shadow:inset 3px 0 0 #E9A93B}

/* ---------- tuyến lưu sẵn ---------- */
.row.tuyen{align-items:center}
.row.tuyen.on{background:var(--brand-l); border-radius:10px}
.row.tuyen.on .lbl{color:var(--brand-d)}
.xoa-tuyen{
  flex:0 0 auto; width:34px; height:34px; border:0; border-radius:50%;
  background:transparent; color:var(--ink-3); font-size:22px; line-height:1;
  cursor:pointer; font-family:inherit;
}
.xoa-tuyen:active{background:#EEF3F6}

/* ---------- lộ trình ---------- */
.datebar .route-btn{
  flex:0 0 auto; height:34px; padding:0 15px; border:0; border-radius:9px;
  background:var(--brand); color:#fff; font-size:13px; font-weight:800;
  font-family:inherit; cursor:pointer;
}
.rt-sum{display:flex; justify-content:space-around; text-align:center; padding:16px 10px}
.rt-sum b{display:block; font-size:24px; font-weight:800; color:var(--ink)}
.rt-sum span{font-size:12px; color:var(--ink-3)}
.rt-hint{margin:0 4px 10px}
.rt-list{display:flex; flex-direction:column; gap:8px; margin-bottom:12px}
.rt-row{
  display:flex; align-items:center; gap:11px; background:var(--card);
  border-radius:13px; padding:12px 13px; text-decoration:none; color:var(--ink);
  border-left:4px solid var(--ink-3);
  /* Từ thẻ liên kết đổi sang nút -> phải dẹp mặc định của nút đi. */
  width:100%; border-top:0; border-right:0; border-bottom:0;
  font-family:inherit; font-size:14px; text-align:left; cursor:pointer;
}
.rt-row:active{background:#EEF3F6}
.rt-row.lay{border-left-color:var(--brand); background:var(--brand-l)}
/* Trả hộp: khác hẳn hai loại kia để không nhầm là một chặng giao. */
.rt-row.trahop{border-left-color:#7D5BA6; background:#F5F0FA}
.rt-row.trahop .rt-no{background:#7D5BA6}

.lienket{background:none; border:0; padding:0; color:var(--brand-d); font-weight:800;
         font-family:inherit; font-size:inherit; text-decoration:underline; cursor:pointer}
.rt-no{
  flex:0 0 26px; width:26px; height:26px; border-radius:50%; background:var(--ink);
  color:#fff; font-size:13px; font-weight:800; display:flex;
  align-items:center; justify-content:center;
}
.rt-row.lay .rt-no{background:var(--brand-d)}
.rt-main{flex:1 1 auto; min-width:0}
.rt-main b{display:block; font-size:15px; font-weight:800}
.rt-main small{display:block; font-size:12px; color:var(--ink-3);
               overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.rt-km{flex:0 0 auto; font-size:13px; font-weight:800; color:var(--ink-3)}
.rt-gio{font-weight:800; color:var(--ink-2)}
.rt-ma{color:var(--brand-d); font-weight:800}
/* Chặng lấy hàng có thêm dòng địa chỉ -> cho xuống dòng, không cắt cụt. */
.rt-row.lay .rt-main small{white-space:normal}
.rt-hen{color:var(--brand-d)}
.rt-tre{color:#A02419}
.rt-gap{color:#B26A00}
.rt-row.gap{border-left-color:#E9A93B; background:#FFFBF2}
.rt-row.tre{border-left-color:#A02419}
.rt-all{display:block; text-align:center; text-decoration:none; margin-top:10px}

/* ---------- chi tiết cửa hàng ---------- */
.shop-btn{
  width:100%; margin-top:14px; display:flex; align-items:center; justify-content:space-between;
  background:var(--brand-l); color:var(--brand-d); border:0; border-radius:12px;
  padding:14px 16px; font-size:14.5px; font-weight:800; font-family:inherit;
  min-height:var(--tap); cursor:pointer;
}
.shop-btn span{font-size:20px; line-height:1}
.shop-name{font-size:17px; font-weight:800; color:var(--ink)}
.shop-list{margin-top:14px; display:flex; flex-direction:column; gap:8px}
.shop-row{
  display:flex; align-items:center; gap:9px; width:100%; text-align:left;
  background:#F4F7F9; border:0; border-radius:12px; padding:12px 12px;
  font-family:inherit; font-size:14px; color:var(--ink); cursor:pointer;
  min-height:var(--tap);
}
.shop-row b{font-size:14px; font-weight:800; flex:0 0 auto}
.shop-row .sr-no{color:var(--ink-3); font-size:12.5px; flex:0 0 auto}
.shop-row .sr-nm{flex:1 1 auto; min-width:0; overflow:hidden;
                 text-overflow:ellipsis; white-space:nowrap}
.shop-row .status-chip{flex:0 0 auto}

/* ---------- thanh chọn ngày ---------- */
.datebar{
  display:flex; flex-direction:column; gap:7px; padding:7px 10px;
  background:var(--card); border-bottom:1px solid var(--line);
}
/* Hai hàng RÕ RÀNG thay vì để flex tự ngắt: tự ngắt thì mỗi màn một kiểu,
   và đã một lần làm tràn ngang cả trang. */
.db-row{display:flex; align-items:center; gap:7px}
.datebar .dnav{
  width:34px; height:34px; flex:0 0 34px; border:0; border-radius:9px;
  background:var(--bg); color:var(--ink); font-size:20px; line-height:1; cursor:pointer;
}
.datebar input[type=date]{
  flex:1 1 auto; min-width:0; height:34px; padding:0 8px;
  border:1px solid var(--line); border-radius:9px;
  background:var(--bg); color:var(--ink); font-size:14px; font-family:inherit;
}
.datebar .showdone{
  flex:1 1 auto; display:flex; align-items:center; gap:7px; min-width:0;
  font-size:13px; color:var(--ink-2);
}
.datebar .showdone input{width:17px; height:17px; accent-color:var(--brand)}
.datebar .dtoday{
  flex:0 0 auto; height:34px; padding:0 12px; border:0; border-radius:9px;
  background:var(--brand); color:#fff; font-size:13px; font-weight:700; cursor:pointer;
}

/* ---------- vuốt xuống để làm mới ---------- */
.ptr{
  height:0; overflow:hidden; display:flex; align-items:center; justify-content:center;
  font-size:12.5px; color:var(--ink-3); background:var(--bg);
  transition:height .18s ease;
}
.ptr.pull{height:46px}
.ptr.busy{height:46px; color:var(--brand-d); font-weight:700}

/* ---------- danh sách ---------- */
.list{flex:1; padding:12px 12px 20px}
.shop{margin-bottom:12px; background:var(--card); border-radius:14px; overflow:hidden;
      box-shadow:0 1px 4px rgba(20,35,45,.07)}
.shop>summary{
  list-style:none; cursor:pointer; padding:14px 15px; display:flex;
  align-items:center; gap:10px; font-weight:800; font-size:14px;
  background:#FBFDFE; border-bottom:1px solid var(--line);
}
.shop>summary::-webkit-details-marker{display:none}
.shop>summary .caret{transition:transform .2s; color:var(--ink-3); font-size:11px}
.shop[open]>summary .caret{transform:rotate(90deg)}
.shop-name{flex:1; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.shop-cnt{font-size:12px; font-weight:800; color:var(--brand);
          background:var(--brand-l); padding:3px 10px; border-radius:11px}
.shop.all-done .shop-cnt{color:var(--ink-3); background:#EEF2F4}

.ord{display:flex; gap:12px; align-items:stretch; padding:13px 15px;
     border-bottom:1px solid var(--line); cursor:pointer; background:#fff}
.ord:last-child{border-bottom:none}
.ord:active{background:#F0FBF8}
.ord-l{width:4px; border-radius:3px; flex:0 0 4px}
.ord-time{font-weight:800; font-size:13.5px; white-space:nowrap; width:44px; padding-top:1px}
.ord-mid{flex:1; min-width:0}
.ord-name{font-size:15.5px; font-weight:700; white-space:nowrap;
          overflow:hidden; text-overflow:ellipsis}
.ord-no{color:var(--ink-3); font-weight:600; font-size:13px; margin-right:7px}
.ord-addr{font-size:12.5px; color:var(--ink-2); overflow:hidden;
          text-overflow:ellipsis; white-space:nowrap; margin-top:3px}
.ord-tags{display:flex; gap:5px; margin-top:6px; flex-wrap:wrap}
.tag{font-size:10.5px; padding:2px 8px; border-radius:9px;
     background:#EEF2F4; color:var(--ink-2); font-weight:700}
.tag.note{background:#FFF3CD; color:#8A6100}
.tag.oki{background:#E7F0FD; color:#1B5FAE}
.tag.other{background:#EDE3F7; color:#5B3A87}
.ord-right{display:flex; flex-direction:column; align-items:flex-end;
           justify-content:space-between; gap:6px}
.status-chip{font-size:11px; font-weight:800; padding:4px 10px; border-radius:11px;
             white-space:nowrap; color:#fff}
.s-waiting{background:var(--wait)} .s-picked{background:var(--pick)}
.s-delivered{background:var(--done)} .s-absence{background:var(--prob)}
.s-re_absence{background:var(--prob)} .s-reserved{background:var(--hold)}
.s-returned{background:var(--ink-3)}
.ord-pkg{font-size:12px; color:var(--ink-3); font-weight:700}
.empty{text-align:center; color:var(--ink-3); padding:56px 24px; font-size:14px; line-height:1.6}

/* ---------- thẻ course ---------- */
.crs{
  background:var(--card); border-radius:14px; padding:14px 15px; margin-bottom:10px;
  box-shadow:0 1px 4px rgba(20,35,45,.07); display:flex; align-items:center; gap:12px;
}
.crs.on{outline:2px solid var(--brand)}
.crs-mid{flex:1; min-width:0}
.crs-name{font-size:15.5px; font-weight:800; overflow:hidden;
          text-overflow:ellipsis; white-space:nowrap}
.crs-bar{height:6px; background:#EEF2F4; border-radius:3px; margin-top:8px; overflow:hidden;
         display:flex}
.crs-bar i{display:block; height:100%}
.crs-nums{font-size:11.5px; color:var(--ink-2); margin-top:6px}
.crs-nums b{color:var(--ink)}
.sw{position:relative; width:50px; height:30px; flex:0 0 50px; cursor:pointer}
.sw input{opacity:0; width:100%; height:100%; margin:0; cursor:pointer}
.sw i{position:absolute; inset:0; background:#CFD8DD; border-radius:15px;
      transition:.2s; pointer-events:none}
.sw i::after{content:""; position:absolute; top:3px; left:3px; width:24px; height:24px;
             background:#fff; border-radius:50%; transition:.2s;
             box-shadow:0 1px 3px rgba(0,0,0,.3)}
.sw input:checked + i{background:var(--brand)}
.sw input:checked + i::after{transform:translateX(20px)}

/* ---------- cài đặt ---------- */
.card{background:var(--card); border-radius:14px; margin-bottom:12px; overflow:hidden;
      box-shadow:0 1px 4px rgba(20,35,45,.07)}
.card h3{margin:0; padding:14px 15px 10px; font-size:14px; font-weight:800}
.card .hint{padding:0 15px 12px; margin:0; font-size:12.5px; color:var(--ink-2); line-height:1.55}
.row{display:flex; align-items:center; gap:12px; padding:12px 15px;
     border-top:1px solid var(--line)}
.row .lbl{flex:1; min-width:0; font-size:14px; font-weight:600}
.row .lbl small{display:block; font-size:11.5px; color:var(--ink-3); font-weight:500; margin-top:2px}
.row select,.row input[type=time],.row input[type=date]{
  border:1px solid var(--line); border-radius:9px; padding:9px 11px; font-size:15px;
  background:#fff; color:var(--ink); min-height:42px;
}
.btn-row{display:flex; gap:8px; padding:10px 15px 14px}
.btn-sm{
  flex:1; border:1px solid var(--line); background:#fff; color:var(--ink);
  border-radius:10px; padding:11px 8px; font-size:13px; font-weight:700; cursor:pointer;
  min-height:44px;
}
.btn-sm.pri{background:var(--brand); border-color:var(--brand); color:#fff}
.btn-sm.danger{color:var(--prob); border-color:#F5C6C2}
.shoplist{max-height:320px; overflow:auto; border-top:1px solid var(--line)}
.shopitem{display:flex; align-items:center; gap:12px; padding:11px 15px;
          border-bottom:1px solid var(--line)}
.shopitem:last-child{border-bottom:none}
.shopitem .nm{flex:1; min-width:0; font-size:14px; overflow:hidden;
              text-overflow:ellipsis; white-space:nowrap}
.shopitem input{width:22px; height:22px; accent-color:var(--brand)}

/* ---------- mục ẩn/hiện trong Thiết lập ---------- */
.fold{background:var(--card); border-radius:14px; margin-bottom:12px; overflow:hidden;
      box-shadow:0 1px 4px rgba(20,35,45,.07)}
.fold>summary{
  list-style:none; cursor:pointer; padding:15px; display:flex; align-items:center;
  gap:10px; font-size:14.5px; font-weight:800;
}
.fold>summary::-webkit-details-marker{display:none}
.fold>summary .caret{margin-left:auto; color:var(--ink-3); font-size:12px;
                     transition:transform .2s}
.fold[open]>summary .caret{transform:rotate(90deg)}
.fold>summary .cnt{font-size:11.5px; font-weight:700; color:var(--brand);
                   background:var(--brand-l); padding:3px 9px; border-radius:11px}
.fold-body{border-top:1px solid var(--line)}

/* ---------- bottom sheet ---------- */
.sheet-wrap{position:fixed; inset:0; z-index:40}
.sheet-bg{position:absolute; inset:0; background:rgba(12,22,29,.5)}
.sheet{
  position:absolute; left:0; right:0; bottom:0; max-height:92vh;
  background:var(--card); border-radius:18px 18px 0 0;
  display:flex; flex-direction:column; animation:up .22s ease;
  padding-bottom:var(--safeb);
}
@keyframes up{from{transform:translateY(100%)}to{transform:none}}
.grabber{width:40px; height:4px; background:#D5DDE2; border-radius:2px;
         margin:9px auto 2px; flex:0 0 auto}
.sheet-head{display:flex; align-items:center; gap:10px; padding:8px 15px 12px;
            border-bottom:1px solid var(--line)}
.sheet-title{flex:1; display:flex; align-items:center; gap:10px; min-width:0}
.sheet-no{font-weight:800; font-size:17px}
.icon-btn{background:#EEF2F4; border:none; width:34px; height:34px; border-radius:50%;
          font-size:20px; color:var(--ink-2); cursor:pointer; flex:0 0 34px}
.sheet-body{padding:16px 15px; overflow:auto; flex:1}
.d-name{font-size:23px; font-weight:800; line-height:1.25}
.d-kana{font-size:12.5px; color:var(--ink-3); margin-top:3px}
.d-addr{font-size:17px; line-height:1.45; margin-top:14px; font-weight:600}
.d-zip{font-size:12.5px; color:var(--ink-3); margin-top:3px}
.d-quick{display:flex; flex-wrap:wrap; gap:10px; margin-top:15px}
.qbtn{flex:1 1 40%; min-width:92px; text-align:center; text-decoration:none; background:#EEF4F7; color:var(--ink);
      border-radius:12px; padding:14px 8px; font-weight:800; font-size:14.5px;
      min-height:var(--tap); display:flex; align-items:center; justify-content:center; gap:6px}
.qbtn:active{background:#E1EAEF}
.d-meta{display:flex; gap:8px; margin-top:18px; border-top:1px solid var(--line); padding-top:14px}
.d-meta>div{flex:1; min-width:0}
.d-label{font-size:10.5px; color:var(--ink-3); text-transform:uppercase;
         letter-spacing:.4px; font-weight:800}
.d-meta b{display:block; font-size:14.5px; margin-top:3px; overflow:hidden;
          text-overflow:ellipsis; white-space:nowrap}
.d-note{margin-top:14px; background:#FFF8E1; border-left:4px solid var(--wait);
        padding:12px 14px; border-radius:0 10px 10px 0; font-size:14.5px; line-height:1.55}
.d-times{margin-top:16px; font-size:12.5px; color:var(--ink-2); display:grid; gap:5px}

.actions{display:grid; grid-template-columns:repeat(3,1fr); gap:8px;
         padding:13px 15px; border-top:1px solid var(--line); background:#FAFCFD}
.act{border:none; border-radius:13px; padding:12px 4px; font-size:13px; font-weight:800;
     cursor:pointer; color:#fff; min-height:56px; line-height:1.2}
.act:disabled{opacity:.4}
.act small{display:block; font-size:10.5px; font-weight:700; opacity:.85; margin-top:2px}
.act-yellow{background:var(--wait)} .act-green{background:var(--done)}
.act-red{background:var(--prob)} .act-blue{background:var(--pick)}
.act-purple{background:var(--hold)} .act-gray{background:#7F8C8D}
.act-wide{grid-column:1 / -1}
.act-warn{background:#FDECEA; color:#A02419; padding:15px; border-radius:12px;
          font-size:14px; line-height:1.5; text-align:center; grid-column:1 / -1}

/* ---------- bảng kiểm ---------- */
.chk-intro{font-size:13px; color:var(--ink-2); margin:0 0 14px; line-height:1.55}
.chk{display:flex; gap:12px; align-items:flex-start; padding:13px 0;
     border-bottom:1px solid var(--line); cursor:pointer}
.chk input{width:26px; height:26px; flex:0 0 26px; margin:0; accent-color:var(--brand)}
.chk b,.chk-num b{display:block; font-size:14.5px; font-weight:700}
.chk i,.chk-num i{display:block; font-size:11.5px; color:var(--ink-3);
                  font-style:normal; margin-top:2px}
.chk-num{display:flex; gap:12px; align-items:center; padding:13px 0;
         border-bottom:1px solid var(--line)}
.chk-num>span{flex:1}
.chk-num input{width:100px; padding:12px; border:1px solid var(--line);
               border-radius:10px; font-size:16px; text-align:center}

/* ---------- báo động đơn mới ---------- */
.alarm{position:fixed; inset:0; z-index:90; background:linear-gradient(160deg,#E74C3C,#B93226);
       display:flex; align-items:center; justify-content:center; padding:24px; color:#fff}
.alarm[hidden]{display:none}
.alarm-inner{text-align:center; max-width:420px; width:100%}
.alarm-ring{font-size:76px; animation:shake .7s ease-in-out infinite}
@keyframes shake{
  0%,100%{transform:rotate(0)} 20%{transform:rotate(-16deg)}
  40%{transform:rotate(14deg)} 60%{transform:rotate(-9deg)} 80%{transform:rotate(6deg)}
}
.alarm h2{margin:14px 0 6px; font-size:32px; font-weight:900; letter-spacing:-.5px}
.alarm p{margin:0 0 30px; font-size:16.5px; opacity:.95; line-height:1.5}
.alarm-btn{width:100%; background:#fff; color:#B93226; border:none; border-radius:15px;
           padding:20px; font-size:18px; font-weight:900; cursor:pointer; min-height:64px}

/* ---------- cổng vào ---------- */
.gate{position:fixed; inset:0; z-index:100; background:var(--brand);
      display:flex; align-items:center; justify-content:center; padding:20px}
.gate[hidden]{display:none}
.gate-card{background:#fff; border-radius:18px; padding:30px 22px; width:100%;
           max-width:390px; box-shadow:0 12px 44px rgba(0,0,0,.25); text-align:center}
.gate-logo{width:70px; height:70px; border-radius:16px}
.gate-card h2{margin:15px 0 4px; font-size:21px; font-weight:800}
.gate-sub{margin:0 0 20px; font-size:13px; color:var(--ink-3)}
.gate-warn{background:#FFF3CD; color:#7A5600; font-size:12.5px; line-height:1.55;
           padding:11px 13px; border-radius:10px; margin:0 0 15px; text-align:left}
.gate-in{width:100%; padding:15px; margin-bottom:11px; font-size:16px;
         border:1px solid var(--line); border-radius:12px; min-height:var(--tap)}
.pw-wrap{position:relative}
.pw-wrap .gate-in{padding-right:52px}
.pw-eye{position:absolute; right:6px; top:4px; width:44px; height:46px; border:none;
        background:none; font-size:19px; cursor:pointer; opacity:.5; line-height:1}
.pw-eye.on{opacity:1}
.gate-remember{display:flex; align-items:center; gap:9px; font-size:13.5px;
               color:var(--ink-2); margin:2px 0 14px; cursor:pointer; text-align:left}
.gate-remember input{width:20px; height:20px; accent-color:var(--brand)}
.gate-btn{width:100%; padding:16px; background:var(--brand); color:#fff; border:none;
          border-radius:12px; font-size:16.5px; font-weight:800; cursor:pointer;
          min-height:var(--tap)}
.gate-btn:disabled{opacity:.5}
.gate-err{margin-top:13px; background:#FDECEA; color:#A02419; padding:11px 13px;
          border-radius:10px; font-size:13px; text-align:left; line-height:1.5}

/* ---------- toast ---------- */
.toast{position:fixed; left:50%; bottom:calc(var(--safeb) + 24px);
       transform:translate(-50%,20px); background:var(--ink); color:#fff;
       padding:13px 19px; border-radius:12px; font-size:14px; max-width:88vw; z-index:60;
       opacity:0; pointer-events:none; transition:.25s; text-align:center;
       box-shadow:0 6px 22px rgba(0,0,0,.3)}
.toast.show{opacity:1; transform:translate(-50%,0)}
.toast.err{background:var(--prob)} .toast.ok{background:var(--brand-d)}

@media (min-width:680px){
  .list,.top{max-width:720px; margin-left:auto; margin-right:auto; width:100%}
  .top{border-radius:0}
  .sheet{left:50%; transform:translateX(-50%); width:600px;
         border-radius:18px; bottom:14px; max-height:88vh}
  @keyframes up{from{transform:translate(-50%,100%)}to{transform:translateX(-50%)}}
}

/* ---------- AI đọc ghi chú ---------- */
.ord-ai{font-size:12.5px; color:var(--brand-d); margin-top:4px; font-weight:600;
        overflow:hidden; text-overflow:ellipsis; white-space:nowrap}
.tag.hot{background:#FDECEA; color:#A02419}
.tag.warn{background:#FFF3CD; color:#8A6100}
.ai-sum{font-size:15.5px; font-weight:700; line-height:1.45; color:var(--ink)}
.ai-chips{display:flex; flex-wrap:wrap; gap:6px; margin-top:9px}
.ai-chips span{font-size:12px; font-weight:700; background:#fff; color:var(--ink-2);
               border:1px solid var(--line); padding:5px 10px; border-radius:20px}
/* Nguyên văn tiếng Nhật để đối chiếu — bản dịch là do máy đọc, không phải chân lý. */
.ai-raw{margin-top:10px; padding-top:9px; border-top:1px dashed #E0D4A8;
        font-size:12.5px; color:var(--ink-2); line-height:1.5}

/* ---------- popup chọn khu vực / cửa hàng ---------- */
.pick-hint{margin:0; padding:0 15px 4px; font-size:12.5px; color:var(--ink-2); line-height:1.5}
.pick-list{flex:1; overflow:auto; border-top:1px solid var(--line); min-height:180px}
.pick-item{display:flex; align-items:center; gap:12px; padding:13px 15px;
           border-bottom:1px solid var(--line); cursor:pointer}
.pick-item:last-child{border-bottom:none}
.pick-item:active{background:#F0FBF8}
.pick-item .mid{flex:1; min-width:0}
.pick-item .nm{font-size:14.5px; font-weight:700; overflow:hidden;
               text-overflow:ellipsis; white-space:nowrap}
.pick-item .sub{font-size:11.5px; color:var(--ink-2); margin-top:3px}
.pick-item input{width:24px; height:24px; flex:0 0 24px; accent-color:var(--brand)}
/* dòng mở popup trong màn Thiết lập */
.row.tap{cursor:pointer}
.row.tap:active{background:#F0FBF8}
.row .go{color:var(--ink-3); font-size:18px}
.row .cnt{font-size:12px; font-weight:800; color:var(--brand);
          background:var(--brand-l); padding:4px 10px; border-radius:11px}

/* ---------- Ảnh ---------- */
.shop-btn .dem{
  margin-left:auto; margin-right:8px; font-size:13px; font-weight:700;
  color:var(--brand-d); background:var(--brand-l); border-radius:999px;
  padding:1px 9px;
}
.anh-khu{margin:14px 0 4px}
.anh-chup{display:block; width:100%; padding:13px; font-size:16px; font-weight:700;
  border:0; border-radius:12px; background:var(--pick); color:#fff}
.anh-chup:active{filter:brightness(.92)}
.anh-chup[disabled]{opacity:.5}
/* Dải ảnh vừa chụp: cuộn ngang chứ không xuống dòng — bảng kiểm đã dài rồi,
 * thêm một hàng ảnh nữa là nút Xác nhận trôi khỏi màn hình. */
.anh-dai{display:flex; gap:8px; overflow-x:auto; padding:10px 0 2px}
.anh-dai:empty{display:none}
.anh-dai img,.anh-luoi img{
  width:88px; height:88px; object-fit:cover; border-radius:10px;
  border:1px solid var(--line); background:#EEF4F7; flex:0 0 auto;
}
.anh-o{position:relative; flex:0 0 auto}
.anh-bo{
  position:absolute; top:-6px; right:-6px; width:24px; height:24px; border:0;
  border-radius:50%; background:var(--prob); color:#fff; font-size:15px;
  line-height:24px; padding:0;
}
.anh-luoi{display:flex; flex-wrap:wrap; gap:10px}
.anh-nhan{
  position:absolute; left:4px; bottom:4px; font-size:10px; font-weight:700;
  background:rgba(0,0,0,.62); color:#fff; border-radius:6px; padding:1px 6px;
}
.anh-to{
  position:fixed; inset:0; z-index:90; background:rgba(0,0,0,.9);
  display:flex; align-items:center; justify-content:center; padding:16px;
}
.anh-to img{max-width:100%; max-height:100%; border-radius:8px}

/* ---------- 店舗カルテ ---------- */
.karte{
  margin-top:14px; border:1px solid var(--line); border-radius:12px;
  background:#FFFDF4; overflow:hidden;
}
.karte-dau{
  padding:10px 13px; font-size:14px; font-weight:800; color:var(--ink);
  background:#FFF6D9; border-bottom:1px solid var(--line);
}
.karte-dau span{font-weight:600; font-size:12px; color:var(--ink-3); margin-left:6px}
.karte-nd{padding:11px 13px; font-size:13.5px; line-height:1.55; color:var(--ink)}
.karte-nd p{margin:0 0 7px; white-space:pre-wrap}
.karte-tep{
  display:flex; flex-wrap:wrap; gap:6px; padding:0 13px 12px;
}
.karte-tep span{
  font-size:12px; font-weight:700; background:#EEF4F7; color:var(--ink);
  border-radius:8px; padding:4px 9px;
}

/* ---------- chấm công ---------- */
.chambar{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  width:100%; border:0; border-left:4px solid var(--brand); font-family:inherit;
  padding:11px 15px; text-align:left; cursor:pointer; background:var(--brand-l);
}
.chambar b{font-size:14.5px; font-weight:800; color:var(--ink)}
.chambar span{font-size:12.5px; color:var(--ink-3); white-space:nowrap}
.chambar.chua{background:#FFF4E5; border-left-color:#E8912B}
.chambar.dang{background:#E7F5EC; border-left-color:#2FA25C}
.chambar.xong{background:#EEF4F7; border-left-color:#8AA2AD}

.cham-to{
  display:block; width:100%; margin-top:12px; padding:16px; border:0;
  border-radius:14px; font-family:inherit; font-size:17px; font-weight:800;
  color:#fff; cursor:pointer;
}
.cham-to.bat{background:#2FA25C}
.cham-to.het{background:#C6443C}
.cham-to.mo{background:#8AA2AD}
.cham-to:active{filter:brightness(.92)}
.cham-to[disabled]{opacity:.5}

.cham-o{display:flex; gap:8px; margin-top:12px}
.cham-o > div{
  flex:1 1 0; min-width:0; background:#F4F7F9; border-radius:10px;
  padding:9px 6px; text-align:center;
}
.cham-o span{display:block; font-size:11px; color:var(--ink-3)}
.cham-o b{display:block; font-size:17px; font-weight:800; margin-top:2px}

.kosu-row.on{background:var(--brand-l)}
.kosu-row input[type=checkbox]{width:22px; height:22px; flex:0 0 auto}

/* Bảng: 5 cột cố định, cuộn ngang khi hẹp chứ không ép chữ xuống dòng. */
.bang{overflow-x:auto}
.bang-h,.bang-r{
  display:grid; grid-template-columns:52px 1fr 48px 48px 44px;
  gap:6px; align-items:center; padding:8px 2px; min-width:300px;
}
.bang-h{font-size:11px; color:var(--ink-3); font-weight:700;
  border-bottom:1px solid var(--line)}
.bang-r{font-size:13px; border-bottom:1px solid #F0F3F5}
.bang-r.sua{background:#FFF8E1}
.bang-r span:last-child{text-align:right}
.bang-k{font-size:11.5px; color:var(--ink-3); padding:0 2px 8px;
  border-bottom:1px solid #F0F3F5}

.gate-link{
  display:block; width:100%; margin-top:12px; background:none; border:0;
  color:var(--brand-d); font-family:inherit; font-size:14px; font-weight:700;
  cursor:pointer; padding:8px;
}
.gate-note{font-size:12.5px; color:var(--ink-3); margin:4px 0 10px; line-height:1.5}
