/* MaFi Ops — concept demo stylesheet
   Brand tokens taken from mafismaids.biz (orange #DB6A17, leaf green #3CA200, peach, charcoal; Parkinsans + Outfit) */
:root {
  --brand: #DB6A17;
  --brand-600: #C2580F;
  --brand-700: #A0470B;
  --brand-50: #FDF2E8;
  --brand-100: #FADFC8;
  --peach: #F8D9A8;
  --leaf: #3CA200;
  --leaf-600: #2F8000;
  --leaf-50: #EDF6E1;
  --ocean: #2477B3;
  --ocean-50: #E5F0F8;
  --plum: #7E5BC2;
  --plum-50: #F0EAFA;
  --gold: #E9B500;
  --danger: #CF3F3F;
  --danger-50: #FBEAEA;
  --warn: #C98A00;
  --warn-50: #FCF4DE;
  --ok: #2E8B3E;
  --ok-50: #E6F4E8;
  --info: #2477B3;
  --info-50: #E5F0F8;
  --line-green: #06C755;

  --bg: #F6F3ED;
  --bg-2: #EFEBE3;
  --card: #FFFFFF;
  --card-2: #FBFAF7;
  --ink: #1D2025;
  --ink-2: #33373D;
  --muted: #6A7280;
  --faint: #9AA0AA;
  --line: #E7E1D6;
  --line-2: #F0EBE2;
  --sidebar: #1E2125;
  --sidebar-2: #272B30;
  --sidebar-ink: #C9CDD3;
  --shadow: 0 1px 2px rgba(30, 25, 15, .06), 0 2px 8px rgba(30, 25, 15, .05);
  --shadow-lg: 0 10px 30px rgba(30, 25, 15, .14);
  --radius: 14px;
  --radius-sm: 9px;
  --font-head: "Parkinsans", "Outfit", system-ui, sans-serif;
  --font-body: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-thai: "Noto Sans Thai", "Outfit", sans-serif;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #121417;
  --bg-2: #181B1F;
  --card: #1B1E23;
  --card-2: #20242A;
  --ink: #ECEDEF;
  --ink-2: #D5D8DD;
  --muted: #9AA2AD;
  --faint: #6E7682;
  --line: #2C3138;
  --line-2: #252930;
  --sidebar: #0D0F11;
  --sidebar-2: #181B1F;
  --brand-50: #2C1E13;
  --brand-100: #432913;
  --leaf-50: #1A2914;
  --ocean-50: #142433;
  --plum-50: #231C33;
  --danger-50: #33191A;
  --warn-50: #30260F;
  --ok-50: #16281A;
  --info-50: #142433;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --shadow-lg: 0 10px 30px rgba(0,0,0,.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
[lang="th"], .thai { font-family: var(--font-thai); }
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; font-weight: 600; letter-spacing: -.01em; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.mono { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* ---------- Demo strip ---------- */
.demo-strip {
  position: sticky; top: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 6px 16px;
  background: repeating-linear-gradient(-45deg, var(--brand) 0 14px, var(--brand-600) 14px 28px);
  color: #fff; font-size: 12.5px; font-weight: 500; text-align: center;
}
.demo-strip b { font-weight: 700; letter-spacing: .04em; }
.demo-strip button { background: rgba(255,255,255,.18); border: 0; border-radius: 99px; padding: 2px 10px; color: #fff; font-size: 12px; }

/* ---------- Shell ---------- */
.shell { display: grid; grid-template-columns: 252px 1fr; min-height: calc(100vh - 31px); }
.sidebar {
  background: var(--sidebar); color: var(--sidebar-ink);
  position: sticky; top: 31px; height: calc(100vh - 31px); overflow-y: auto;
  display: flex; flex-direction: column; padding: 14px 12px 16px;
  scrollbar-width: thin; scrollbar-color: #3a3f46 transparent;
}
.brandmark { display: flex; align-items: center; gap: 10px; padding: 4px 6px 14px; text-decoration: none; }
.brandmark img { width: 44px; height: 44px; border-radius: 50%; background: #fff; padding: 2px; }
.brandmark .name { font-family: var(--font-head); font-weight: 700; color: #fff; font-size: 16px; line-height: 1.1; letter-spacing: .01em; }
.brandmark .name span { color: var(--brand); }
.brandmark .sub { font-size: 11px; color: #8E949C; letter-spacing: .08em; text-transform: uppercase; margin-top: 2px; }
.nav-group { margin-top: 12px; }
.nav-group > .label { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: #727981; padding: 0 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 9px; text-decoration: none;
  color: var(--sidebar-ink); font-weight: 500; font-size: 13.5px;
  transition: background .15s, color .15s;
}
.nav a svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav a:hover { background: var(--sidebar-2); color: #fff; }
.nav a.active { background: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(219,106,23,.35); }
.nav a.active svg { opacity: 1; }
.nav a .count { margin-left: auto; font-size: 11px; background: rgba(255,255,255,.1); padding: 1px 7px; border-radius: 99px; }
.nav a.active .count { background: rgba(255,255,255,.25); }
.nav a .count.alert { background: var(--danger); color: #fff; }
.sidebar-foot { margin-top: auto; padding: 14px 8px 0; font-size: 11.5px; color: #7c838b; border-top: 1px solid #2c3036; }
.sidebar-foot .phase { display: inline-block; margin-top: 6px; padding: 2px 8px; border-radius: 99px; background: rgba(60,162,0,.18); color: #8fd65f; font-weight: 600; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 31px; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 24px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; background: none; border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px; }
.branch-sel {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); font-weight: 600; position: relative;
}
.branch-sel .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--leaf); box-shadow: 0 0 0 3px rgba(60,162,0,.2); }
.search {
  flex: 1; max-width: 420px; display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--muted);
}
.search input { border: 0; outline: 0; background: transparent; font: inherit; color: var(--ink); width: 100%; }
.search kbd { font-family: var(--font-body); font-size: 11px; border: 1px solid var(--line); border-radius: 5px; padding: 0 5px; color: var(--faint); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.clock { text-align: right; line-height: 1.15; }
.clock .t { font-family: var(--font-head); font-weight: 600; font-size: 16px; font-variant-numeric: tabular-nums; }
.clock .d { font-size: 11px; color: var(--muted); }
.icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); position: relative;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .pip { position: absolute; top: 6px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--card); }
.avatar-btn { display: flex; align-items: center; gap: 8px; padding: 3px 10px 3px 3px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); }
.avatar-btn .who { font-size: 12px; line-height: 1.1; text-align: left; }
.avatar-btn .who small { color: var(--muted); display: block; }

.view { padding: 22px 24px 48px; max-width: 1560px; width: 100%; animation: viewIn .35s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page-head { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 26px; }
.page-head p { margin: 4px 0 0; color: var(--muted); max-width: 720px; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .12em; color: var(--brand); font-weight: 700; }

/* ---------- Buttons, chips, badges ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 13px;
  transition: transform .1s, background .15s, box-shadow .15s; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--card-2); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 4px 14px rgba(219,106,23,.28); }
.btn.primary:hover { background: var(--brand-600); }
.btn.leaf { background: var(--leaf); border-color: var(--leaf); color: #fff; }
.btn.line { background: var(--line-green); border-color: var(--line-green); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn.lg { padding: 11px 18px; font-size: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--card); font-size: 12.5px; font-weight: 500; cursor: pointer;
}
.chip.on { background: var(--ink); color: var(--card); border-color: var(--ink); }
.chip .sw { width: 9px; height: 9px; border-radius: 50%; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 99px;
  font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--bg-2); color: var(--ink-2);
}
.badge.ok { background: var(--ok-50); color: var(--ok); }
.badge.warn { background: var(--warn-50); color: var(--warn); }
.badge.danger { background: var(--danger-50); color: var(--danger); }
.badge.info { background: var(--info-50); color: var(--info); }
.badge.brand { background: var(--brand-50); color: var(--brand-600); }
.badge.leaf { background: var(--leaf-50); color: var(--leaf-600); }
.badge.plum { background: var(--plum-50); color: var(--plum); }
.badge.outline { background: transparent; border: 1px solid var(--line); color: var(--muted); }
.badge .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.live .d { animation: pulse 1.6s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 6px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.demo-tag { font-size: 10px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--brand-600); background: var(--brand-50); border: 1px dashed var(--brand); border-radius: 6px; padding: 1px 6px; }
.av {
  width: 30px; height: 30px; border-radius: 50%; display: inline-grid; place-items: center;
  font-size: 11.5px; font-weight: 700; color: #fff; flex: none; border: 2px solid var(--card);
}
.av.lg { width: 44px; height: 44px; font-size: 15px; }
.av.sm { width: 24px; height: 24px; font-size: 10px; }
.av-stack { display: flex; }
.av-stack .av + .av { margin-left: -8px; }

/* ---------- Cards & grid ---------- */
.grid { display: grid; gap: 16px; }
.g-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.g-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
.g-6 { grid-template-columns: repeat(6, minmax(0,1fr)); }
.g-main { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.g-main-r { grid-template-columns: minmax(0, 1fr) minmax(0, 1.65fr); }
.span-2 { grid-column: span 2; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); min-width: 0;
}
.card-h { display: flex; align-items: center; gap: 10px; padding: 14px 16px 0; }
.card-h h3 { font-size: 15px; }
.card-h .sub { color: var(--muted); font-size: 12.5px; }
.card-h .right { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.card-b { padding: 14px 16px 16px; }
.card-b.flush { padding: 10px 0 4px; }
.card.pad { padding: 16px; }
.card.hl { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(219,106,23,.12); }

.kpi { padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.kpi .lbl { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-family: var(--font-head); font-size: 26px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .val small { font-size: 14px; color: var(--muted); font-weight: 500; }
.kpi .delta { font-size: 12px; font-weight: 600; }
.kpi .delta.up { color: var(--ok); }
.kpi .delta.down { color: var(--danger); }
.kpi .spark { position: absolute; right: 12px; bottom: 12px; opacity: .9; }
.kpi .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; position: absolute; right: 14px; top: 14px; }
.kpi .ic svg { width: 16px; height: 16px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 600; padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--card-2); position: sticky; top: 0; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
table.t tr:last-child td { border-bottom: 0; }
table.t tbody tr { transition: background .12s; }
table.t tbody tr.click { cursor: pointer; }
table.t tbody tr:hover { background: var(--card-2); }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.cell-main { font-weight: 600; }
.cell-sub { font-size: 12px; color: var(--muted); }
.who { display: flex; align-items: center; gap: 9px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--brand); }
.tab-pane { display: none; animation: viewIn .3s ease; }
.tab-pane.on { display: block; }

/* ---------- Lists / feed ---------- */
.feed { display: flex; flex-direction: column; }
.feed .item { display: flex; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line-2); align-items: flex-start; }
.feed .item:first-child { border-top: 0; }
.feed .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; }
.feed .ic svg { width: 16px; height: 16px; }
.feed .txt { flex: 1; min-width: 0; }
.feed .txt b { font-weight: 600; }
.feed .meta { font-size: 11.5px; color: var(--faint); margin-top: 2px; }
.feed .act { display: flex; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.tone-danger { background: var(--danger-50); color: var(--danger); }
.tone-warn { background: var(--warn-50); color: var(--warn); }
.tone-ok { background: var(--ok-50); color: var(--ok); }
.tone-info { background: var(--info-50); color: var(--info); }
.tone-brand { background: var(--brand-50); color: var(--brand); }
.tone-plum { background: var(--plum-50); color: var(--plum); }
.tone-leaf { background: var(--leaf-50); color: var(--leaf-600); }

/* ---------- Progress bars ---------- */
.bar { height: 7px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--brand); transition: width .8s cubic-bezier(.2,.8,.2,1); }
.meter-row { display: grid; grid-template-columns: 110px 1fr 56px; gap: 10px; align-items: center; font-size: 12.5px; padding: 5px 0; }
.meter-row .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Team cards ---------- */
.team-card { padding: 14px 16px; border-left: 4px solid var(--tc, var(--brand)); }
.team-card .top { display: flex; align-items: center; gap: 8px; }
.team-card h4 { font-size: 15px; }
.team-card .status { margin-left: auto; }
.team-card .now { margin-top: 10px; font-size: 13px; }
.team-card .now b { font-weight: 600; }
.team-card .steps { display: flex; gap: 4px; margin-top: 10px; }
.team-card .steps span { flex: 1; height: 6px; border-radius: 99px; background: var(--bg-2); }
.team-card .steps span.done { background: var(--tc); }
.team-card .steps span.cur { background: repeating-linear-gradient(-45deg, var(--tc) 0 5px, color-mix(in srgb, var(--tc) 50%, transparent) 5px 10px); background-size: 200% 100%; animation: stripe 1.2s linear infinite; }
@keyframes stripe { to { background-position: -28px 0; } }
.team-card .foot { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: 12px; color: var(--muted); }

/* ---------- Map ---------- */
.map { height: 420px; border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; z-index: 1; }
.map.tall { height: 560px; }
.map-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; }
.map-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.leaflet-container { font-family: var(--font-body) !important; background: var(--bg-2) !important; }
.pin { width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }
.pin.done { opacity: .55; }
.team-marker {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 11px;
  border: 3px solid #fff; box-shadow: 0 2px 10px rgba(0,0,0,.35); position: relative;
}
.team-marker::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 2px solid currentColor; opacity: .0; animation: ring 2s infinite; color: inherit; }
@keyframes ring { 0% { transform: scale(.6); opacity: .7; } 100% { transform: scale(1.3); opacity: 0; } }
.hq-marker { width: 40px; height: 40px; border-radius: 50%; background: #fff url(mascot.webp) center/cover; border: 3px solid var(--brand); box-shadow: 0 2px 10px rgba(0,0,0,.3); }
.leaflet-popup-content { font-size: 12.5px; margin: 10px 12px; }
.leaflet-popup-content b { font-weight: 600; }
.osm-tiles { filter: saturate(.7) contrast(.96) brightness(1.03); }
:root[data-theme="dark"] .osm-tiles { filter: invert(1) hue-rotate(180deg) brightness(.85) saturate(.5) contrast(.9); }

/* ---------- Scheduler board ---------- */
.sched-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 16px; align-items: start; }
.queue { position: sticky; top: 100px; }
.queue .q-list { display: flex; flex-direction: column; gap: 8px; padding: 12px; max-height: 62vh; overflow-y: auto; }
.board { overflow-x: auto; }
.board-grid { display: grid; grid-template-columns: 150px repeat(7, minmax(128px, 1fr)); min-width: 1060px; }
.board-grid .hd { padding: 10px 8px; font-size: 12px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); background: var(--card-2); position: sticky; top: 0; z-index: 2; }
.board-grid .hd.today { color: var(--brand); }
.board-grid .hd .dn { font-family: var(--font-head); font-size: 16px; color: var(--ink); }
.board-grid .hd.today .dn { color: var(--brand); }
.board-grid .rowh { padding: 10px; border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); display: flex; flex-direction: column; gap: 6px; background: var(--card); position: sticky; left: 0; z-index: 1; }
.board-grid .rowh .tn { display: flex; align-items: center; gap: 7px; font-weight: 700; font-family: var(--font-head); }
.board-grid .rowh .tn i { width: 10px; height: 10px; border-radius: 3px; }
.board-grid .rowh .meta { font-size: 11.5px; color: var(--muted); }
.cell { padding: 6px; border-bottom: 1px solid var(--line-2); border-right: 1px solid var(--line-2); min-height: 150px; display: flex; flex-direction: column; gap: 5px; position: relative; transition: background .3s; }
.cell.today { background: color-mix(in srgb, var(--brand-50) 55%, transparent); }
.cell.sun { background: repeating-linear-gradient(-45deg, transparent 0 8px, var(--line-2) 8px 9px); }
.cell.flash { background: var(--warn-50); }
.cell.flash-ok { background: var(--ok-50); }
.cell .cap { display: flex; align-items: center; gap: 6px; font-size: 10.5px; color: var(--muted); margin-bottom: 2px; }
.cell .cap .bar { flex: 1; height: 4px; }
.cell .cap .bar > span { background: var(--tc); }
.cell .cap.over { color: var(--danger); }
.cell .cap.over .bar > span { background: var(--danger); }
.job {
  border-radius: 8px; padding: 6px 7px; font-size: 11.5px; line-height: 1.25; background: var(--card);
  border: 1px solid var(--line); border-left: 3px solid var(--tc, var(--brand)); cursor: pointer; position: relative;
  transition: transform .15s, box-shadow .15s;
}
.job:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.job .jt { font-weight: 700; font-variant-numeric: tabular-nums; display: flex; gap: 5px; align-items: center; }
.job .jt .heart { color: var(--danger); font-size: 11px; margin-left: auto; }
.job .jc { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.job .jz { color: var(--muted); font-size: 10.5px; display: flex; gap: 4px; align-items: center; }
.job.new { border-style: dashed; border-left-style: solid; background: var(--brand-50); }
.job.ghost { opacity: 0; }
.job.q { border-left-color: var(--faint); }
.job.q .why { font-size: 10.5px; color: var(--brand-600); margin-top: 3px; }
.job.travel-chip { background: transparent; border: 0; border-left: 0; padding: 0 4px; color: var(--faint); font-size: 10px; cursor: default; display: flex; align-items: center; gap: 4px; }
.job.travel-chip:hover { transform: none; box-shadow: none; }
.fly { position: fixed; z-index: 200; pointer-events: none; transition: transform .75s cubic-bezier(.2,.8,.2,1), opacity .3s; box-shadow: var(--shadow-lg); }

.engine-modal .steps { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.engine-modal .step { display: flex; align-items: center; gap: 10px; font-size: 13.5px; color: var(--faint); transition: color .2s; }
.engine-modal .step .s-ic { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; flex: none; }
.engine-modal .step.run { color: var(--ink); }
.engine-modal .step.run .s-ic { border-color: var(--brand); border-top-color: transparent; animation: spin .7s linear infinite; }
.engine-modal .step.ok { color: var(--ink-2); }
.engine-modal .step.ok .s-ic { border-color: var(--ok); background: var(--ok); color: #fff; }
.engine-modal .step .n { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
@keyframes spin { to { transform: rotate(360deg); } }
.score-ring { width: 120px; height: 120px; }

.weights .w { display: grid; grid-template-columns: 1fr 120px 34px; gap: 10px; align-items: center; padding: 6px 0; font-size: 13px; }
.weights input[type=range] { width: 100%; accent-color: var(--brand); }
.weights .lock { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; }
.weights .lock svg { width: 14px; height: 14px; color: var(--muted); }

/* ---------- Gantt ---------- */
.gantt { position: relative; min-width: 880px; }
.gantt .g-head { display: grid; grid-template-columns: 150px 1fr; border-bottom: 1px solid var(--line); }
.gantt .hours { position: relative; height: 30px; }
.gantt .hours span { position: absolute; top: 8px; font-size: 11px; color: var(--muted); transform: translateX(-50%); }
.gantt .g-row { display: grid; grid-template-columns: 150px 1fr; border-bottom: 1px solid var(--line-2); }
.gantt .g-row .lab { padding: 12px 10px; display: flex; flex-direction: column; gap: 3px; border-right: 1px solid var(--line-2); }
.gantt .g-row .lab b { font-family: var(--font-head); display: flex; align-items: center; gap: 6px; }
.gantt .track { position: relative; height: 64px; background-image: linear-gradient(to right, var(--line-2) 1px, transparent 1px); background-size: calc(100% / 13) 100%; }
.gantt .blk { position: absolute; top: 10px; height: 44px; border-radius: 8px; padding: 5px 8px; font-size: 11px; line-height: 1.2; color: #fff; overflow: hidden; white-space: nowrap; cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.gantt .blk b { display: block; font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
.gantt .blk.done { opacity: .55; }
.gantt .blk.sched { background: transparent !important; border: 2px dashed var(--tc); color: var(--ink); }
.gantt .blk.prog { background-image: repeating-linear-gradient(-45deg, rgba(255,255,255,.0) 0 8px, rgba(255,255,255,.18) 8px 16px) !important; background-size: 200% 100%; animation: stripe 1.5s linear infinite; }
.gantt .trv { position: absolute; top: 28px; height: 8px; border-radius: 4px; background: repeating-linear-gradient(90deg, var(--faint) 0 4px, transparent 4px 7px); opacity: .7; }
.gantt .now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); z-index: 3; }
.gantt .now::before { content: attr(data-t); position: absolute; top: -2px; left: 50%; transform: translateX(-50%); background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 5px; }

/* ---------- Drawer & modal ---------- */
.scrim { position: fixed; inset: 0; background: rgba(15, 12, 8, .38); z-index: 90; opacity: 0; pointer-events: none; transition: opacity .25s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--card); z-index: 100;
  box-shadow: var(--shadow-lg); transform: translateX(105%); transition: transform .32s cubic-bezier(.2,.8,.2,1);
  display: flex; flex-direction: column;
}
.drawer.on { transform: none; }
.drawer .dh { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.drawer .dh h2 { font-size: 19px; }
.drawer .db { padding: 16px 20px 30px; overflow-y: auto; flex: 1; }
.drawer .close { margin-left: auto; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 8px 12px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.section-t { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 700; margin: 20px 0 8px; }
.note { padding: 10px 12px; border-radius: 10px; background: var(--card-2); border: 1px solid var(--line); font-size: 13px; }
.note.brand { background: var(--brand-50); border-color: var(--brand-100); }
.note.warn { background: var(--warn-50); border-color: transparent; }
.modal {
  position: fixed; left: 50%; top: 50%; width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow-y: auto;
  background: var(--card); border-radius: 18px; z-index: 110; box-shadow: var(--shadow-lg);
  transform: translate(-50%, -46%) scale(.97); opacity: 0; pointer-events: none; transition: all .25s cubic-bezier(.2,.8,.2,1); padding: 22px;
}
.modal.on { transform: translate(-50%, -50%); opacity: 1; pointer-events: auto; }
.modal.wide { width: min(820px, calc(100vw - 32px)); }

/* ---------- Toast ---------- */
.toasts { position: fixed; bottom: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast {
  display: flex; gap: 10px; align-items: flex-start; max-width: 380px; padding: 12px 14px; border-radius: 12px;
  background: var(--ink); color: var(--card); box-shadow: var(--shadow-lg); font-size: 13px; animation: toastIn .3s cubic-bezier(.2,.8,.2,1);
}
.toast .ti { width: 22px; height: 22px; border-radius: 50%; background: var(--brand); display: grid; place-items: center; flex: none; color: #fff; font-weight: 700; font-size: 12px; }
.toast b { display: block; margin-bottom: 1px; }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .25s; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

/* ---------- Availability grid ---------- */
.avail { display: grid; min-width: 980px; }
.avail .ah { font-size: 11px; color: var(--muted); text-align: center; padding: 6px 2px; border-bottom: 1px solid var(--line); line-height: 1.15; }
.avail .ah b { display: block; font-size: 14px; color: var(--ink); font-family: var(--font-head); }
.avail .ah.wk { background: var(--bg-2); }
.avail .ah.hol { color: var(--danger); }
.avail .an { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--line-2); font-size: 12.5px; }
.avail .ac { border-bottom: 1px solid var(--line-2); padding: 4px 2px; display: grid; place-items: center; }
.avail .ac span { width: 100%; height: 26px; border-radius: 6px; display: grid; place-items: center; font-size: 10px; font-weight: 700; letter-spacing: .03em; }
.s-on { background: color-mix(in srgb, var(--tc) 18%, transparent); color: var(--tc); }
.s-off { background: var(--bg-2); color: var(--faint); }
.s-leave { background: var(--info-50); color: var(--info); }
.s-sick { background: var(--danger-50); color: var(--danger); }
.s-cover { background: var(--plum-50); color: var(--plum); outline: 1.5px dashed var(--plum); }
.s-hol { background: var(--warn-50); color: var(--warn); }

/* ---------- Kanban ---------- */
.kanban { display: grid; grid-template-columns: repeat(5, minmax(200px, 1fr)); gap: 12px; overflow-x: auto; }
.kcol { background: var(--bg-2); border-radius: 12px; padding: 10px; min-height: 200px; }
.kcol h4 { font-size: 13px; display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.kcard { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; font-size: 12.5px; box-shadow: var(--shadow); }
.kcard b { font-weight: 600; display: block; }

/* ---------- Photos ---------- */
.photo { aspect-ratio: 4/3; border-radius: 10px; position: relative; overflow: hidden; display: grid; place-items: center; color: rgba(255,255,255,.95); font-size: 11px; font-weight: 600; }
.photo .tag { position: absolute; left: 6px; top: 6px; background: rgba(0,0,0,.45); color: #fff; padding: 1px 7px; border-radius: 99px; font-size: 10.5px; }
.photo svg { width: 34px; height: 34px; opacity: .9; }
.photo.before { background: linear-gradient(135deg, #8d8170, #b8a98f 60%, #a19274); }
.photo.after { background: linear-gradient(135deg, #f3e7d3, #fffaf1 55%, #e8d7b8); color: #8a6d3b; }
.photo.after .tag { background: var(--leaf); }

/* ---------- Phone (LINE LIFF) ---------- */
.phone-wrap { display: grid; grid-template-columns: 340px 1fr; gap: 28px; align-items: start; }
.phone {
  width: 340px; height: 690px; border-radius: 46px; background: #111; padding: 12px; position: relative; box-shadow: 0 20px 50px rgba(0,0,0,.25), inset 0 0 0 2px #333;
}
.phone .notch { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: 120px; height: 26px; background: #111; border-radius: 0 0 16px 16px; z-index: 5; }
.phone .scr { width: 100%; height: 100%; border-radius: 36px; overflow: hidden; background: #fff; color: #1d2025; display: flex; flex-direction: column; position: relative; }
.phone .sb { height: 34px; display: flex; align-items: flex-end; justify-content: space-between; padding: 0 22px 4px; font-size: 12px; font-weight: 600; background: var(--line-green); color: #fff; }
.phone .lh { background: var(--line-green); color: #fff; padding: 8px 14px 10px; display: flex; align-items: center; gap: 10px; }
.phone .lh img { width: 30px; height: 30px; border-radius: 50%; background: #fff; }
.phone .lh .t { font-weight: 700; font-size: 14px; line-height: 1.1; }
.phone .lh .t small { display: block; font-weight: 500; opacity: .85; font-size: 11px; }
.phone .body { flex: 1; overflow-y: auto; background: #F4F5F7; position: relative; }
.phone .liffbar { background: #fff; border-bottom: 1px solid #e5e5e5; padding: 8px 12px; font-size: 12px; display: flex; align-items: center; gap: 8px; color: #555; }
.phone .liffbar b { color: #1d2025; }
.phone .p-card { background: #fff; margin: 10px; border-radius: 14px; padding: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); font-size: 13px; }
.phone .p-card h5 { margin: 0 0 6px; font-size: 14px; font-family: var(--font-head); font-weight: 600; }
.phone .p-btn { display: block; width: 100%; padding: 11px; border-radius: 12px; border: 0; font-weight: 700; font-size: 14px; color: #fff; background: var(--brand); margin-top: 8px; }
.phone .p-btn.green { background: var(--line-green); }
.phone .p-btn.ghost { background: #EEF0F2; color: #1d2025; }
.phone .rich { display: grid; grid-template-columns: repeat(3, 1fr); background: #fff; border-top: 1px solid #e3e3e3; }
.phone .rich div { padding: 10px 4px; text-align: center; font-size: 11px; border-right: 1px solid #eee; border-top: 1px solid #eee; cursor: pointer; line-height: 1.2; }
.phone .rich div:hover { background: #FFF6EE; }
.phone .rich div svg { width: 20px; height: 20px; color: var(--brand); display: block; margin: 0 auto 3px; }
.phone .bubble { background: #fff; border-radius: 16px; margin: 10px 40px 10px 12px; overflow: hidden; box-shadow: 0 1px 2px rgba(0,0,0,.08); font-size: 12.5px; }
.phone .bubble .bh { background: var(--brand); color: #fff; padding: 10px 12px; font-weight: 700; }
.phone .bubble .bb { padding: 10px 12px; }
.phone .chk { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid #f0f0f0; font-size: 13px; }
.phone .chk:first-of-type { border-top: 0; }
.phone .chk .box { width: 20px; height: 20px; border-radius: 6px; border: 2px solid #cfd3d8; display: grid; place-items: center; flex: none; color: #fff; font-size: 12px; }
.phone .chk.done .box { background: var(--leaf); border-color: var(--leaf); }
.phone .chk.done span { color: #8a9099; text-decoration: line-through; }
.phone .p-job { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid #f0f0f0; cursor: pointer; }
.phone .p-job:first-of-type { border-top: 0; }
.phone .p-job .tm { font-weight: 700; width: 46px; flex: none; font-variant-numeric: tabular-nums; }
.phone .p-job .st { margin-left: auto; }
.phone .tabs-p { display: flex; background: #fff; border-bottom: 1px solid #eee; }
.phone .tabs-p button { flex: 1; border: 0; background: none; padding: 9px 0; font-size: 12px; font-weight: 600; color: #8a9099; border-bottom: 2px solid transparent; }
.phone .tabs-p button.on { color: var(--brand); border-bottom-color: var(--brand); }
.screen-picker { display: flex; flex-direction: column; gap: 8px; }
.screen-picker button { text-align: left; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); display: flex; gap: 12px; align-items: center; }
.screen-picker button.on { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(219,106,23,.14); }
.screen-picker button .n { width: 26px; height: 26px; border-radius: 50%; background: var(--bg-2); display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.screen-picker button.on .n { background: var(--brand); color: #fff; }
.screen-picker button small { display: block; color: var(--muted); font-size: 12px; }

/* ---------- Roadmap / architecture ---------- */
.phases { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.phase { padding: 16px; border-top: 4px solid var(--pc); }
.phase .ph { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--pc); }
.phase h3 { font-size: 17px; margin: 4px 0 8px; }
.phase ul { margin: 0; padding-left: 18px; font-size: 13px; color: var(--ink-2); }
.phase li { margin: 4px 0; }
.arch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.arch .box { border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--card-2); }
.arch .box h4 { font-size: 13.5px; margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.arch .box p { margin: 0; font-size: 12.5px; color: var(--muted); }
.arch .layer { grid-column: 1 / -1; font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }

/* ---------- Misc ---------- */
.empty-dash { border: 1.5px dashed var(--line); border-radius: 12px; padding: 18px; text-align: center; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.sp { flex: 1; }
.hr { height: 1px; background: var(--line); margin: 14px 0; }
.qr { width: 150px; height: 150px; background: #fff; padding: 8px; border-radius: 10px; border: 1px solid var(--line); }
.statement { font-size: 13px; }
.statement .ln { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px dashed var(--line); font-variant-numeric: tabular-nums; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.chart text { font-family: var(--font-body); fill: var(--muted); font-size: 11px; }
.chart .gl { stroke: var(--line-2); }
.chart .bar-r { transition: opacity .15s; }
.chart .bar-r:hover { opacity: .8; }
.tip { position: fixed; z-index: 300; pointer-events: none; background: var(--ink); color: var(--card); font-size: 12px; padding: 6px 9px; border-radius: 8px; opacity: 0; transition: opacity .12s; white-space: nowrap; }
.tip.on { opacity: 1; }
.perm td { text-align: center; }
.perm td:first-child { text-align: left; }
.tick { color: var(--ok); font-weight: 700; }
.cross { color: var(--faint); }
.svc-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line-2); font-size: 13px; }
.svc-row:first-child { border-top: 0; }
.ghost-card { border: 1.5px dashed var(--line); background: transparent; box-shadow: none; }
.zen-flow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; position: relative; }
.zen-flow .z { padding: 14px; position: relative; }
.zen-flow .z + .z::before { content: "→"; position: absolute; left: -9px; top: 22px; color: var(--faint); font-size: 18px; }
.zen-flow .z .n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; margin-bottom: 8px; }
.zen-flow .z h4 { font-size: 14px; margin-bottom: 4px; }
.zen-flow .z p { margin: 0; font-size: 12.5px; color: var(--muted); }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .g-6 { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .phases { grid-template-columns: repeat(2, minmax(0,1fr)); }
}
@media (max-width: 1100px) {
  .g-main, .g-main-r { grid-template-columns: 1fr; }
  .g-4 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .sched-layout { grid-template-columns: 1fr; }
  .queue { position: static; }
  .queue .q-list { flex-direction: row; overflow-x: auto; max-height: none; }
  .queue .q-list .job { min-width: 200px; }
  .phone-wrap { grid-template-columns: 1fr; justify-items: center; }
  .zen-flow { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; height: 100vh; width: 270px; z-index: 120; transform: translateX(-102%); transition: transform .28s cubic-bezier(.2,.8,.2,1); }
  body.nav-open .sidebar { transform: none; box-shadow: var(--shadow-lg); }
  .menu-btn { display: grid; place-items: center; }
  .topbar { padding: 10px 16px; }
  .search { display: none; }
  .view { padding: 16px 16px 40px; }
  .g-2, .g-3 { grid-template-columns: 1fr; }
  .g-6 { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .span-2 { grid-column: auto; }
  .avatar-btn .who, .clock .d { display: none; }
  .phases, .arch { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(5, 230px); }
  .branch-sel span.lbl { display: none; }
  .demo-strip { font-size: 11px; }
  .page-head h1 { font-size: 22px; }
  .map { height: 340px; }
  .map.tall { height: 420px; }
}
@media (max-width: 520px) {
  .g-4, .g-6 { grid-template-columns: 1fr 1fr; }
  .kpi .val { font-size: 21px; }
  .phone { transform: scale(.92); transform-origin: top center; }
  .zen-flow { grid-template-columns: 1fr; }
  .zen-flow .z + .z::before { content: "↓"; left: 14px; top: -10px; }
  .kv { grid-template-columns: 110px 1fr; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ---------- Wall display mode (office TV) ---------- */
body.wall .shell { grid-template-columns: 1fr; }
body.wall .sidebar { display: none; }
body.wall .search, body.wall .avatar-btn { display: none; }
body.wall .view { max-width: none; }
body.wall .clock .t { font-size: 22px; }
.g-3s { grid-template-columns: repeat(3, minmax(0,1fr)); }
.demo-strip .short { display: none; }
@media (max-width: 640px) {
  .demo-strip .long { display: none; }
  .demo-strip .short { display: inline; }
  .demo-strip { padding: 5px 10px; }
}
@media (max-width: 560px) { .teams-row { grid-template-columns: 1fr; } }
.g-5 { grid-template-columns: repeat(5, minmax(0,1fr)); }
@media (max-width: 1280px) { .g-5 { grid-template-columns: repeat(3, minmax(0,1fr)); } }
@media (max-width: 560px) { .g-5 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 1100px) and (min-width: 521px) { .zen-flow .z:nth-child(3)::before { content: none; } }
