/* DHT Smart Farm — giao diện */
:root {
  --bg: #f4f7f2; --surface: #ffffff; --surface-2: #eef3ec; --border: #dbe4d8;
  --text: #1c2a21; --muted: #5d6f63; --primary: #1f6f43; --primary-2: #2e8b57; --on-primary: #fff;
  --ok: #2e8b57; --warn: #c98a00; --bad: #c0392b; --info: #2a6fb0;
  --ok-bg: #e5f4ea; --warn-bg: #fdf3d8; --bad-bg: #fbe4e1; --info-bg: #e3eef9;
  --c-poultry: #d9822b; --c-mushroom: #8a6d5a; --c-veg: #3a9d5d; --c-herb: #6f8f2f;
  --c-vs: #5b8def; --c-tv: #d35d6e; --c-dd: #3aa17e; --c-bv: #b7791f; --c-kt: #7a6fd0; --c-mt: #2b9cb0; --c-th: #c05621;
  --chart-1: #2e8b57; --chart-2: #2a6fb0; --chart-3: #d9822b; --chart-4: #8e5ea2; --chart-band: rgba(46,139,87,.12);
  --shadow: 0 1px 2px rgba(20,40,25,.06), 0 4px 14px rgba(20,40,25,.06);
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1612; --surface: #16201a; --surface-2: #1c2921; --border: #2a3a30;
    --text: #e3eee6; --muted: #93a89a; --primary: #4cbf7c; --primary-2: #5fd08e; --on-primary: #0b1a10;
    --ok: #5fd08e; --warn: #f0b93a; --bad: #f07565; --info: #6fb0f0;
    --ok-bg: #173323; --warn-bg: #3a2f12; --bad-bg: #3d1d1a; --info-bg: #15293d;
    --chart-1: #5fd08e; --chart-2: #6fb0f0; --chart-3: #f0a45a; --chart-4: #c49ad6; --chart-band: rgba(95,208,142,.13);
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1612; --surface: #16201a; --surface-2: #1c2921; --border: #2a3a30;
  --text: #e3eee6; --muted: #93a89a; --primary: #4cbf7c; --primary-2: #5fd08e; --on-primary: #0b1a10;
  --ok: #5fd08e; --warn: #f0b93a; --bad: #f07565; --info: #6fb0f0;
  --ok-bg: #173323; --warn-bg: #3a2f12; --bad-bg: #3d1d1a; --info-bg: #15293d;
  --chart-1: #5fd08e; --chart-2: #6fb0f0; --chart-3: #f0a45a; --chart-4: #c49ad6; --chart-band: rgba(95,208,142,.13);
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.25);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Be Vietnam Pro", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
small, .muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }

/* Layout */
.app { display: flex; min-height: 100vh; }
.side { width: 250px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { display: flex; gap: 10px; align-items: center; padding: 16px; border-bottom: 1px solid var(--border); }
.brand b { display: block; }
.brand small { display: block; font-size: 12px; max-width: 170px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
nav { padding: 8px; flex: 1; }
nav .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 12px 10px 4px; }
nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
nav a:hover { background: var(--surface-2); }
nav a.on { background: var(--primary); color: var(--on-primary); }
nav a .badge { margin-left: auto; }
.side-foot { font-size: 11px; color: var(--muted); padding: 12px 16px; border-top: 1px solid var(--border); }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 5; }
.top h1 { font-size: 1.15rem; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 8px; align-items: center; }
#view { padding: 20px 24px 60px; outline: none; }
.only-mobile { display: none; }
.scrim { display: none; }

/* Controls */
.icon-btn { border: 1px solid var(--border); background: var(--surface); color: var(--text); width: 36px; height: 36px; border-radius: 8px; cursor: pointer; font-size: 16px; }
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--surface); color: var(--text); padding: 7px 12px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 14px; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.pri { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.pri:hover { filter: brightness(1.06); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 4px 8px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; width: 100%; }
textarea { min-height: 70px; resize: vertical; }
input[type=checkbox] { width: auto; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
label.f .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.sim { display: flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; border: 1px solid var(--border); padding: 6px 10px; border-radius: 20px; user-select: none; }
.sim input { display: none; }
.sim .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.sim input:checked + .dot { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg); animation: pulse 1.6s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px transparent; } }

/* Cards & grids */
.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)); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; margin-bottom: 12px; flex-wrap: wrap; }
.sec { margin-top: 20px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .grow { flex: 1; }
.toolbar select, .toolbar input { width: auto; min-width: 160px; }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi .v { font-size: 1.6rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: 13px; color: var(--muted); }
.kpi .s { font-size: 12px; }

/* Badges & status */
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 20px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.b-ok { background: var(--ok-bg); color: var(--ok); }
.b-warn { background: var(--warn-bg); color: var(--warn); }
.b-bad { background: var(--bad-bg); color: var(--bad); }
.b-info { background: var(--info-bg); color: var(--info); }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 1px 8px; border-radius: 6px; border: 1px solid var(--border); white-space: nowrap; }
.tag i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.t-ok { color: var(--ok); } .t-warn { color: var(--warn); } .t-bad { color: var(--bad); }

.alert { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; margin-bottom: 8px; align-items: flex-start; font-size: 14px; }
.alert.bad { background: var(--bad-bg); } .alert.warn { background: var(--warn-bg); } .alert.info { background: var(--info-bg); } .alert.ok { background: var(--ok-bg); }
.alert .ic { flex-shrink: 0; }
.alert .grow { flex: 1; min-width: 0; }

/* Tables */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
td.r, th.r { text-align: right; }
tr:hover td { background: var(--surface-2); }
td .acts { display: flex; gap: 4px; justify-content: flex-end; }
.empty { text-align: center; color: var(--muted); padding: 24px; }

/* Batch cards */
.batch { display: flex; flex-direction: column; gap: 8px; cursor: pointer; text-decoration: none; color: inherit; }
.batch:hover { border-color: var(--primary); }
.batch .t { display: flex; gap: 8px; align-items: center; }
.batch .ico { font-size: 22px; }
.prog { height: 8px; background: var(--surface-2); border-radius: 8px; overflow: hidden; }
.prog > i { display: block; height: 100%; background: var(--primary-2); border-radius: 8px; }
.envchips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); font-variant-numeric: tabular-nums; }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.ok { background: var(--ok-bg); color: var(--ok); }

/* Tasks */
.task { display: flex; gap: 10px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--border); }
.task:last-child { border-bottom: 0; }
.task input { margin-top: 4px; width: 18px; height: 18px; accent-color: var(--primary); flex-shrink: 0; }
.task .grow { flex: 1; min-width: 0; }
.task.done .tt { text-decoration: line-through; color: var(--muted); }
.task .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; font-size: 12px; color: var(--muted); }
.day-h { font-weight: 600; margin: 16px 0 4px; display: flex; gap: 8px; align-items: center; }
.day-h:first-child { margin-top: 0; }

/* Timeline of stages */
.stages { display: flex; gap: 4px; margin: 8px 0; }
.stages > div { flex: 1; padding: 6px 8px; border-radius: 8px; background: var(--surface-2); font-size: 12px; min-width: 0; }
.stages > div.cur { background: var(--primary); color: var(--on-primary); }
.stages > div b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Sensors */
.sensor { text-align: left; }
.sensor .v { font-size: 1.5rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.sensor.bad { border-color: var(--bad); background: var(--bad-bg); }
.sensor.ok { border-color: var(--ok); }
.device { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }
.device .ic { font-size: 22px; }
.device .grow { flex: 1; min-width: 0; }
.device.on { border-color: var(--primary); background: var(--ok-bg); }
.switch { display: inline-block; position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--border); border-radius: 20px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::before { transform: translateX(18px); }
.log { font-size: 13px; max-height: 260px; overflow-y: auto; }
.log div { padding: 4px 0; border-bottom: 1px dashed var(--border); }

/* Charts */
.chart svg { width: 100%; height: auto; display: block; }
.chart .ax { stroke: var(--border); }
.chart text { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }

/* Tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 8px 12px; font: inherit; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--primary); border-color: var(--primary); font-weight: 600; }

/* Modal & toasts */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 50; overflow-y: auto; }
.modal[hidden] { display: none; }
.modal-box { background: var(--surface); border-radius: 14px; width: 100%; max-width: 720px; padding: 18px 20px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.toasts { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--text); color: var(--bg); padding: 10px 14px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); max-width: 340px; animation: tin .2s; }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }

/* Knowledge & advisor */
.sop-h { display: flex; gap: 10px; align-items: center; }
.sop-h .ico { font-size: 28px; }
ul.clean { margin: 0; padding-left: 18px; }
ul.clean li { margin: 3px 0; }
.symp { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.symp input { margin-top: 4px; accent-color: var(--primary); }

/* Trace label (in ấn) */
.label-print { border: 2px dashed var(--border); border-radius: 12px; padding: 16px; max-width: 420px; }
.label-print .code { font: 700 1.3rem ui-monospace, monospace; letter-spacing: .05em; }
.barcode { display: flex; height: 48px; gap: 0; margin: 10px 0; }
.barcode i { display: block; height: 100%; background: var(--text); }
.barcode b { display: block; height: 100%; }
@media print {
  .side, .top, .no-print, .toasts { display: none !important; }
  #view { padding: 0; }
  .card { box-shadow: none; }
}

/* Responsive */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 800px) {
  .side { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 30; }
  .only-mobile { display: inline-block; }
  .top { padding: 10px 16px; }
  #view { padding: 16px 16px 60px; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .sim .lbl { display: none; }
  .stages { flex-direction: column; }
  .toolbar select, .toolbar input { min-width: 0; flex: 1; }
}
@media (max-width: 480px) { .g4 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; } .kpi .v { font-size: 1.3rem; } }

/* ===== Phân hệ: bộ chuyển module ===== */
.mods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px 0 8px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
nav a.mod { flex-direction: column; gap: 2px; padding: 6px 2px; text-align: center; border-radius: 10px; font-size: 18px; line-height: 1.1; }
nav a.mod small { font-size: 10px; color: inherit; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
nav a.mod.on { background: var(--primary); color: var(--on-primary); }

/* ===== Cho thuê: bản đồ lô ===== */
.plots { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
.plot { display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; min-height: 86px; }
.plot:hover { border-color: var(--primary); }
.plot small { color: var(--muted); }
.plot.free { background: var(--ok-bg); border-color: var(--ok); }
.plot.rented { background: var(--info-bg); border-color: var(--info); }
.plot.maint { background: var(--warn-bg); border-color: var(--warn); }
.legend i.lg { border: 1px solid; }
.legend i.lg.free { background: var(--ok-bg); border-color: var(--ok); }
.legend i.lg.rented { background: var(--info-bg); border-color: var(--info); }
.legend i.lg.maint { background: var(--warn-bg); border-color: var(--warn); }
.plan { display: flex; flex-direction: column; gap: 6px; }
.plan .btn { align-self: flex-start; margin-top: auto; }
.price { font-size: 1.25rem; font-weight: 700; color: var(--primary); font-variant-numeric: tabular-nums; }
.price small { font-size: 12px; font-weight: 400; color: var(--muted); }

/* ===== Cổng khách thuê ===== */
.hero-cust { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: center; background: linear-gradient(135deg, var(--ok-bg), var(--surface)); }
.hero-stats { display: flex; gap: 20px; flex-wrap: wrap; }
.hero-stats div { display: flex; flex-direction: column; min-width: 90px; }
.hero-stats b { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.hero-stats small { color: var(--muted); font-size: 12px; }
h4 { margin: 12px 0 6px; font-size: 14px; }

/* ===== Chợ nông trại ===== */
.shop-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; }
.shop { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.prod { display: flex; gap: 12px; }
.prod .pic { font-size: 36px; width: 56px; height: 56px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; flex-shrink: 0; }
.prod .grow { flex: 1; min-width: 0; }
.prod .tag { text-decoration: none; color: var(--muted); }
.cart { position: sticky; top: 76px; }
.cart .qty { display: flex; align-items: center; gap: 6px; }

/* ===== Thông tin chung ===== */
.hero-farm { display: flex; gap: 16px; background: linear-gradient(135deg, var(--ok-bg), var(--surface) 70%); }
.hero-farm h2 { font-size: 1.5rem; margin: 4px 0; }
.hero-farm .slogan { font-style: italic; color: var(--primary); margin: 0 0 8px; }
.facts { display: flex; gap: 8px 18px; flex-wrap: wrap; font-size: 14px; color: var(--muted); }
details.faq { border-bottom: 1px solid var(--border); padding: 8px 0; }
details.faq summary { cursor: pointer; font-weight: 600; }
details.faq p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.event { display: flex; gap: 14px; }
.event .date { width: 56px; height: 60px; border-radius: 10px; background: var(--primary); color: var(--on-primary); display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; }
.event .date b { font-size: 1.4rem; line-height: 1; }
.event .grow { flex: 1; min-width: 0; }

/* ===== Hợp tác ===== */
table.gantt td, table.gantt th { padding: 6px 4px; text-align: center; }
table.gantt td:first-child, table.gantt th:first-child { text-align: left; white-space: nowrap; }
table.gantt td.busy { background: var(--info-bg); color: var(--info); }
.reply { margin-top: 8px; padding: 8px 12px; border-left: 3px solid var(--primary); background: var(--surface-2); border-radius: 0 8px 8px 0; font-size: 14px; }

@media (max-width: 1000px) { .shop-wrap { grid-template-columns: minmax(0, 1fr); } .cart { position: static; order: -1; } }
@media (max-width: 800px) { .hero-farm { flex-direction: column; } }

/* ===== Hợp đồng thuê: bước, chọn gói, nhận diện, thanh toán ===== */
h4.step { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 15px; }
h4.step span { width: 24px; height: 24px; border-radius: 50%; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-size: 13px; }
.flabel { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.picks { display: grid; gap: 8px; }
.picks.cards { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.picks.swatch { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.picks.iconpick { grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); }
.pick { position: relative; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; cursor: pointer; background: var(--surface); font-size: 13px; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick:hover { border-color: var(--primary-2); }
.pick.on { border: 2px solid var(--primary); background: var(--ok-bg); padding: 7px 9px; }
.pick:has(input:focus-visible) { outline: 2px solid var(--primary); }
.pick .pi { font-size: 22px; }
.pick small { color: var(--muted); }
.picks.swatch .pick { align-items: center; }
.picks.swatch i { width: 26px; height: 26px; border-radius: 50%; display: block; }
.picks.iconpick .pick { align-items: center; font-size: 20px; padding: 6px; }
.stepper { display: inline-flex; gap: 4px; margin-right: 6px; }
.terms { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; font-size: 13px; background: var(--surface-2); margin-bottom: 8px; }
.terms ol { padding-left: 18px; margin: 6px 0 0; }
.terms li { margin: 3px 0; }
.sign { --sc: #2e8b57; display: flex; align-items: stretch; gap: 10px; border-radius: 12px; border: 3px solid var(--sc); background: var(--surface); overflow: hidden; max-width: 420px; }
.sign-body { flex: 1; padding: 10px 12px; border-left: 10px solid var(--sc); min-width: 0; }
.sign-top { font-size: 11px; letter-spacing: .08em; color: var(--muted); font-weight: 700; }
.sign-name { font-size: 1.2rem; font-weight: 700; color: var(--sc); margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sign-foot { font-size: 12px; color: var(--muted); }
.sign-qr { padding: 6px; display: flex; align-items: center; }
.sign-wrap { margin: 4px 0 12px; }
.paytbl { width: 100%; margin: 8px 0; font-size: 14px; }
.paytbl td { padding: 6px 8px; }
.paytbl tr.tot td { font-weight: 700; font-size: 1.05rem; border-top: 2px solid var(--text); border-bottom: 0; }
.paybox .payqr, .payqr { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 10px 0; }
.qr { border-radius: 8px; border: 1px solid var(--border); background: #fff; max-width: 100%; height: auto; }
table.kv td { padding: 3px 8px 3px 0; border: 0; font-size: 14px; }
table.kv td:first-child { color: var(--muted); white-space: nowrap; }
.cred { border: 2px dashed var(--primary); border-radius: 12px; padding: 12px; margin: 10px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: var(--ok-bg); }
.cred small { display: block; color: var(--muted); font-size: 12px; }
.cred b { font-size: 1.05rem; }
.cred .code { font-family: ui-monospace, monospace; font-size: 1.3rem; letter-spacing: .08em; }
.cred p { grid-column: 1 / -1; margin: 0; font-size: 13px; }
.verify { border-top: 1px solid var(--border); padding-top: 10px; margin-top: 8px; }
i.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; }
.doc { font-size: 14px; line-height: 1.6; }
.doc-h { text-align: center; margin-bottom: 10px; }
.doc-h h3 { margin: 10px 0 2px; font-size: 1.15rem; }
.doc ol, .doc ul { padding-left: 20px; }
.sigs { display: grid; grid-template-columns: 1fr 1fr; text-align: center; margin-top: 24px; min-height: 90px; }
.sigs small { display: block; color: var(--muted); }

/* ===== Bản đồ quy hoạch & phối cảnh ===== */
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; flex-wrap: wrap; }
.seg button { border: 0; background: var(--surface); color: var(--text); padding: 7px 12px; font: inherit; font-size: 13px; cursor: pointer; }
.seg button.on { background: var(--primary); color: var(--on-primary); }
.siteplan { overflow-x: auto; }
.siteplan svg { width: 100%; min-width: 640px; height: auto; display: block; }
.sp-land { fill: #eef5e6; stroke: #9cb88a; stroke-width: 2; }
.sp-road { fill: #d9d4c7; }
.sp-lane { stroke: #fff; stroke-width: 2; stroke-dasharray: 10 8; }
.sp-zone { fill: rgba(255,255,255,.55); stroke-width: 2; }
.sp-farm { fill: #e3ecd9; stroke: #b9c9a8; stroke-dasharray: 4 3; }
.sp-field { fill: #cfe3b8; stroke: #a8c28c; }
.sp-tile { stroke-width: 1.5; }
.sp-svc { fill: #f4efe4; stroke: #c7b99a; }
.sp-pond { fill: #bfe0f2; stroke: #7fb5d6; }
.sp-park { fill: #e2f1d6; stroke: #a9cf8e; }
.sp-lot { fill: #e6e3dc; stroke: #b9b2a3; }
.sp-plot { cursor: pointer; }
.sp-plot:hover rect, .sp-plot:hover polygon { stroke-width: 3; filter: brightness(1.05); }
.sp-plot rect { stroke-width: 1.5; }
.siteplan text { fill: #2d3a30; font-family: system-ui, sans-serif; }
.sp-letter { fill: #fff !important; font-size: 12px; font-weight: 700; text-anchor: middle; }
.sp-ztitle { font-size: 12px; font-weight: 600; }
.sp-pcode { font-size: 11px; font-weight: 700; }
.sp-small { font-size: 10px; }
.sp-title { font-size: 13px; font-weight: 700; letter-spacing: .04em; }
.sp-gate { fill: #c05621; }
.sp-compass { fill: #fff; stroke: #9cb88a; }
.sp-needle { fill: #c0392b; }
.b-face { stroke: rgba(0,0,0,.25); stroke-width: .6; }
.b-top { filter: brightness(1.08); }
.b-shade1 { fill: rgba(0,0,0,.12); }
.b-shade2 { fill: rgba(0,0,0,.24); }
.glass .b-face { stroke: rgba(40,110,150,.6); }
.sp-tree line { stroke: #7b5a3a; stroke-width: 2; }
.sp-tree circle { fill: #4f9a55; stroke: #3a7a40; }
.legend i.lg.reserved { background: var(--warn-bg); border-color: var(--warn); }
.plot.reserved { background: var(--warn-bg); border-color: var(--warn); }
.plot.rented { border-left: 6px solid var(--pc, var(--info)); }

/* ===== Đăng nhập khách thuê ===== */
.login-wrap { display: grid; place-items: center; min-height: 60vh; }
.card.login { width: 100%; max-width: 400px; }
.tenant-card { margin: 8px; padding: 12px; border-radius: 12px; background: var(--ok-bg); display: flex; flex-direction: column; }
.tenant-card small { color: var(--muted); }
body.tenant .admin-only, body.tenant .sim { display: none !important; }
@media (max-width: 480px) { #authBtn .lbl { display: none; } .cred { grid-template-columns: 1fr; } }
@media print {
  body.print-modal .app, body.print-modal .toasts { display: none !important; }
  body.print-modal .modal { position: static; background: none; padding: 0; display: block !important; }
  body.print-modal .modal-box { box-shadow: none; max-width: none; }
  body.print-modal .modal-head .icon-btn, body.print-modal .no-print, body.print-modal .verify { display: none !important; }
}

/* ---- Chế độ công khai / quản trị / máy chủ ---- */
body.public .admin-only, body.public .sim { display: none !important; }
.setup pre { white-space: pre-wrap; word-break: break-word; background: var(--surface-2, #f3f5f2); padding: 8px; border-radius: 8px; font-size: 12px; max-height: 320px; overflow: auto; }
#cloudChip, #adminBtn { white-space: nowrap; }
#cloudChip.ok { color: #1b7f3b; }
#cloudChip.err { color: #b3261e; }
#cloudChip[hidden], #adminBtn[hidden] { display: none !important; }

/* ---- Trực tuyến 24/7 ---- */
.chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.live-hero { align-items: center; }
.live-clock { display: grid; justify-items: center; gap: 2px; padding: 10px 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.live-clock b { font-size: 28px; font-variant-numeric: tabular-nums; }
.live-clock .dot { width: 10px; height: 10px; border-radius: 50%; background: #e53935; animation: livePulse 1.4s infinite; }
@keyframes livePulse { 50% { opacity: .25; } }
.cams { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-top: 12px; }
.cam { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #111; color: #fff; }
.cam.big { aspect-ratio: 16 / 9; margin-bottom: 12px; }
.cam-view, .cam-view > * { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; display: block; }
.cam-ov { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; }
.cam-top { display: flex; justify-content: space-between; padding: 8px; font-size: 12px; font-variant-numeric: tabular-nums; }
.cam-top > span { background: #000a; padding: 2px 8px; border-radius: 6px; }
.cam-live { color: #ff5252; font-weight: 700; }
.cam-live.is-sim { color: #ffd54f; }
.cam-bot { padding: 22px 10px 8px; background: linear-gradient(transparent, #000d 38%); text-shadow: 0 1px 2px #000; }
.cam-bot small { display: block; color: #e6ece8; }
.cam-bot .chip { background: #ffffff26; color: #fff; }
.cam-bot .chip.bad { background: #e5393599; }
.cam-bot .chip.on { background: #2e7d3299; }
.cam-zoom { position: absolute; right: 8px; top: 36px; background: #000a; color: #fff; border: 0; border-radius: 6px; padding: 4px 8px; cursor: pointer; }
.cam-sim.night { filter: grayscale(.8) brightness(.9) contrast(1.15); }
.cam-walk { animation: camWalk 6s ease-in-out infinite alternate; }
.cam-sway { animation: camSway 4s ease-in-out infinite alternate; transform-box: fill-box; transform-origin: bottom center; }
.cam-drop { animation: camDrop 1.2s linear infinite; }
.cam-spin { animation: camSpin 1s linear infinite; transform-box: fill-box; transform-origin: center; }
@keyframes camWalk { to { transform: translateX(22px); } }
@keyframes camSway { from { transform: rotate(-4deg); } to { transform: rotate(4deg); } }
@keyframes camDrop { from { transform: translateY(0); opacity: .9; } to { transform: translateY(40px); opacity: 0; } }
@keyframes camSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .cam-walk, .cam-sway, .cam-drop, .cam-spin, .live-clock .dot { animation: none; } }
.envc b { display: block; margin-bottom: 4px; }
.timeline { display: grid; gap: 2px; }
.tl { display: flex; gap: 8px; align-items: flex-start; padding: 6px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.tl-t { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 42px; }
.feed-scroll { max-height: 420px; overflow: auto; }
.pick.dis { opacity: .5; }
code.big { font-size: 16px; letter-spacing: 1px; user-select: all; }

/* ---- Danh mục dịch vụ ---- */
.svcs { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.svc { display: flex; flex-direction: column; gap: 6px; }
.svc p { margin: 0; font-size: 13px; }
.svc-h { display: flex; gap: 10px; align-items: center; }
.svc-h .pic { font-size: 28px; width: 48px; height: 48px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; flex-shrink: 0; }
.svc-inc { margin: 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.svc-f { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; padding-top: 6px; border-top: 1px solid var(--border); }
.svc-f .price { font-size: 18px; }
