/* Tatuka Business Dashboard */

:root {
	color-scheme: light;
	--navy: #002d62;
	--navy-2: #0b3d7a;
	--bg: #f3f5f9;
	--card: #ffffff;
	--card-2: #f8fafc;
	--line: #e4e7ec;
	--line-2: #eef1f5;
	--ink: #101828;
	--ink-2: #475467;
	--ink-3: #667085;
	--accent: #2a78d6;        /* chart series (validated on #fff) */
	--accent-wash: rgba(42, 120, 214, 0.10);
	--grid: #e9ecf1;
	--axis: #c3c8d1;
	--good: #067647;
	--good-bg: #ecfdf3;
	--bad: #b42318;
	--bad-bg: #fef3f2;
	--warn: #b54708;
	--warn-bg: #fffaeb;
	--info: #175cd3;
	--info-bg: #eff8ff;
	--violet: #5925dc;
	--violet-bg: #f4f3ff;
	--shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 16px rgba(16, 24, 40, 0.04);
	--radius: 16px;
	--font: "Fira Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
html[data-theme="dark"] {
	color-scheme: dark;
	--bg: #0a1020;
	--card: #111a2e;
	--card-2: #0d1526;
	--line: rgba(255, 255, 255, 0.09);
	--line-2: rgba(255, 255, 255, 0.05);
	--ink: #eef2ff;
	--ink-2: #c3cde0;
	--ink-3: #8b9ab3;
	--accent: #3987e5;        /* chart series (validated on #111a2e) */
	--accent-wash: rgba(57, 135, 229, 0.16);
	--grid: rgba(255, 255, 255, 0.07);
	--axis: rgba(255, 255, 255, 0.18);
	--good: #47cd89;
	--good-bg: rgba(18, 183, 106, 0.12);
	--bad: #f97066;
	--bad-bg: rgba(240, 68, 56, 0.12);
	--warn: #fdb022;
	--warn-bg: rgba(247, 144, 9, 0.12);
	--info: #84caff;
	--info-bg: rgba(46, 144, 250, 0.14);
	--violet: #bdb4fe;
	--violet-bg: rgba(122, 90, 248, 0.16);
	--shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
	font-family: var(--font);
	font-size: 15px;
	line-height: 1.5;
	color: var(--ink);
	background: var(--bg);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--info); }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
.td-boot { padding: 40vh 16px; text-align: center; color: var(--ink-3); }
.td-muted { color: var(--ink-3); }
.td-num { font-variant-numeric: tabular-nums; }
.td-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Buttons & inputs ---------- */
.td-btn {
	display: inline-flex; align-items: center; justify-content: center; gap: 6px;
	min-height: 40px; padding: 8px 14px; border-radius: 10px;
	border: 1px solid var(--line); background: var(--card); color: var(--ink);
	font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
	transition: background-color .15s ease, border-color .15s ease, transform .1s ease;
}
.td-btn:hover { background: var(--card-2); border-color: var(--axis); }
.td-btn:active { transform: translateY(1px); }
.td-btn:focus-visible, .td-input:focus-visible, .td-seg button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.td-btn-primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.td-btn-primary:hover { background: var(--navy-2); border-color: var(--navy-2); }
html[data-theme="dark"] .td-btn-primary { background: #3987e5; border-color: #3987e5; color: #06101f; }
html[data-theme="dark"] .td-btn-primary:hover { background: #5ea0ee; border-color: #5ea0ee; }
.td-btn-ghost { background: transparent; border-color: transparent; }
.td-btn-danger { color: var(--bad); }
.td-btn-sm { min-height: 34px; padding: 6px 10px; font-size: 13px; border-radius: 9px; }
.td-btn-block { width: 100%; }
.td-btn[disabled] { opacity: .55; cursor: progress; }
.td-input, .td-select, .td-textarea {
	width: 100%; min-height: 42px; padding: 9px 12px; border-radius: 10px;
	border: 1px solid var(--line); background: var(--card); color: var(--ink);
	font-size: 15px;
}
.td-textarea { min-height: 72px; resize: vertical; }
.td-field { display: flex; flex-direction: column; gap: 6px; }
.td-field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.td-icon { width: 18px; height: 18px; flex: none; }

/* ---------- Login ---------- */
.td-login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
	background: radial-gradient(1200px 600px at 10% -10%, rgba(42,120,214,.16), transparent 60%), var(--bg); }
.td-login-card { width: min(400px, 100%); background: var(--card); border: 1px solid var(--line); border-radius: 22px;
	padding: 28px 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; }
.td-login-logo { width: 88px; height: 88px; object-fit: contain; margin: 0 auto 4px; display: block; }
.td-login-card h1 { font-size: 21px; text-align: center; }
.td-login-card .td-muted { text-align: center; margin: 0 0 8px; font-size: 14px; }
.td-login-card label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.td-login-card input[type="text"], .td-login-card input[type="password"] {
	min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); color: var(--ink); font-size: 16px; }
.td-check { display: flex !important; align-items: center; gap: 8px; font-weight: 500 !important; margin: 4px 0 6px; }
.td-alert { background: var(--bad-bg); color: var(--bad); border-radius: 12px; padding: 10px 12px; font-size: 14px; font-weight: 600; }
.td-link { text-align: center; font-size: 14px; margin-top: 6px; color: var(--ink-3); }

/* ---------- Top bar ---------- */
.td-top {
	position: sticky; top: 0; z-index: 30;
	background: color-mix(in srgb, var(--card) 88%, transparent);
	-webkit-backdrop-filter: saturate(160%) blur(12px); backdrop-filter: saturate(160%) blur(12px);
	border-bottom: 1px solid var(--line);
}
.td-top-in { max-width: 1440px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.td-brand { display: flex; align-items: center; gap: 10px; margin-right: auto; text-decoration: none; color: var(--ink); min-width: 0; }
.td-brand img { width: 40px; height: 40px; object-fit: contain; }
.td-brand strong { display: block; font-size: 17px; letter-spacing: .2px; }
.td-brand small { display: block; font-size: 12px; color: var(--ink-3); }
.td-top-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.td-live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); }
.td-live i { width: 8px; height: 8px; border-radius: 50%; background: #12b76a; box-shadow: 0 0 0 3px rgba(18,183,106,.18); }
.td-live.is-off i { background: var(--ink-3); box-shadow: none; }

/* Range control */
.td-rangebar { max-width: 1440px; margin: 0 auto; padding: 0 20px 10px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.td-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line); overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.td-seg::-webkit-scrollbar { display: none; }
.td-seg button { border: 0; background: transparent; padding: 7px 12px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.td-seg button[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(16,24,40,.12); }
html[data-theme="dark"] .td-seg button[aria-pressed="true"] { background: #1c2742; }
.td-custom { display: inline-flex; align-items: center; gap: 6px; }
.td-custom input { min-height: 38px; padding: 6px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font-size: 14px; }
.td-range-label { font-size: 14px; color: var(--ink-3); }

/* ---------- Layout ---------- */
.td-main { max-width: 1440px; margin: 0 auto; padding: 16px 20px 64px; display: flex; flex-direction: column; gap: 18px; }
.td-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.td-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.td-card-head h2 { font-size: 17px; }
.td-card-head p { margin: 2px 0 0; font-size: 13px; color: var(--ink-3); }
.td-grid { display: grid; gap: 18px; }
.td-grid-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.td-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.td-section-title { display: flex; align-items: baseline; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.td-section-title h2 { font-size: 19px; }

/* ---------- KPIs ---------- */
.td-kpis { display: grid; grid-template-columns: 1.3fr repeat(3, minmax(0, 1fr)); gap: 14px; }
.td-kpi { position: relative; }
.td-kpi-label { font-size: 13px; font-weight: 600; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.td-kpi-value { font-size: 30px; font-weight: 700; margin: 6px 0 4px; letter-spacing: -0.2px; word-break: break-word; }
.td-kpi.is-hero .td-kpi-value { font-size: 40px; }
.td-kpi-sub { font-size: 13px; color: var(--ink-3); }
.td-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.td-delta.is-up { color: var(--good); background: var(--good-bg); }
.td-delta.is-down { color: var(--bad); background: var(--bad-bg); }
.td-delta.is-flat { color: var(--ink-3); background: var(--card-2); }
.td-minis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.td-mini { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.td-mini span { display: block; font-size: 12.5px; color: var(--ink-3); font-weight: 600; }
.td-mini strong { display: block; font-size: 18px; margin-top: 2px; }
.td-mini.is-warn strong { color: var(--warn); }
.td-mini.is-bad strong { color: var(--bad); }
.td-mini.is-good strong { color: var(--good); }

/* ---------- Board ---------- */
.td-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.td-col { background: var(--card-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
html[data-theme="dark"] .td-col { background: #0c1424; }
.td-col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 6px 2px; }
.td-col-head h3 { font-size: 15px; display: flex; align-items: center; gap: 8px; }
.td-count { min-width: 26px; height: 24px; padding: 0 8px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 13px; font-weight: 700; background: var(--card); border: 1px solid var(--line); }
.td-col-list { display: flex; flex-direction: column; gap: 10px; max-height: 640px; overflow-y: auto; padding: 2px; }
.td-empty { text-align: center; color: var(--ink-3); font-size: 14px; padding: 22px 8px; border: 1px dashed var(--line); border-radius: 12px; }
.td-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.td-dot.s-new { background: #2e90fa; }
.td-dot.s-preparing { background: #f79009; }
.td-dot.s-on-route { background: #7a5af8; }
.td-dot.s-delivered { background: #12b76a; }

.td-order {
	background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px;
	display: flex; flex-direction: column; gap: 8px; cursor: pointer; text-align: left;
	transition: border-color .15s ease, box-shadow .15s ease;
}
.td-order:hover { border-color: var(--axis); box-shadow: 0 6px 16px rgba(16,24,40,.08); }
.td-order.is-fresh { animation: td-flash 2.4s ease 1; }
@keyframes td-flash { 0%, 40% { box-shadow: 0 0 0 3px rgba(46,144,250,.45); } 100% { box-shadow: none; } }
.td-order-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.td-order-no { font-weight: 700; font-size: 15px; }
.td-order-time { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }
.td-order-name { font-weight: 600; font-size: 15px; }
.td-order-line { font-size: 13.5px; color: var(--ink-2); display: flex; gap: 6px; align-items: flex-start; }
.td-order-line .td-icon { width: 16px; height: 16px; margin-top: 2px; color: var(--ink-3); }
.td-order-items { font-size: 13.5px; color: var(--ink); background: var(--card-2); border-radius: 10px; padding: 8px 10px; }
html[data-theme="dark"] .td-order-items { background: #0d1628; }
.td-order-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.td-order-total { font-weight: 700; font-size: 16px; }
.td-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.td-badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--card-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.td-badge.b-paid { background: var(--good-bg); color: var(--good); border-color: transparent; }
.td-badge.b-unpaid { background: var(--warn-bg); color: var(--warn); border-color: transparent; }
.td-badge.b-pickup { background: var(--violet-bg); color: var(--violet); border-color: transparent; }
.td-badge.b-cancel { background: var(--bad-bg); color: var(--bad); border-color: transparent; }
.td-order-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.td-order-actions .td-btn { flex: 1 1 auto; }
.td-btn-paid { background: var(--good-bg); border-color: color-mix(in srgb, var(--good) 45%, transparent); color: var(--good); }
.td-btn-paid:hover { background: color-mix(in srgb, var(--good) 18%, var(--card)); }
.td-link-btn { margin-left: 6px; padding: 2px 0; border: 0; background: none; color: var(--bad); font: inherit; font-size: 13px; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.td-link-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.td-fee-hint { font-size: 12px; color: var(--ink-3); }
.td-fee-hint .td-link-btn { color: var(--accent); font-size: 12px; margin-left: 4px; }
.td-col-tools { display: inline-flex; align-items: center; gap: 6px; }
.td-col-tools .td-btn-sm { min-height: 28px; padding: 3px 8px; font-size: 12px; }
.td-confirm { width: min(460px, 100%); gap: 14px; }
.td-confirm-sum { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line); }
.td-confirm-sum span { color: var(--ink-2); font-size: 14px; }
.td-confirm-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
@media (max-width: 520px) { .td-confirm-actions .td-btn { flex: 1 1 100%; } }
.td-note { font-size: 13px; color: var(--warn); background: var(--warn-bg); border-radius: 10px; padding: 6px 10px; }
.td-board-tabs { display: none; }
.td-unpaid { margin-top: 2px; }
.td-unpaid summary { cursor: pointer; font-size: 14px; color: var(--ink-2); font-weight: 600; padding: 6px 2px; }
.td-unpaid-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; margin-top: 8px; }

/* ---------- Charts ---------- */
.td-chart { position: relative; width: 100%; }
.td-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.td-chart .grid line { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
.td-chart .axis line { stroke: var(--axis); stroke-width: 1; shape-rendering: crispEdges; }
.td-chart text { fill: var(--ink-3); font-size: 12px; font-family: var(--font); }
.td-chart .bar { fill: var(--accent); }
.td-chart .bar.is-dim { opacity: .45; }
.td-chart .hit { fill: transparent; cursor: crosshair; }
.td-chart .hit:hover + .bar, .td-chart .band:hover .bar { opacity: 1; }
.td-chart .val { fill: var(--ink-2); font-weight: 700; }
.td-tip {
	position: absolute; pointer-events: none; z-index: 5; min-width: 150px;
	background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 12px;
	padding: 10px 12px; box-shadow: 0 10px 28px rgba(16,24,40,.18); font-size: 13px; line-height: 1.45;
	transform: translate(-50%, calc(-100% - 10px)); opacity: 0; transition: opacity .1s ease;
}
.td-tip.is-on { opacity: 1; }
.td-tip b { display: block; font-size: 14px; margin-bottom: 2px; }
.td-tip .row { display: flex; justify-content: space-between; gap: 14px; }
.td-tip .row span { color: var(--ink-3); }

.td-bars { display: flex; flex-direction: column; gap: 12px; }
.td-barrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; }
.td-barrow-name { font-size: 14px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-barrow-val { font-size: 14px; font-weight: 700; text-align: right; white-space: nowrap; }
.td-barrow-track { grid-column: 1 / -1; height: 10px; border-radius: 0 4px 4px 0; background: transparent; position: relative; }
.td-barrow-fill { height: 10px; border-radius: 0 4px 4px 0; background: var(--accent); min-width: 2px; }
.td-barrow-sub { grid-column: 1 / -1; font-size: 12.5px; color: var(--ink-3); margin-top: -2px; }

/* ---------- Tables ---------- */
.td-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 12px; border: 1px solid var(--line); }
.td-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.td-table th { text-align: left; font-size: 12.5px; font-weight: 700; color: var(--ink-3); background: var(--card-2); padding: 10px 12px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.td-table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.td-table tr:last-child td { border-bottom: 0; }
.td-table .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.td-table tbody tr.is-click { cursor: pointer; }
.td-table tbody tr.is-click:hover td { background: var(--card-2); }
.td-table tfoot td { font-weight: 700; background: var(--card-2); border-top: 1px solid var(--line); }
.td-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.td-tools { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.td-tools .td-input, .td-tools .td-select { min-height: 38px; width: auto; font-size: 14px; }
.td-tools .td-input { min-width: 220px; }

/* ---------- Drawer & modal ---------- */
.td-overlay { position: fixed; inset: 0; z-index: 60; background: rgba(6, 11, 22, .5); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); display: flex; justify-content: flex-end; }
.td-overlay.is-center { justify-content: center; align-items: center; padding: 16px; }
.td-drawer { width: min(520px, 100%); height: 100%; background: var(--card); overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 14px; box-shadow: -10px 0 40px rgba(0,0,0,.2); }
.td-modal { width: min(720px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; background: var(--card); border-radius: 20px; padding: 22px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
/* The drawer and modal scroll as a whole. Without this, a long notes history squeezed the
   items table (a scroll container, so it may shrink to 0) down to its header row. */
.td-drawer > *, .td-modal > * { flex-shrink: 0; }
.td-x { margin-left: auto; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-size: 22px; line-height: 1; color: var(--ink-2); }
.td-dl { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; font-size: 14.5px; margin: 0; }
.td-dl dt { color: var(--ink-3); }
.td-dl dd { margin: 0; font-weight: 500; word-break: break-word; }
.td-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.td-form-grid .full { grid-column: 1 / -1; }
.td-prodpick { display: flex; flex-direction: column; gap: 8px; }
.td-prodrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; }
.td-prodrow.is-on { border-color: var(--accent); background: var(--accent-wash); }
.td-prodrow b { display: block; font-size: 14.5px; }
.td-prodrow small { color: var(--ink-3); font-size: 12.5px; }
.td-stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--card); }
.td-stepper button { width: 38px; height: 38px; border: 0; background: transparent; font-size: 18px; cursor: pointer; color: var(--ink); }
.td-stepper input { width: 46px; height: 38px; border: 0; text-align: center; background: transparent; font-weight: 700; -moz-appearance: textfield; }
.td-stepper input::-webkit-outer-spin-button, .td-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.td-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.td-chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 7px 14px; font-weight: 600; font-size: 14px; cursor: pointer; }
.td-chip[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
html[data-theme="dark"] .td-chip[aria-pressed="true"] { background: #3987e5; border-color: #3987e5; color: #06101f; }
.td-sum { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px; border-radius: 14px; background: var(--card-2); font-size: 15px; }
.td-sum strong { font-size: 22px; }

/* Toasts */
.td-toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; width: min(440px, calc(100% - 24px)); }
.td-toast { background: #101828; color: #fff; border-radius: 12px; padding: 12px 16px; font-size: 14.5px; font-weight: 600; box-shadow: 0 12px 30px rgba(0,0,0,.25); display: flex; gap: 10px; align-items: center; width: 100%; }
.td-toast.is-good { background: #054f31; }
.td-toast.is-bad { background: #7a271a; }
.td-toast button { margin-left: auto; background: rgba(255,255,255,.14); border: 0; color: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; font-weight: 700; }

/* ---------- Report ---------- */
.td-view-report { background: #e9edf3; }
html[data-theme="dark"] .td-view-report { background: var(--bg); }
.td-report-bar { position: sticky; top: 0; z-index: 20; background: var(--card); border-bottom: 1px solid var(--line); }
.td-report-bar .td-top-in { gap: 10px; }
.td-paper { width: min(210mm, calc(100% - 24px)); margin: 20px auto 60px; background: #fff; color: #101828; border-radius: 10px; box-shadow: 0 10px 40px rgba(16,24,40,.12); padding: 16mm 14mm; }
.td-paper { --ink: #101828; --ink-2: #475467; --ink-3: #667085; --line: #e4e7ec; --line-2: #eef1f5; --card: #fff; --card-2: #f8fafc; --accent: #2a78d6; --grid: #e9ecf1; --axis: #c3c8d1; --good: #067647; --good-bg: #ecfdf3; --bad: #b42318; --bad-bg: #fef3f2; color-scheme: light; }
.td-paper .td-chart text { fill: #667085; }
.td-rp-head { display: flex; align-items: center; gap: 14px; border-bottom: 2px solid #002d62; padding-bottom: 12px; margin-bottom: 18px; }
.td-rp-head img { width: 58px; height: 58px; object-fit: contain; }
.td-rp-head h1 { font-size: 22px; color: #002d62; }
.td-rp-head p { margin: 2px 0 0; font-size: 13px; color: #475467; }
.td-rp-head .td-rp-meta { margin-left: auto; text-align: right; font-size: 12px; color: #667085; }
.td-rp-section { margin: 0 0 20px; break-inside: avoid; page-break-inside: avoid; }
.td-rp-section h2 { font-size: 15px; color: #002d62; margin-bottom: 10px; text-transform: none; }
.td-rp-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.td-rp-kpi { border: 1px solid #e4e7ec; border-radius: 10px; padding: 10px 12px; }
.td-rp-kpi span { display: block; font-size: 11.5px; color: #667085; font-weight: 600; }
.td-rp-kpi strong { display: block; font-size: 19px; margin: 2px 0; }
.td-rp-kpi em { font-style: normal; font-size: 11.5px; font-weight: 700; }
.td-rp-kpi em.is-up { color: #067647; } .td-rp-kpi em.is-down { color: #b42318; } .td-rp-kpi em.is-flat { color: #667085; }
.td-paper .td-table { font-size: 12px; }
.td-paper .td-table th { font-size: 11px; padding: 7px 8px; background: #f8fafc; color: #475467; }
.td-paper .td-table td { padding: 6px 8px; }
.td-paper .td-table-wrap { border-color: #e4e7ec; }
.td-rp-two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.td-rp-foot { margin-top: 24px; padding-top: 10px; border-top: 1px solid #e4e7ec; font-size: 11px; color: #98a2b3; display: flex; justify-content: space-between; }
.td-print-hint { font-size: 13px; color: var(--ink-3); }

@page { size: A4; margin: 12mm; }
@media print {
	html, body { background: #fff !important; }
	.td-report-bar, .td-toasts, .td-no-print { display: none !important; }
	.td-paper { width: auto; margin: 0; padding: 0; box-shadow: none; border-radius: 0; }
	.td-table-wrap { overflow: visible; border: 1px solid #e4e7ec; }
	.td-table tr { break-inside: avoid; page-break-inside: avoid; }
	.td-rp-section.is-break { break-before: page; page-break-before: always; }
	* { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- Driver slip (Хэвлэх on the board / order drawer) ---------- */
#td-print { display: none; }
.tp-slip { color: #000; background: #fff; font: 13px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; border: 1.5px dashed #000; border-radius: 6px; padding: 12px 14px; margin: 0 0 8mm; break-inside: avoid; page-break-inside: avoid; }
.tp-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; border-bottom: 2px solid #000; padding-bottom: 6px; }
.tp-head div { display: flex; flex-direction: column; }
.tp-brand { font-size: 18px; letter-spacing: .5px; }
.tp-no { font-size: 26px; font-weight: 800; line-height: 1; }
.tp-meta { font-size: 11px; margin: 4px 0 8px; }
.tp-pay { border: 2px solid #000; border-radius: 6px; padding: 6px 10px; font-size: 18px; font-weight: 800; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.tp-pay small { font-size: 12px; font-weight: 600; }
.tp-pay.is-collect { background: #000; color: #fff; }
.tp-who { display: grid; grid-template-columns: 96px 1fr; gap: 3px 10px; margin: 0 0 8px; }
.tp-who dt { font-size: 12px; }
.tp-who dd { margin: 0; font-weight: 600; }
.tp-who .tp-big { font-size: 17px; font-weight: 800; }
.tp-note { border: 1px solid #000; border-radius: 4px; padding: 5px 8px; margin-bottom: 8px; font-size: 14px; }
.tp-items { width: 100%; border-collapse: collapse; }
.tp-items th, .tp-items td { padding: 3px 4px; border-bottom: 1px solid #999; text-align: left; }
.tp-items th { font-size: 11px; text-transform: uppercase; border-bottom: 1.5px solid #000; }
.tp-items .r { text-align: right; white-space: nowrap; }
.tp-items tfoot td { border-bottom: 0; font-size: 12px; }
.tp-items .tp-total td { font-size: 15px; font-weight: 800; border-top: 1.5px solid #000; }
.tp-sign { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 14px; font-size: 12px; }
@media print {
	body.td-printing > *:not(#td-print) { display: none !important; }
	body.td-printing #td-print { display: block; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
	.td-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.td-grid-2-1 { grid-template-columns: minmax(0, 1fr); }
	.td-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
	/* Phone/tablet: orders first, numbers after; the top bar scrolls away instead of covering a quarter of the screen. */
	.td-main > #td-board-card { order: -1; }
	.td-top { position: static; }
	.td-board { grid-template-columns: minmax(0, 1fr); }
	.td-board-tabs { display: flex; }
	.td-board .td-col { display: none; }
	.td-board .td-col.is-active { display: flex; }
	.td-col-list { max-height: none; }
}
@media (max-width: 640px) {
	body { font-size: 15px; }
	.td-top { position: static; }
	.td-top-in { gap: 10px; }
	.td-brand { width: 100%; }
	.td-top-actions { width: 100%; justify-content: space-between; }
	.td-top-actions .td-btn { padding: 8px 10px; }
	.td-live span { display: none; }
	.td-kpis .td-kpi:last-child { grid-column: 1 / -1; }
	.td-custom { width: 100%; }
	.td-custom input { flex: 1; min-width: 0; }
	.td-top-in, .td-rangebar, .td-main { padding-left: 16px; padding-right: 16px; }
	.td-brand small { display: none; }
	.td-top-actions .td-btn-label { display: none; }
	.td-kpi-value { font-size: 24px; }
	.td-kpi.is-hero { grid-column: 1 / -1; }
	.td-kpi.is-hero .td-kpi-value { font-size: 34px; }
	.td-grid-3 { grid-template-columns: minmax(0, 1fr); }
	.td-form-grid { grid-template-columns: minmax(0, 1fr); }
	.td-card { padding: 14px; }
	.td-dl { grid-template-columns: 100px 1fr; }
	.td-paper { padding: 18px 14px; }
	.td-rp-kpis { grid-template-columns: repeat(2, 1fr); }
	.td-rp-two { grid-template-columns: 1fr; }
	.td-rp-head { flex-wrap: wrap; }
	.td-rp-head .td-rp-meta { margin-left: 0; text-align: left; width: 100%; }
	.td-tools .td-input { min-width: 0; flex: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- v1.1: sign-up, order editing, team ---------- */
.td-small { font-size: 13px !important; }
.td-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 12px; background: var(--card-2); border: 1px solid var(--line); margin: 6px 0 8px; }
.td-tabs button { border: 0; background: transparent; padding: 9px; border-radius: 9px; font-weight: 700; font-size: 15px; color: var(--ink-3); cursor: pointer; }
.td-tabs button[aria-selected="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(16,24,40,.12); }
html[data-theme="dark"] .td-tabs button[aria-selected="true"] { background: #1c2742; }
.td-pane { display: flex; flex-direction: column; gap: 10px; }
.td-login[data-tab="login"] .td-pane[data-pane="signup"],
.td-login[data-tab="signup"] .td-pane[data-pane="login"] { display: none; }
.td-login-card .td-pane label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.td-login-card input[type="email"], .td-login-card input[type="tel"] {
	min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); color: var(--ink); font-size: 16px; }
.td-login-card .td-btn { margin-top: 4px; }
.td-hp { position: absolute !important; left: -9999px !important; width: 1px; height: 1px; overflow: hidden; }

.td-drawer-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.td-drawer-foot { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; padding-top: 12px; border-top: 1px solid var(--line); margin-top: 4px; }
.td-notes h3 { font-size: 15px; margin: 4px 0 8px; }
.td-notes ol { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 280px; overflow-y: auto; }
.td-notes li { background: var(--card-2); border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; }
.td-notes li.is-customer { border-color: color-mix(in srgb, var(--info) 35%, var(--line)); }
.td-note-meta { font-size: 12px; color: var(--ink-3); margin-bottom: 2px; }
.td-note-text { font-size: 14px; white-space: normal; word-break: break-word; }
.td-note-add { display: flex; gap: 8px; align-items: flex-end; }
.td-note-add .td-textarea { min-height: 44px; }
.td-warn { background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 10px 12px; font-size: 14px; font-weight: 600; }

.td-team section { display: flex; flex-direction: column; gap: 8px; }
.td-team h3, .td-modal h3 { font-size: 15px; margin: 6px 0 2px; }
.td-member { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.td-member-main { display: flex; flex-direction: column; min-width: 0; }
.td-member-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.td-select-sm { min-height: 34px !important; width: auto !important; padding: 4px 8px !important; font-size: 13px !important; }
.td-has-badge { position: relative; }
.td-dot-badge { position: absolute; top: 4px; right: 4px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 999px; background: #f04438; color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.td-dot-badge[hidden] { display: none; }
.td-login { width: 100%; display: flex; justify-content: center; }
