@font-face { font-family: 'BVP'; src: url(assets/fonts/BeVietnamPro-Regular.ttf); font-weight: 400; font-display: swap; }
@font-face { font-family: 'BVP'; src: url(assets/fonts/BeVietnamPro-Medium.ttf); font-weight: 500; font-display: swap; }
@font-face { font-family: 'BVP'; src: url(assets/fonts/BeVietnamPro-SemiBold.ttf); font-weight: 600; font-display: swap; }
@font-face { font-family: 'BVP'; src: url(assets/fonts/BeVietnamPro-Bold.ttf); font-weight: 700; font-display: swap; }

:root {
  --cream: #FFF9F6;
  --pink: #F8E9EF;
  --pink-2: #F2D9E3;
  --plum: #843A58;
  --plum-d: #6C2D47;
  --green: #557D68;
  --ink: #29262C;
  --ink-2: #5E5862;
  --muted: #8C848F;
  --line: #EEE2E6;
  --card: #FFFFFF;
  --red: #B13A2E;
  --red-bg: #FBE4E2;
  --amber: #9A6212;
  --amber-bg: #FBEFD9;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(41, 38, 44, .05), 0 4px 16px rgba(132, 58, 88, .06);
  --side: 232px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: 'BVP', system-ui, -apple-system, sans-serif;
  background: var(--cream);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--plum); text-decoration: none; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 17px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- khung ---------- */
.app { min-height: 100vh; }
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side);
  background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 18px 12px; gap: 4px; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand .logo {
  width: 38px; height: 38px; border-radius: 11px; background: var(--plum); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 15px; overflow: hidden; flex: none;
}
.brand .logo img { width: 100%; height: 100%; object-fit: cover; }
.brand b { display: block; font-size: 15px; }
.brand span { font-size: 12px; color: var(--muted); }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 10px;
  color: var(--ink-2); font-weight: 500;
}
.nav a:hover { background: var(--cream); }
.nav a.on { background: var(--pink); color: var(--plum); font-weight: 600; }
.side .spacer { flex: 1; }
.side .new-btn { margin: 0 4px 14px; }

.main { margin-left: var(--side); padding: 24px 28px 60px; max-width: 1320px; }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .grow { flex: 1; min-width: 0; }
.page-head .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; margin-bottom: 6px; }

.tabbar { display: none; }

/* ---------- nút ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  padding: 9px 14px; border-radius: 10px; font-weight: 600; font-size: 14px;
  cursor: pointer; white-space: nowrap; min-height: 40px;
}
.btn:hover { border-color: var(--pink-2); background: var(--cream); }
.btn.primary { background: var(--plum); border-color: var(--plum); color: #fff; }
.btn.primary:hover { background: var(--plum-d); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.soft { background: var(--pink); border-color: var(--pink); color: var(--plum); }
.btn.danger { color: var(--red); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 6px 10px; min-height: 32px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { width: 40px; padding: 0; }

/* ---------- thẻ ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { flex: 1; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dash { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); align-items: start; }

.kpi { padding: 16px 18px; cursor: pointer; text-align: left; border: 1px solid var(--line); }
.kpi:hover { border-color: var(--pink-2); }
.kpi .label { color: var(--muted); font-size: 13px; font-weight: 500; display: flex; align-items: center; gap: 7px; }
.kpi .val { font-size: 28px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.kpi .val.money { font-size: 22px; }
.kpi .hint { font-size: 12px; color: var(--muted); margin-top: 2px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- nhãn trạng thái ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.4;
}
.st-nhap { background: #F1EEF0; color: #6D6670; }
.st-moi { background: #E8EEF7; color: #3E5C8A; }
.st-xac_nhan { background: var(--pink); color: var(--plum); }
.st-dang_cam { background: var(--amber-bg); color: var(--amber); }
.st-cho_giao { background: #E3F0EE; color: #2F6F66; }
.st-dang_giao { background: #E6EDFA; color: #345CA8; }
.st-da_giao { background: #E5EFE8; color: #3F6B52; }
.st-that_bai { background: var(--red-bg); color: var(--red); }
.st-huy { background: #EEEDEE; color: #807A82; text-decoration: line-through; }
.pay-chua { background: var(--red-bg); color: var(--red); }
.pay-coc { background: var(--amber-bg); color: var(--amber); }
.pay-du { background: #E5EFE8; color: #3F6B52; }
.pay-can_hoan { background: #EEE6F5; color: #6A3E8F; }
.pay-huy { background: #EEEDEE; color: #807A82; }
.badge.urgent { background: var(--red); color: #fff; }
.badge.outline { background: transparent; border: 1px solid var(--line); color: var(--ink-2); }

/* ---------- danh sách đơn ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.search { position: relative; flex: 1 1 260px; min-width: 200px; }
.search input { width: 100%; padding-left: 38px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 3px; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-weight: 600; font-size: 13px; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: var(--pink); color: var(--plum); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--card); padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink-2);
}
.chip.on { background: var(--plum); border-color: var(--plum); color: #fff; }
.chip:hover:not(.on) { border-color: var(--pink-2); }

.olist { display: flex; flex-direction: column; }
.orow {
  display: grid; grid-template-columns: 28px 52px minmax(0, 2.2fr) minmax(0, 1.4fr) minmax(0, 1.1fr) 120px; gap: 14px;
  align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.orow:last-child { border-bottom: 0; }
.orow:hover { background: #FFFCFB; }
.orow .t1 { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orow .t2 { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orow .when { font-weight: 600; font-variant-numeric: tabular-nums; }
.orow .badges { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.orow input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--plum); }
.thumb {
  width: 52px; height: 52px; border-radius: 10px; background: var(--pink); object-fit: cover; display: grid; place-items: center;
  color: var(--plum); flex: none; overflow: hidden;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.sm { width: 40px; height: 40px; border-radius: 8px; }
.late { color: var(--red); }
.bulk { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; align-items: center; padding: 10px 16px; background: var(--pink); border-radius: 12px; margin-bottom: 10px; }

/* ---------- kanban ---------- */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.kcol { background: #FBF3F0; border-radius: var(--radius); padding: 10px; min-height: 200px; border: 2px dashed transparent; }
.kcol.over { border-color: var(--plum); background: var(--pink); }
.kcol-head { display: flex; align-items: center; gap: 8px; padding: 4px 6px 10px; font-weight: 600; font-size: 14px; }
.kcol-head .n { margin-left: auto; color: var(--muted); font-weight: 500; }
.kcard { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow); }
.kcard.dragging { opacity: .4; }
.kcard .top { display: flex; gap: 10px; }
.kcard .t1 { font-weight: 600; font-size: 14px; }
.kcard .t2 { font-size: 12px; color: var(--muted); }
.kcard .meta { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; align-items: center; }
.kcard .next { margin-top: 8px; }

/* ---------- form ---------- */
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--ink-2); min-width: 0; }
label.f .opt { font-weight: 400; color: var(--muted); }
input[type=text], input[type=tel], input[type=date], input[type=time], input[type=number], input[type=password], input[type=search], input[type=url], select, textarea {
  width: 100%; border: 1px solid #E6D9DE; background: #fff; border-radius: 10px; padding: 9px 12px; font-size: 15px; min-height: 42px;
  outline: none; font-weight: 400; color: var(--ink);
}
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--plum); box-shadow: 0 0 0 3px rgba(132, 58, 88, .12); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 500; cursor: pointer; color: var(--ink); }
.check input { width: 18px; height: 18px; accent-color: var(--plum); }
.frow { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.fsec { margin-bottom: 14px; }
.fsec > .card-head .no { width: 26px; height: 26px; border-radius: 8px; background: var(--pink); color: var(--plum); display: grid; place-items: center; font-weight: 700; font-size: 12px; }
.fsec .body { padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; }
.more-toggle { align-self: flex-start; background: none; border: 0; color: var(--plum); font-weight: 600; font-size: 13px; cursor: pointer; padding: 2px 0; }
.form-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.sumbox { position: sticky; top: 16px; }
.sumbox .line { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; }
.sumbox .line.total { font-size: 18px; font-weight: 700; border-top: 1px solid var(--line); margin-top: 6px; padding-top: 10px; }
.sumbox .line.due { color: var(--red); font-weight: 700; }
.errs { background: var(--red-bg); color: var(--red); border-radius: 10px; padding: 10px 12px; font-size: 13px; }
.cust-hint { background: #F1F6F3; color: var(--green); border-radius: 10px; padding: 10px 12px; font-size: 13px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.imgs { display: flex; flex-wrap: wrap; gap: 8px; }
.imgs .im { position: relative; width: 84px; height: 84px; border-radius: 10px; overflow: hidden; background: var(--pink); }
.imgs .im img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
.imgs .im button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(41, 38, 44, .7); color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; }
.imgs .im button svg { width: 14px; height: 14px; }
.imgs .add { width: 84px; height: 84px; border-radius: 10px; border: 1.5px dashed var(--pink-2); display: grid; place-items: center; color: var(--plum); cursor: pointer; background: #fff; text-align: center; font-size: 12px; font-weight: 600; }
.imgs .add input { display: none; }
.tpl-pick { display: flex; gap: 12px; align-items: center; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: #fff; cursor: pointer; }
.tpl-pick .grow { flex: 1; min-width: 0; }

/* ---------- chi tiết đơn ---------- */
.steps { display: flex; gap: 0; margin: 4px 0 18px; overflow-x: auto; }
.step { flex: 1; min-width: 90px; text-align: center; position: relative; font-size: 12px; color: var(--muted); font-weight: 500; padding-top: 30px; }
.step::before { content: ''; position: absolute; top: 10px; left: 0; right: 0; height: 3px; background: var(--line); }
.step:first-child::before { left: 50%; }
.step:last-child::before { right: 50%; }
.step i { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); width: 19px; height: 19px; border-radius: 50%; background: #fff; border: 3px solid var(--line); z-index: 1; }
.step.done { color: var(--ink-2); }
.step.done::before, .step.done i { background: var(--plum); border-color: var(--plum); }
.step.cur { color: var(--plum); font-weight: 700; }
.step.cur i { border-color: var(--plum); background: #fff; box-shadow: 0 0 0 4px var(--pink); }
.step.cur::before { background: linear-gradient(90deg, var(--plum) 50%, var(--line) 50%); }
.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 8px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }
.card-msg { background: var(--cream); border: 1px dashed var(--pink-2); border-radius: 12px; padding: 14px; font-size: 15px; white-space: pre-wrap; font-style: italic; }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: grid; grid-template-columns: 112px 1fr; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.hist li:last-child { border-bottom: 0; }
.hist .at { color: var(--muted); font-variant-numeric: tabular-nums; }
.pays { width: 100%; border-collapse: collapse; font-size: 14px; }
.pays td { padding: 8px 4px; border-bottom: 1px solid var(--line); }
.pays td.r { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 12px; font-size: 14px; }
.alert.red { background: var(--red-bg); color: var(--red); }
.alert.amber { background: var(--amber-bg); color: var(--amber); }
.alert.info { background: var(--pink); color: var(--plum); }
.action-bar { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- tổng quan ---------- */
.alist { display: flex; flex-direction: column; }
.aitem { display: flex; gap: 12px; align-items: center; padding: 11px 18px; border-bottom: 1px solid var(--line); cursor: pointer; }
.aitem:last-child { border-bottom: 0; }
.aitem:hover { background: #FFFCFB; }
.aitem .lv { width: 4px; align-self: stretch; border-radius: 4px; flex: none; }
.lv-1 { background: var(--red); } .lv-2 { background: #D9952B; } .lv-3 { background: var(--pink-2); }
.aitem .grow { flex: 1; min-width: 0; }
.aitem .t1 { font-weight: 600; font-size: 14px; }
.aitem .t2 { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); font-size: 14px; }
.hours { display: flex; align-items: flex-end; gap: 4px; height: 120px; padding: 12px 18px 0; }
.hours .h { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 4px; cursor: pointer; }
.hours .bar { width: 100%; max-width: 22px; background: var(--plum); border-radius: 4px 4px 0 0; min-height: 0; }
.hours .bar.zero { background: var(--line); height: 2px !important; border-radius: 2px; }
.hours .n { font-size: 11px; font-weight: 600; color: var(--ink-2); }
.hours-axis { display: flex; gap: 4px; padding: 6px 18px 14px; }
.hours-axis span { flex: 1; text-align: center; font-size: 11px; color: var(--muted); }

/* ---------- lịch ---------- */
.slot-group { margin-bottom: 14px; }
.slot-group > h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 14px; color: var(--ink-2); }
.dcard { display: grid; grid-template-columns: 70px minmax(0, 1fr) 200px; gap: 12px; align-items: center; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; }
.dcard .time { font-weight: 700; font-variant-numeric: tabular-nums; }
.dcard .t1 { font-weight: 600; }
.dcard .t2 { font-size: 13px; color: var(--muted); }
.dcard.unassigned { border-left: 4px solid #D9952B; }
.week { display: grid; grid-template-columns: repeat(7, minmax(140px, 1fr)); gap: 8px; overflow-x: auto; }
.wday { background: var(--card); border: 1px solid var(--line); border-radius: 12px; min-height: 220px; }
.wday.today { border-color: var(--plum); box-shadow: 0 0 0 2px var(--pink); }
.wday-head { padding: 10px 12px; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 13px; display: flex; justify-content: space-between; cursor: pointer; }
.wday-item { padding: 7px 10px; border-bottom: 1px solid var(--line); font-size: 12px; cursor: pointer; }
.wday-item:hover { background: var(--cream); }
.wday-item b { font-variant-numeric: tabular-nums; }
.route { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }

/* ---------- mẫu hoa ---------- */
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.tcard { overflow: hidden; display: flex; flex-direction: column; }
.tcard .ph { aspect-ratio: 1; background: var(--pink); display: grid; place-items: center; color: var(--plum); cursor: pointer; }
.tcard .ph img { width: 100%; height: 100%; object-fit: cover; }
.tcard .bd { padding: 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.tcard .price { font-weight: 700; color: var(--plum); }
.tcard .acts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.tcard.off { opacity: .55; }

/* ---------- bảng ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td.r, .tbl th.r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #FFFCFB; }
.scroll-x { overflow-x: auto; }

/* ---------- báo cáo ---------- */
.chart { position: relative; padding: 8px 18px 14px; }
.chart svg { display: block; width: 100%; height: 220px; overflow: visible; }
.chart .tip {
  position: absolute; pointer-events: none; background: var(--ink); color: #fff; font-size: 12px; padding: 6px 9px; border-radius: 8px;
  white-space: nowrap; transform: translate(-50%, -100%); opacity: 0; transition: opacity .1s;
}
.hbar { display: grid; grid-template-columns: 110px minmax(0, 1fr) 120px; gap: 10px; align-items: center; padding: 6px 18px; font-size: 14px; }
.hbar .track { height: 10px; background: var(--cream); border-radius: 5px; overflow: hidden; }
.hbar .fill { height: 100%; background: var(--plum); border-radius: 0 5px 5px 0; }
.hbar .v { text-align: right; font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ink-2); }
.note { font-size: 12px; color: var(--muted); padding: 0 18px 14px; }

/* ---------- modal, toast ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(41, 38, 44, .45); z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--card); border-radius: 18px; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; box-shadow: 0 20px 60px rgba(0, 0, 0, .2); }
.modal.wide { width: min(900px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 1; }
.modal-head h2 { flex: 1; }
.modal-body { padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.modal-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 14px 18px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--card); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; z-index: 200; font-size: 14px; font-weight: 500; box-shadow: 0 8px 30px rgba(0, 0, 0, .2); max-width: calc(100vw - 32px); }
.toast.err { background: var(--red); }
.viewer { position: fixed; inset: 0; background: rgba(20, 18, 22, .92); z-index: 150; display: grid; place-items: center; padding: 16px; }
.viewer img { max-width: 100%; max-height: calc(100vh - 90px); border-radius: 10px; }
.viewer .acts { position: fixed; top: 14px; right: 14px; display: flex; gap: 8px; }

/* ---------- đăng nhập ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 20% 10%, var(--pink) 0, transparent 45%), var(--cream); }
.login .box { width: min(380px, 100%); padding: 32px 28px; text-align: center; }
.login .logo { width: 64px; height: 64px; margin: 0 auto 14px; border-radius: 18px; background: var(--plum); color: #fff; display: grid; place-items: center; font-size: 24px; font-weight: 700; }
.login form { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; text-align: left; }
.loading { padding: 60px; text-align: center; color: var(--muted); }

/* ---------- in ---------- */
.print-wrap { background: #EDE7E9; min-height: 100vh; padding: 20px; }
.print-bar { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; flex-wrap: wrap; }
.sheet { background: #fff; margin: 0 auto 20px; padding: 14mm; box-shadow: 0 4px 20px rgba(0, 0, 0, .12); color: #111; font-size: 13px; }
.sheet.a5 { width: 148mm; min-height: 210mm; }
.sheet.card6 { width: 148mm; height: 105mm; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; padding: 12mm 16mm; }
.sheet h1 { font-size: 20px; }
.sheet .ph-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #111; padding-bottom: 8px; margin-bottom: 10px; gap: 10px; }
.sheet .big { font-size: 26px; font-weight: 700; }
.sheet table { width: 100%; border-collapse: collapse; }
.sheet td { padding: 5px 0; vertical-align: top; border-bottom: 1px dotted #bbb; }
.sheet td:first-child { width: 34%; color: #555; }
.sheet .box { border: 1.5px solid #111; border-radius: 8px; padding: 8px 10px; margin-top: 10px; }
.sheet .ref { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.sheet .ref img { width: 42mm; height: 42mm; object-fit: cover; border-radius: 6px; border: 1px solid #ddd; }
.card6 .msg { font-size: 19px; line-height: 1.55; white-space: pre-wrap; font-style: italic; }
.card6 .from { margin-top: 10mm; font-size: 15px; font-weight: 600; }
@media print {
  @page { margin: 0; }
  body { background: #fff; }
  .print-bar, .no-print { display: none !important; }
  .print-wrap { padding: 0; background: #fff; }
  .sheet { box-shadow: none; margin: 0; page-break-after: always; }
}

/* ---------- điện thoại ---------- */
@media (max-width: 960px) {
  .dash, .form-wrap { grid-template-columns: minmax(0, 1fr); }
  .sumbox { position: static; }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .side { display: none; }
  .main { margin-left: 0; padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); }
  h1 { font-size: 20px; }
  .g2 { grid-template-columns: minmax(0, 1fr); }
  .kpi { padding: 12px 14px; }
  .kpi .val { font-size: 24px; }
  .kpi .val.money { font-size: 18px; }
  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--card);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 11px; color: var(--muted); padding: 4px 0; font-weight: 500; }
  .tabbar a.on { color: var(--plum); font-weight: 600; }
  .tabbar a svg.i { width: 22px; height: 22px; }
  .tabbar a.plus span.c { width: 46px; height: 46px; margin-top: -20px; border-radius: 50%; background: var(--plum); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 18px rgba(132, 58, 88, .35); }
  .tabbar a.plus { color: var(--plum); }
  .orow { grid-template-columns: 52px minmax(0, 1fr); gap: 4px 12px; padding: 12px 14px; }
  .orow > .cb { display: none; }
  .orow > .thumb { grid-row: span 3; align-self: start; }
  .orow > div { grid-column: 2; }
  .orow .badges { flex-direction: row; flex-wrap: wrap; }
  .dcard { grid-template-columns: 56px minmax(0, 1fr); }
  .dcard > .assign { grid-column: 1 / -1; }
  .kv { grid-template-columns: 100px minmax(0, 1fr); }
  .hist li { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .modal-bg { place-items: end center; padding: 0; }
  .modal { border-radius: 18px 18px 0 0; max-height: 92vh; }
  .hbar { grid-template-columns: 84px minmax(0, 1fr) 96px; padding: 6px 14px; }
  .page-head .btn.hide-m { display: none; }
  .tgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
  .sheet.a5, .sheet.card6 { width: 100%; }
}

/* =========================================================
   Trang trí & chuyển động
   ========================================================= */
body::before {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url(assets/img/pattern.jpg) center / 640px repeat; opacity: .35;
}
.side-deco { height: 170px; margin: 0 -12px -18px; background: url(assets/img/sprig.webp) center bottom / 190px no-repeat; opacity: .9; }

/* khung chào trang Tổng quan */
.hero-card {
  position: relative; overflow: hidden; min-height: 190px; display: flex; align-items: center;
  background: var(--pink) url(assets/img/dash_banner.jpg) right center / auto 100% no-repeat; border: 0;
}
.hero-card .hero-text { position: relative; padding: 24px 26px; max-width: 62%; display: flex; flex-direction: column; gap: 8px; }
.hero-card .sub { color: var(--plum); font-weight: 600; font-size: 13px; letter-spacing: .02em; text-transform: uppercase; }
.hero-card h1 { font-size: 26px; }
.hero-card p { margin: 0; color: var(--ink-2); }
.hero-card .action-bar { margin-top: 6px; }

/* đăng nhập */
.login { position: relative; overflow: hidden; }
.login-art { position: absolute; right: max(-60px, calc(50% - 760px)); bottom: -20px; width: min(620px, 55vw); aspect-ratio: 3 / 4;
  background: url(assets/img/login_hero.jpg) center / contain no-repeat; mix-blend-mode: multiply; animation: floaty 9s ease-in-out infinite; }
.login .box { position: relative; z-index: 2; animation: popIn .6s cubic-bezier(.2, .8, .2, 1.1) both; backdrop-filter: blur(6px); background: rgba(255, 255, 255, .88); }
.login .logo { animation: bloom 1s .15s cubic-bezier(.2, .8, .2, 1.2) both; box-shadow: 0 10px 30px rgba(132, 58, 88, .3); }
.petals { position: absolute; inset: 0; pointer-events: none; z-index: 1; }
.petals i {
  position: absolute; top: -40px; left: calc(var(--i) * 8.3% + 2%); width: 14px; height: 18px;
  background: radial-gradient(circle at 30% 30%, #F6CADB, #D98AA9 70%); border-radius: 80% 0 80% 0; opacity: .75;
  animation: fall calc(9s + var(--i) * .7s) linear calc(var(--i) * -1.3s) infinite;
}
.petals i:nth-child(3n) { background: radial-gradient(circle at 30% 30%, #B86A8A, #843A58 75%); width: 11px; height: 14px; }
.petals i:nth-child(4n) { background: radial-gradient(circle at 30% 30%, #A9C7B5, #557D68 75%); border-radius: 0 90% 0 90%; width: 10px; height: 16px; }
@keyframes fall {
  0% { transform: translate3d(0, -5vh, 0) rotate(0deg); }
  50% { transform: translate3d(40px, 50vh, 0) rotate(200deg); }
  100% { transform: translate3d(-20px, 110vh, 0) rotate(420deg); }
}
@keyframes floaty { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-14px) rotate(-1.2deg); } }
@keyframes popIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes bloom { from { opacity: 0; transform: scale(.4) rotate(-25deg); } to { opacity: 1; transform: none; } }
.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

/* trạng thái trống */
.empty-art { padding: 26px 18px 24px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-art .art { width: 130px; height: 130px; background: url(assets/img/empty.jpg) center / contain no-repeat; mix-blend-mode: multiply; animation: floaty 6s ease-in-out infinite; }
.empty-art p { margin: 0; font-size: 14px; }

/* trang vào: trồi nhẹ, các thẻ lần lượt */
.view-in { animation: viewIn .35s ease-out both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .5s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* skeleton khi tải */
.skeleton { display: flex; flex-direction: column; gap: 14px; }
.skeleton .sk-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.sk { height: 92px; border-radius: var(--radius); background: linear-gradient(90deg, #F6ECEF 25%, #FBF5F7 50%, #F6ECEF 75%) 0 0 / 200% 100%; animation: shimmer 1.2s linear infinite; }
.sk.h { height: 150px; } .sk.big { height: 260px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* tương tác */
.btn { transition: background .15s, border-color .15s, transform .12s, box-shadow .15s; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary:hover { box-shadow: 0 6px 18px rgba(132, 58, 88, .28); }
.kpi, .tcard, .more-item { transition: transform .18s, box-shadow .18s, border-color .18s; }
.kpi:hover, .more-item:hover { transform: translateY(-2px); box-shadow: 0 10px 26px rgba(132, 58, 88, .12); }
.tcard .ph { overflow: hidden; }
.tcard .ph img { transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.tcard:hover { transform: translateY(-3px); box-shadow: 0 12px 30px rgba(132, 58, 88, .14); }
.tcard:hover .ph img { transform: scale(1.06); }
.orow, .aitem { transition: background .15s; }
.kcard { transition: transform .15s, box-shadow .15s, opacity .15s; }
.kcard:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(132, 58, 88, .12); }
.chip { transition: background .15s, color .15s, border-color .15s, transform .12s; }
.chip:active { transform: scale(.95); }
.hours .bar { transform-origin: bottom; animation: grow .6s cubic-bezier(.2, .7, .2, 1) both; }
.hours .h:nth-child(odd) .bar { animation-delay: .08s; }
@keyframes grow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.bar-r { transition: opacity .12s; transform-origin: bottom; transform-box: fill-box; animation: grow .7s cubic-bezier(.2, .7, .2, 1) both; }
.hbar .fill { animation: fillIn .8s cubic-bezier(.2, .7, .2, 1) both; transform-origin: left; }
@keyframes fillIn { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.chart .tip { transition: opacity .12s, left .08s, top .08s; }
.step i { transition: background .3s, border-color .3s; }
.step.cur i { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 4px var(--pink); } 50% { box-shadow: 0 0 0 8px rgba(248, 233, 239, .6); } }
.badge.urgent { animation: urgent 1.6s ease-in-out infinite; }
@keyframes urgent { 50% { box-shadow: 0 0 0 4px rgba(177, 58, 46, .18); } }
.lv-1 { animation: blink 1.8s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .45; } }

/* toast, modal */
.toast { display: flex; align-items: center; gap: 8px; animation: toastIn .3s cubic-bezier(.2, .8, .2, 1.2) both; }
.toast.out { animation: toastOut .25s ease-in both; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 16px) scale(.96); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toastOut { to { opacity: 0; transform: translate(-50%, 10px); } }
.modal-bg { animation: fadeIn .18s ease-out both; }
.modal-bg .modal { animation: popIn .25s cubic-bezier(.2, .8, .2, 1.05) both; }
.modal-bg.out { animation: fadeOut .18s ease-in both; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
.viewer { animation: fadeIn .2s both; }
.viewer img { animation: popIn .3s cubic-bezier(.2, .8, .2, 1) both; }
@media (max-width: 760px) {
  .modal-bg .modal { animation: sheetUp .3s cubic-bezier(.2, .8, .2, 1) both; }
  @keyframes sheetUp { from { transform: translateY(40px); opacity: .4; } to { transform: none; opacity: 1; } }
}

/* chi tiết nhỏ */
.more-item { display: flex; align-items: center; gap: 14px; color: var(--ink); }
.more-item > div { flex: 1; }
.more-item .mi { width: 46px; height: 46px; border-radius: 14px; background: var(--pink); color: var(--plum); display: grid; place-items: center; }
.sum-top { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.sum-top img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; }
.imgs .add.busy { opacity: .6; pointer-events: none; animation: blink 1s infinite; }
.payform { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); }
.is-pickup .pickup-hide { display: none !important; }
.phrases summary { list-style: none; }
.phrases summary::-webkit-details-marker { display: none; }
.orow .late, .kcard .late { color: var(--red); }

@media (max-width: 760px) {
  .hero-card { background-size: auto 70%; background-position: right bottom; min-height: 0; }
  .hero-card .hero-text { max-width: 100%; padding: 18px 16px 90px; }
  .hero-card h1 { font-size: 22px; }
  .login-art { width: 90vw; right: -20vw; bottom: -40px; opacity: .55; }
  .skeleton .sk-row { grid-template-columns: repeat(2, 1fr); }
  .hide-s { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; transition: none !important; }
  .petals { display: none; }
}

/* ---------- sửa sau lần soát ảnh 1 ---------- */
.search input[type=search] { padding-left: 38px; }
@media (max-width: 760px) {
  .orow > div:not(.thumb) { grid-column: 2; }
  .orow > .thumb { grid-column: 1; grid-row: 1 / span 4; }
  .hero-card { background: linear-gradient(90deg, var(--pink) 30%, rgba(248, 233, 239, .55) 70%, rgba(248, 233, 239, .15)), url(assets/img/dash_banner.jpg) 78% center / auto 100% no-repeat, var(--pink); }
  .hero-card .hero-text { padding: 18px 16px; }
  .page-head > .grow { flex-basis: 100%; }
  .card-head { flex-wrap: wrap; }
}
.grid:not(.g2):not(.g3):not(.g4):not(.dash) { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 760px) {
  .hero-card { background: linear-gradient(90deg, var(--pink) 48%, rgba(248, 233, 239, .78) 72%, rgba(248, 233, 239, .3)), url(assets/img/dash_banner.jpg) 78% center / auto 100% no-repeat, var(--pink); }
}

/* logo Hoa Lá */
.brand.has-logo { flex-direction: column; align-items: flex-start; gap: 2px; padding: 0 8px 16px; }
.brand.has-logo img { width: 176px; height: auto; display: block; }
.brand.has-logo span { font-size: 11px; color: var(--muted); padding-left: 6px; letter-spacing: .02em; }
.login-logo { display: block; width: 230px; max-width: 80%; margin: 0 auto 10px; animation: bloom 1s .15s cubic-bezier(.2, .8, .2, 1.2) both; }
.login .box h1 { font-size: 18px; color: var(--ink-2); }
.sheet .shop-logo { height: 15mm; width: auto; display: block; margin-bottom: 2px; }
.hero-logo { display: none; }
@media (max-width: 760px) { .hero-logo { display: block; width: 130px; height: auto; margin: -4px 0 2px -4px; } }

/* hình thức giao + QR */
.mode-seg { flex-wrap: wrap; align-self: flex-start; }
.mode-seg button { padding: 8px 14px; font-size: 14px; }
.mode-1 .addr-wrap, .mode-1 .ship-wrap, .mode-2 .ship-wrap { display: none !important; }
.sheet .pay-qr { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet .pay-qr img { width: 34mm; height: auto; flex: none; }
div.f { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); min-width: 0; }
div.f .opt { font-weight: 400; color: var(--muted); }
/* thu hộ nổi bật trên phiếu */
.sheet .box.due { border: 2.5px solid #D7261E; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sheet .thuho { color: #D7261E; font-size: 24px; font-weight: 800; letter-spacing: .01em; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.sheet .thuho-lb { font-size: 12px; color: #D7261E; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
