:root {
  --bg: #f5f7f8;
  --surface: #fff;
  --surface-2: #edf3f1;
  --ink: #16211f;
  --muted: #63716d;
  --line: #dce4e1;
  --accent: #116b5b;
  --accent-2: #ca6f1e;
  --danger: #b42318;
  --warning: #a15c07;
  --good: #187046;
  --shadow: 0 16px 40px rgba(22, 33, 31, 0.08);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-family: Segoe UI, Arial, sans-serif; }
body.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: #142320; }
a { color: inherit; text-decoration: none; }
.table-link { color: var(--accent); font-weight: 700; }
.link-button { border: 0; padding: 0; background: transparent; color: var(--accent); font: inherit; font-weight: 700; cursor: pointer; }
button, input, select, textarea { font: inherit; }

.app-shell { display: grid; grid-template-columns: 280px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: #142320; color: #f6fbf9; padding: 22px; display: flex; flex-direction: column; gap: 24px; }
.brand { display: grid; grid-template-columns: 88px 1fr; gap: 12px; align-items: center; }
.brand-mark { width: 64px; height: 52px; display: grid; place-items: center; border-radius: 8px; background: rgba(255,255,255,.08); overflow: hidden; }
.client-brand-mark { width: 88px; height: 54px; background: #fff; }
.brand-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }
.brand strong, .brand small, .sidebar-panel span { display: block; }
.brand small, .sidebar-panel small, .sidebar-panel span { color: #b7c7c2; font-size: 12px; line-height: 1.4; }
.provider-brand { border: 1px solid rgba(255,255,255,.12); border-radius: 8px; padding: 12px; display: grid; gap: 6px; justify-items: start; background: rgba(255,255,255,.05); }
.provider-brand img { width: 96px; max-height: 70px; object-fit: contain; display: block; }
.provider-brand a { color: #dbe8e4; font-size: 12px; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.nav { display: grid; gap: 8px; }
.nav a { border-radius: 8px; color: #dbe8e4; padding: 12px 14px; }
.nav a:hover { background: #213a35; color: #fff; }
.sidebar-panel { margin-top: auto; border: 1px solid rgba(255,255,255,.12); border-radius: 8px; padding: 16px; background: rgba(255,255,255,.05); }
.sidebar-panel strong { display: block; margin: 8px 0 4px; font-size: 22px; }

.main { padding: 24px; min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; justify-content: space-between; gap: 18px; margin: -24px -24px 22px; padding: 16px 24px; background: rgba(245,247,248,.96); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px); }
.header-nav { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: flex-end; max-width: 720px; }
.header-nav a { border-radius: 8px; padding: 8px 10px; background: var(--surface-2); color: var(--ink); font-size: 13px; font-weight: 700; white-space: nowrap; }
.eyebrow { margin: 0 0 4px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.welcome-line { margin: 0 0 4px; color: var(--accent); font-size: 13px; font-weight: 700; }
h1, h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 30px; }
h2 { font-size: 18px; }

.primary-action, .ghost-action { border: 0; border-radius: 8px; min-height: 40px; display: inline-flex; align-items: center; justify-content: center; padding: 0 16px; font-weight: 700; }
.primary-action { background: var(--accent); color: #fff; }
.ghost-action { background: var(--surface-2); color: var(--ink); }
.notice { background: #e8f6ef; color: var(--good); border: 1px solid #bfe5cf; border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }
.ticket-alert { position: sticky; top: 12px; z-index: 4; margin-bottom: 16px; border: 1px solid #f0b870; border-left: 5px solid var(--accent-2); border-radius: 8px; background: #fff8ec; padding: 14px; display: flex; justify-content: space-between; align-items: center; gap: 14px; box-shadow: var(--shadow); }
.ticket-alert.late-alert { border-color: #ef9a9a; border-left-color: var(--danger); background: #fff1ef; }
.ticket-alert strong, .ticket-alert span { display: block; }
.ticket-alert span { color: var(--muted); font-size: 13px; margin-top: 2px; }
.login-card { width: min(760px, 100%); background: #fff; border-radius: 8px; padding: 30px; box-shadow: 0 30px 70px rgba(0,0,0,.28); display: grid; gap: 20px; }
.login-logo-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 22px; margin-bottom: 12px; }
.login-brand img { object-fit: contain; display: block; }
.client-login-logo { width: min(340px, 100%); max-height: 140px; justify-self: start; }
.mab-login-brand { display: grid; gap: 5px; justify-items: center; justify-self: end; }
.mab-login-logo { width: 118px; max-height: 90px; }
.mab-login-brand a { color: var(--accent); font-size: 12px; font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.login-client-name { margin: 0 0 6px; color: var(--accent); font-size: 18px; font-weight: 800; letter-spacing: 0; }
.login-card h1 { font-size: 30px; max-width: 620px; }
.login-copy { color: var(--muted); line-height: 1.55; margin: 8px 0 0; }
.demo-logins { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: grid; gap: 4px; color: var(--muted); font-size: 13px; }
.demo-logins strong { color: var(--ink); }
.validation { color: var(--danger); font-weight: 700; }
.attachment-dialog { border: 0; padding: 0; background: transparent; width: min(920px, calc(100vw - 32px)); }
.attachment-dialog::backdrop { background: rgba(20, 35, 32, .58); }
.attachment-modal { background: #fff; border-radius: 8px; padding: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.attachment-preview-frame { height: min(680px, 72vh); border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; overflow: auto; }
.attachment-preview-frame img { display: block; max-width: 100%; max-height: 100%; object-fit: contain; }
.attachment-preview-frame iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.attachment-download { text-align: center; display: grid; gap: 14px; justify-items: center; color: var(--muted); }
.attachment-list { display: flex; flex-wrap: wrap; gap: 8px; min-width: 120px; }
.attachment-list .link-button { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--surface-2); }
.page-preview-dialog { border: 0; padding: 0; background: transparent; width: min(1120px, calc(100vw - 32px)); }
.page-preview-dialog::backdrop { background: rgba(20, 35, 32, .58); }
.page-preview-modal { background: #fff; border-radius: 8px; padding: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.page-preview-frame { display: block; width: 100%; height: min(760px, 78vh); border: 1px solid var(--line); border-radius: 8px; background: #fff; }
body.modal-page { background: #fff; min-height: auto; }
body.modal-page .sidebar,
body.modal-page .topbar,
body.modal-page .sidebar-panel { display: none; }
body.modal-page .app-shell { display: block; min-height: auto; }
body.modal-page .main { padding: 16px; }
body.modal-page .kpi,
body.modal-page .panel,
body.modal-page .table-panel,
body.modal-page .metric-card { box-shadow: none; }
.assignment-dialog { border: 0; padding: 0; background: transparent; width: min(980px, calc(100vw - 32px)); }
.assignment-dialog::backdrop { background: rgba(20, 35, 32, .58); }
.assignment-modal { background: #fff; border-radius: 8px; padding: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.3); }
.assignment-search { display: grid; grid-template-columns: minmax(260px, 1fr) 220px auto; align-items: end; gap: 12px; margin-bottom: 14px; }
.assignment-search label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.assignment-search input { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.assignment-search span { color: var(--muted); font-size: 13px; }
.technician-picker { max-height: min(520px, 58vh); overflow: auto; display: grid; gap: 8px; padding-right: 4px; }
.technician-option { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fff; }
.technician-option.same-city { border-color: #92d3bd; background: #f0fbf6; }
.technician-option.usual-client { border-color: #f0b870; background: #fff8ec; }
.technician-option.same-city.usual-client { border-color: var(--accent); background: #e8f6ef; }
.technician-option strong, .technician-option small, .technician-option em { display: block; }
.technician-option small { color: var(--muted); font-size: 12px; margin-top: 2px; }
.technician-option em { color: var(--accent); font-size: 12px; font-style: normal; font-weight: 700; margin-top: 4px; }
.modal-actions { display: flex; justify-content: end; gap: 10px; margin-top: 14px; }
.customer-entry-actions { flex-wrap: wrap; align-items: center; max-width: 100%; min-width: 0; }
.customer-entry-actions .ghost-action,
.customer-entry-actions .primary-action { white-space: nowrap; }
.customer-entry-actions .upload-inline-form { max-width: 100%; }
.customer-import-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.import-box { border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); padding: 12px; display: grid; gap: 10px; align-content: start; }
.import-box strong { display: block; }
.import-box .ghost-action,
.import-box .primary-action { width: 100%; }
.import-box .upload-inline-form { display: grid; grid-template-columns: minmax(0, 1fr); }
.import-box .upload-inline-form input { width: 100%; min-width: 0; }
.rows-per-page-control { display: inline-grid; grid-template-columns: auto 90px; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.rows-per-page-control select { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }
.pagination-bar { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding-top: 12px; }
.pagination-bar span { color: var(--muted); font-size: 13px; }

.kpi-grid, .card-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.asset-dashboard-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.asset-dashboard-grid .kpi { margin: 0; padding: 14px; }
.asset-dashboard-grid .kpi strong { font-size: 28px; }
.rent-assignment-position { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.rent-assignment-position .kpi { margin: 0; padding: 12px; }
.rent-assignment-position .kpi strong { font-size: 24px; }
.card-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split-layout { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(320px, .9fr); gap: 16px; margin-bottom: 16px; }
.kpi, .panel, .table-panel, .metric-card { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.kpi, .panel, .table-panel, .metric-card { padding: 18px; }
.kpi span, .kpi em { display: block; color: var(--muted); font-style: normal; }
.kpi strong { display: block; margin: 8px 0; font-size: 32px; }
.good { color: var(--good) !important; }
.warn { color: var(--warning) !important; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; }
.stack { display: grid; gap: 10px; }

.list-card { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 14px; display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.list-card strong, .metric-card strong { display: block; }
.list-card span, .metric-card span, td small { display: block; color: var(--muted); line-height: 1.45; font-size: 13px; }
.badge { align-self: start; border-radius: 999px; padding: 5px 9px; background: var(--surface-2); color: var(--ink); font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge.critical, .badge.high { background: #fde8e5; color: var(--danger); }
.badge.medium { background: #fff3db; color: var(--warning); }
.badge.resolved, .badge.closed { background: #e8f6ef; color: var(--good); border: 1px solid #bfe5cf; }
.badge.open { background: #eef3f1; color: #4f625d; border: 1px solid #dce4e1; }
.badge.assigned { background: #e8f6ef; color: var(--accent); border: 1px solid #bfe5cf; }
.badge.inprogress { background: #eaf4fd; color: #2f80c2; border: 1px solid #b8d9f4; }
.badge.pendingparts { background: #fff3db; color: var(--warning); border: 1px solid #f3d49d; }

.meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.meter i { display: block; height: 100%; background: var(--accent); }
.mini-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.mini-stats div { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.mini-stats strong, .mini-stats span { display: block; }
.mini-stats span { color: var(--muted); font-size: 12px; }
.cost-comparison-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 14px 0; }
.cost-comparison-grid section { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fff; }
.cost-comparison-grid h3 { margin: 0 0 10px; font-size: 14px; }
.comparison-list { display: grid; gap: 8px; max-height: 180px; overflow: auto; }
.comparison-list div { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.comparison-list div:last-child { border-bottom: 0; padding-bottom: 0; }
.comparison-list span { color: var(--muted); font-size: 13px; }
.comparison-list strong { font-size: 13px; }
.comparison-list small { grid-column: 1 / -1; color: var(--muted); }

.region-map { position: relative; min-height: 280px; border-radius: 8px; overflow: hidden; background: linear-gradient(145deg, rgba(17,107,91,.12), rgba(202,111,30,.16)), #eaf1ef; border: 1px solid var(--line); }
.region-map::before { content: ""; position: absolute; inset: 28px 55px 22px 70px; background: #d5e2de; clip-path: polygon(46% 0, 74% 12%, 89% 33%, 79% 54%, 70% 91%, 39% 100%, 23% 74%, 12% 45%, 0 22%); }
.region-map span { position: absolute; left: var(--x); top: var(--y); width: 46px; height: 46px; transform: translate(-50%, -50%); border: 3px solid #fff; border-radius: 50%; background: var(--accent-2); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 800; box-shadow: 0 8px 20px rgba(0,0,0,.18); }
.technician-map { min-height: 390px; }
.map-pin { position: absolute; left: var(--x); top: var(--y); min-width: 66px; min-height: 50px; transform: translate(-50%, -50%); border: 3px solid #fff; border-radius: 8px; background: #60726d; color: #fff; display: grid; place-items: center; padding: 6px 8px; text-align: center; box-shadow: 0 8px 20px rgba(0,0,0,.18); z-index: 2; }
.map-pin.active { background: var(--accent-2); }
.map-pin strong, .map-pin small { display: block; line-height: 1.1; }
.map-pin strong { font-size: 18px; }
.map-pin small { font-size: 11px; }
.help-steps { display: grid; gap: 10px; }
.help-steps article { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fff; }
.help-steps strong, .help-steps span { display: block; }
.help-steps span { margin-top: 4px; color: var(--muted); line-height: 1.45; font-size: 13px; }
.help-visual-flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.help-visual-flow article { position: relative; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 14px; min-height: 230px; }
.help-visual-flow article:not(:last-child)::after { content: ""; position: absolute; right: -13px; top: 86px; width: 24px; height: 2px; background: var(--accent); z-index: 2; }
.help-visual-flow article:not(:last-child)::before { content: ""; position: absolute; right: -15px; top: 80px; border-left: 9px solid var(--accent); border-top: 7px solid transparent; border-bottom: 7px solid transparent; z-index: 3; }
.help-visual-flow strong, .help-visual-flow p { display: block; }
.help-visual-flow p { margin: 8px 0 0; color: var(--muted); line-height: 1.45; font-size: 13px; }
.help-picture { height: 94px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); margin-bottom: 12px; position: relative; overflow: hidden; }
.help-picture span, .help-picture::before, .help-picture::after { content: ""; position: absolute; display: block; }
.machine-picture span { left: 34px; top: 20px; width: 82px; height: 52px; border: 4px solid var(--accent); border-radius: 8px; background: #fff; }
.machine-picture::before { left: 46px; top: 34px; width: 58px; height: 8px; background: #d5e2de; }
.machine-picture::after { left: 52px; top: 54px; width: 46px; height: 10px; border-radius: 999px; background: var(--accent-2); }
.complaint-picture span { left: 40px; top: 18px; width: 72px; height: 58px; border-radius: 8px; background: #fff; border: 4px solid var(--accent); }
.complaint-picture::before { left: 56px; top: 30px; width: 40px; height: 5px; background: #d5e2de; box-shadow: 0 13px 0 #d5e2de, 0 26px 0 #d5e2de; }
.complaint-picture::after { right: 32px; bottom: 16px; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-2); }
.ticket-picture span { left: 28px; top: 22px; width: 96px; height: 50px; border-radius: 8px; background: #fff; border: 4px solid var(--accent); }
.ticket-picture::before { left: 42px; top: 38px; width: 66px; height: 6px; background: #d5e2de; box-shadow: 0 14px 0 #d5e2de; }
.ticket-picture::after { right: 34px; top: 32px; width: 16px; height: 16px; border-radius: 50%; background: var(--good); }
.feedback-picture span { left: 34px; top: 24px; width: 82px; height: 42px; border-radius: 8px; background: #fff; border: 4px solid var(--accent); }
.feedback-picture::before { left: 52px; top: 38px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent-2); box-shadow: 20px 0 0 var(--accent-2), 40px 0 0 var(--accent-2); }
.feedback-picture::after { left: 72px; top: 65px; border-top: 14px solid var(--accent); border-left: 10px solid transparent; }
.progress-picture span { left: 28px; top: 22px; width: 96px; height: 50px; border-radius: 999px; background: #fff; border: 4px solid var(--accent); }
.progress-picture::before { left: 42px; top: 40px; width: 24px; height: 8px; border-radius: 999px; background: var(--good); box-shadow: 30px 0 0 var(--accent-2); }
.progress-picture::after { right: 33px; top: 33px; width: 18px; height: 18px; border: 4px solid #d5e2de; border-top-color: var(--accent); border-radius: 50%; }
.parts-picture span { left: 32px; top: 24px; width: 34px; height: 34px; border: 4px solid var(--accent); border-radius: 8px; background: #fff; box-shadow: 44px 0 0 #fff, 44px 0 0 4px var(--accent); }
.parts-picture::before { left: 42px; top: 34px; width: 14px; height: 14px; background: var(--accent-2); box-shadow: 44px 0 0 var(--accent-2); }
.parts-picture::after { left: 50px; top: 64px; width: 54px; height: 8px; border-radius: 999px; background: #d5e2de; }
.expense-picture span { left: 36px; top: 18px; width: 78px; height: 58px; border-radius: 8px; background: #fff; border: 4px solid var(--accent); }
.expense-picture::before { left: 50px; top: 32px; width: 50px; height: 5px; background: #d5e2de; box-shadow: 0 13px 0 #d5e2de, 0 26px 0 #d5e2de; }
.expense-picture::after { right: 31px; bottom: 14px; width: 24px; height: 24px; border-radius: 8px; background: var(--accent-2); }
.repair-picture span { left: 34px; top: 25px; width: 82px; height: 42px; border: 4px solid var(--accent); border-radius: 8px; background: #fff; }
.repair-picture::before { left: 52px; top: 39px; width: 46px; height: 7px; border-radius: 999px; background: #d5e2de; }
.repair-picture::after { right: 30px; top: 24px; width: 27px; height: 27px; border: 5px solid var(--accent-2); border-left-color: transparent; border-radius: 50%; transform: rotate(-35deg); }
.status-lane { display: grid; gap: 10px; }
.status-lane div { display: grid; grid-template-columns: auto 110px 1fr; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #fff; }
.status-lane small, .source-grid small { color: var(--muted); line-height: 1.35; }
.status-dot { width: 16px; height: 16px; border-radius: 50%; display: inline-block; }
.status-dot.open { background: #8aa09b; }
.status-dot.assigned { background: var(--accent); }
.status-dot.progress { background: #2f80c2; }
.status-dot.parts { background: var(--warning); }
.status-dot.resolved { background: var(--good); }
.workflow-panel { border-color: #bfe5cf; background: linear-gradient(180deg, #ffffff 0%, #f3faf7 100%); }
.workflow-heading { align-items: flex-start; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.workflow-intro { margin: 6px 0 0; color: var(--muted); line-height: 1.45; max-width: 650px; }
.workflow-legend { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.workflow-legend span { border: 1px solid var(--line); border-radius: 999px; padding: 7px 10px; background: #fff; color: var(--ink); font-size: 12px; font-weight: 800; display: inline-flex; gap: 6px; align-items: center; white-space: nowrap; }
.workflow-legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.legend-start { background: var(--accent); }
.legend-branch { background: #2f80c2; }
.legend-ticket { background: var(--accent-2); }
.legend-close { background: var(--good); }
.workflow-scroll { overflow-x: auto; padding: 4px 2px 8px; }
.workflow-chart { min-width: 980px; display: grid; gap: 20px; }
.workflow-row,
.workflow-split,
.workflow-branch-grid { display: grid; gap: 14px; align-items: stretch; }
.workflow-row { grid-template-columns: repeat(4, minmax(170px, 1fr)); }
.workflow-split.three-way { grid-template-columns: repeat(3, minmax(220px, 1fr)); }
.workflow-branch-grid { grid-template-columns: .8fr 1.8fr; }
.ticket-workflow-grid { grid-template-columns: 1fr 1.4fr; }
.workflow-path { border: 1px solid #b9c8c4; border-left: 5px solid var(--accent); border-radius: 8px; padding: 14px; background: #fbfdfc; display: grid; gap: 12px; align-content: start; box-shadow: 0 10px 24px rgba(22,33,31,.06); }
.workflow-path.success-path { border-color: #92d3bd; border-left-color: var(--good); background: #f0fbf6; }
.workflow-path.danger-path { border-color: #efb0aa; border-left-color: var(--danger); background: #fff5f4; }
.workflow-path.create-ticket-path { border-left-color: var(--accent-2); background: #fff8ec; }
.workflow-path.track-ticket-path { border-left-color: #2f80c2; background: #f1f7fc; }
.workflow-node,
.workflow-return { position: relative; min-height: 62px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fff; display: grid; place-items: center; text-align: center; color: var(--ink); font-size: 13px; font-weight: 800; line-height: 1.35; box-shadow: 0 8px 18px rgba(22,33,31,.06); }
.workflow-node:not(:last-child)::after,
.workflow-return:not(:last-child)::after { content: ""; position: absolute; left: calc(50% - 5px); bottom: -12px; border-top: 8px solid var(--accent); border-left: 5px solid transparent; border-right: 5px solid transparent; }
.workflow-row .workflow-node:not(:last-child)::after { left: auto; right: -13px; bottom: calc(50% - 5px); border-left: 8px solid var(--accent); border-top: 5px solid transparent; border-bottom: 5px solid transparent; border-right: 0; }
.login-flow .workflow-node { border-top: 4px solid var(--accent); }
.branch-dashboard-flow .workflow-node { border-top: 4px solid #2f80c2; }
.create-ticket-path .workflow-node { border-top: 4px solid var(--accent-2); }
.track-ticket-path .workflow-node { border-top: 4px solid #2f80c2; }
.workflow-node.decision { border-color: var(--accent-2); background: #fff8ec; font-size: 14px; }
.workflow-node.wide-node { background: #e8f6ef; border-color: #bfe5cf; }
.workflow-return { background: var(--surface-2); color: var(--muted); }
.workflow-label { justify-self: start; border-radius: 999px; padding: 7px 11px; background: var(--accent); color: #fff; font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .04em; box-shadow: 0 8px 16px rgba(17,107,91,.18); }
.danger-path .workflow-label { background: var(--danger); }
.create-ticket-path .workflow-label { background: var(--accent-2); }
.track-ticket-path .workflow-label { background: #2f80c2; }
.status-paths .workflow-label { justify-self: center; }
.status-paths { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.status-paths > div { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.78); padding: 10px; }
.source-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.source-grid article { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fff; display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; align-items: center; }
.source-grid strong { display: block; }
.source-grid small { grid-column: 2; display: block; }
.source-icon { width: 38px; height: 38px; border-radius: 8px; background: var(--surface-2); border: 2px solid var(--accent); position: relative; grid-row: span 2; }
.source-icon::before, .source-icon::after { content: ""; position: absolute; display: block; }
.web-icon::before { left: 7px; top: 10px; width: 20px; height: 14px; border: 3px solid var(--accent); border-radius: 3px; }
.phone-icon::before { left: 10px; top: 6px; width: 16px; height: 25px; border: 3px solid var(--accent); border-radius: 5px; }
.email-icon::before { left: 6px; top: 10px; width: 22px; height: 16px; border: 3px solid var(--accent); border-radius: 3px; }
.email-icon::after { left: 9px; top: 12px; width: 16px; height: 16px; border-left: 3px solid var(--accent); border-bottom: 3px solid var(--accent); transform: rotate(-45deg); }
.chat-icon::before { left: 7px; top: 8px; width: 23px; height: 18px; border: 3px solid var(--accent); border-radius: 8px; }
.chat-icon::after { left: 13px; top: 25px; border-top: 8px solid var(--accent); border-right: 8px solid transparent; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 860px; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; font-size: 14px; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.notes-cell { min-width: 260px; max-width: 420px; color: var(--muted); line-height: 1.45; }
.column-hidden { display: none; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid.compact { grid-template-columns: 1fr; }
.form-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.form-grid input, .form-grid select, .form-grid textarea { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 10px 12px; min-width: 0; }
.field-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.form-grid .check-line { display: flex; grid-template-columns: none; align-items: center; flex-direction: row; color: var(--ink); }
.form-grid .check-line input { width: auto; }
.form-grid .compact-choice { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; }
.form-grid .compact-choice legend { color: var(--muted); font-size: 13px; padding: 0; margin-right: 6px; }
.form-grid .compact-choice .check-line { margin: 0; }
.form-grid textarea { min-height: 96px; resize: vertical; }
.form-grid .wide { grid-column: 1 / -1; }
.field-label { display: block; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
.checkbox-grid, .column-chooser { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.checkbox-grid label, .column-chooser label { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; gap: 8px; align-items: center; color: var(--ink); font-size: 13px; }
.checkbox-grid input, .column-chooser input { width: auto; min-width: 0; }
.machine-import-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.upload-inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.upload-inline-form input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; background: #fff; }
.inline-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.inline-form input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 140px; }
.received-asset-list { display: grid; gap: 10px; }
.received-asset-card { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 12px; }
.received-asset-card summary { cursor: pointer; display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.revenue-tree { display: grid; gap: 10px; }
.revenue-customer, .revenue-branch { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.revenue-customer > summary, .revenue-branch > summary { cursor: pointer; display: grid; grid-template-columns: auto minmax(180px, 1fr) repeat(3, minmax(120px, auto)); gap: 12px; align-items: center; padding: 12px; }
.revenue-branch { margin: 10px 12px; background: var(--surface); }
.revenue-branch .table-scroll { padding: 0 12px 12px; }
.plus-sign { width: 24px; height: 24px; border-radius: 999px; display: inline-grid; place-items: center; background: var(--surface-2); color: var(--accent); font-weight: 800; }
.revenue-customer[open] > summary .plus-sign, .revenue-branch[open] > summary .plus-sign { transform: rotate(45deg); }
.warning-text { display: block; margin-top: 4px; color: #b45309; font-size: 12px; }
.received-asset-card summary span, .received-asset-card summary small { display: block; }
.received-asset-card summary small { color: var(--muted); }
.received-asset-card .form-grid { margin-top: 14px; }
.filter-grid { display: grid; grid-template-columns: minmax(260px, 1fr) 180px 180px auto; gap: 12px; align-items: end; }
.filter-grid.asset-filter-grid { grid-template-columns: minmax(260px, 1fr) 190px 170px 170px auto; }
.archive-filter-grid { margin-top: 12px; grid-template-columns: minmax(220px, 300px) minmax(180px, 240px) auto; justify-content: start; }
.filter-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; }
.filter-grid input, .filter-grid select { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 10px 12px; min-width: 0; }
.inline-assign { display: grid; grid-template-columns: minmax(160px, 1fr) auto; gap: 8px; align-items: center; min-width: 290px; }
.inline-assign select { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 9px 10px; min-width: 0; }
.inline-assign .ghost-action { min-height: 38px; }
.feedback-form { display: grid; grid-template-columns: 80px minmax(150px, 1fr) auto; gap: 8px; min-width: 320px; }
.feedback-form select, .feedback-form input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.feedback-form .ghost-action { min-height: 36px; }
.feedback-question { border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: var(--surface-2); display: grid; gap: 8px; }
.feedback-question span { color: var(--ink); font-weight: 700; line-height: 1.4; }
.feedback-question select { width: min(260px, 100%); }
.part-thumb { width: 58px; height: 58px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); }
.machine-thumb { width: 74px; height: 58px; object-fit: cover; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); display: block; }
.machine-thumb.large { width: 112px; height: 82px; }
.machine-placeholder { width: 74px; height: 58px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); display: block; position: relative; overflow: hidden; }
.machine-placeholder.large { width: 112px; height: 82px; }
.machine-placeholder::before { content: ""; position: absolute; left: 18%; right: 18%; top: 22%; height: 42%; border: 3px solid var(--accent); border-radius: 8px; background: #fff; }
.machine-placeholder::after { content: ""; position: absolute; left: 26%; right: 26%; bottom: 22%; height: 10px; border-radius: 999px; background: var(--accent-2); }
.machine-placeholder i { position: absolute; left: 31%; right: 31%; top: 40%; height: 6px; background: #d5e2de; z-index: 1; }
.machine-photo-cell { display: grid; gap: 8px; min-width: 210px; }
.asset-photo-form { display: grid; grid-template-columns: minmax(120px, 1fr) auto; gap: 6px; align-items: center; }
.asset-photo-form input { min-width: 0; font-size: 12px; }
.asset-photo-form .ghost-action { min-height: 34px; padding: 0 10px; }
.machine-card { grid-template-columns: auto 1fr auto; align-items: center; }
.inline-cost-form { display: grid; grid-template-columns: 110px 132px 132px auto; gap: 8px; min-width: 480px; }
.inline-cost-form input { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.inline-cost-form .ghost-action { min-height: 36px; }
.inline-rate-form { display: grid; grid-template-columns: 120px 100px 120px 100px 170px 170px auto; gap: 8px; min-width: 920px; }
.inline-rate-form input, .inline-rate-form select { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.inline-rate-form .ghost-action { min-height: 36px; }
.details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.details-grid div { border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.details-grid dt { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.details-grid dd { margin: 4px 0 0; font-weight: 700; }
.notes { border-left: 4px solid var(--accent); padding-left: 12px; color: var(--muted); line-height: 1.55; }
.payload-preview { margin-top: 16px; border: 1px solid var(--line); border-radius: 8px; background: #0f172a; color: #e5e7eb; overflow: auto; }
.payload-preview pre { margin: 0; padding: 18px; min-height: 320px; font-size: 0.9rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }

@media (max-width: 1050px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; z-index: auto; padding: 14px 16px; gap: 12px; }
  .brand { grid-template-columns: 76px minmax(0, 1fr); }
  .provider-brand,
  .sidebar-panel { display: none; }
  .nav { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; -webkit-overflow-scrolling: touch; }
  .nav a { flex: 0 0 auto; white-space: nowrap; padding: 9px 12px; }
  .kpi-grid, .card-grid, .card-grid.four, .split-layout, .asset-dashboard-grid, .rent-assignment-position { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .customer-import-grid { grid-template-columns: 1fr; }
  .help-visual-flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .help-visual-flow article::before, .help-visual-flow article::after { display: none; }
}

@media (max-width: 680px) {
  .login-card { padding: 22px; }
  .login-logo-row { grid-template-columns: 1fr; justify-items: start; }
  .mab-login-brand { justify-self: start; justify-items: start; }
  .mab-login-logo { width: 104px; }
  .main { padding: 16px; }
  .topbar { margin: -16px -16px 16px; padding: 14px 16px; }
  .header-nav { justify-content: flex-start; max-width: 100%; }
  .topbar, .section-heading { align-items: stretch; flex-direction: column; }
  .topbar .primary-action, .topbar .ghost-action, .machine-import-actions .ghost-action, .upload-inline-form, .upload-inline-form input { width: 100%; }
  .sidebar { padding: 12px; }
  .brand { grid-template-columns: 68px minmax(0, 1fr); }
  .brand strong { font-size: 14px; }
  .brand small { font-size: 11px; }
  .brand-mark { width: 56px; height: 46px; }
  .client-brand-mark { width: 68px; height: 44px; }
  h1 { font-size: 24px; }
  .kpi-grid, .card-grid, .card-grid.four, .split-layout, .asset-dashboard-grid, .rent-assignment-position, .form-grid, .details-grid, .filter-grid, .filter-grid.asset-filter-grid, .checkbox-grid, .column-chooser { grid-template-columns: 1fr; }
  .kpi strong { font-size: 26px; }
  .panel, .table-panel, .kpi, .metric-card { padding: 14px; }
  .assignment-dialog, .attachment-dialog, .page-preview-dialog { width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
  .assignment-modal, .attachment-modal, .page-preview-modal { padding: 14px; max-height: calc(100vh - 20px); overflow: auto; }
  .modal-actions { display: grid; grid-template-columns: 1fr; }
  .modal-actions .primary-action, .modal-actions .ghost-action { width: 100%; }
  .feedback-form { grid-template-columns: 1fr; min-width: 220px; }
  .inline-assign, .inline-cost-form, .inline-rate-form { grid-template-columns: 1fr; min-width: 260px; }
  .list-card { grid-template-columns: 1fr; }
  .badge { justify-self: start; }
  .attachment-preview-frame { height: min(560px, 68vh); }
  .page-preview-frame { height: min(680px, 76vh); }
  .help-visual-flow, .source-grid { grid-template-columns: 1fr; }
  .status-lane div { grid-template-columns: auto 1fr; }
  .status-lane small { grid-column: 2; }
  .nav { display: flex; }
}

@media (max-width: 420px) {
  .sidebar { padding: 10px; gap: 10px; }
  .nav { display: flex; }
  .nav a { padding: 9px 10px; }
  th, td { padding: 10px; font-size: 13px; }
  table { min-width: 760px; }
  .help-visual-flow article { min-height: auto; }
}
