:root {
  --ink: #17201d;
  --muted: #718078;
  --line: #e7ebe8;
  --paper: #f5f7f5;
  --white: #fff;
  --dark: #111b18;
  --lime: #a7ed62;
  --lime-dark: #569c25;
  --orange: #ff9b50;
  --green: #47b979;
  --purple: #8c73e6;
  --shadow: 0 16px 50px rgba(31, 49, 42, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: "DM Sans", sans-serif; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
.brand { display: flex; align-items: center; gap: 11px; color: var(--ink); text-decoration: none; font: 800 21px "Manrope", sans-serif; letter-spacing: -.8px; }
.brand > span:last-child > span { color: #6ba638; }
.brand-mark { width: 33px; height: 33px; border-radius: 10px; background: var(--dark); display: grid; place-items: center; transform: rotate(-3deg); }
.brand-mark span { display: block; width: 15px; height: 9px; border: 3px solid var(--lime); border-top: 0; border-radius: 0 0 9px 9px; transform: rotate(-26deg); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 252px; z-index: 30; padding: 30px 22px 23px; background: #fbfcfb; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.sidebar nav { display: grid; gap: 7px; margin-top: 42px; }
.sidebar nav a { height: 47px; padding: 0 14px; border-radius: 11px; display: flex; align-items: center; gap: 13px; color: #66736d; font-weight: 600; text-decoration: none; font-size: 14px; }
.sidebar nav a span { width: 22px; text-align: center; font-size: 20px; }
.sidebar nav a b { margin-left: auto; color: #55724a; background: #e7f5dc; min-width: 24px; padding: 3px 6px; text-align: center; border-radius: 7px; font-size: 11px; }
.sidebar nav a.active, .sidebar nav a:hover { color: var(--ink); background: #eaf5e3; }
.sidebar-card { margin-top: auto; padding: 14px; border: 1px solid #dce8d8; border-radius: 12px; background: #f4faef; display: flex; gap: 10px; }
.sidebar-card > span { color: #4fb36e; font-size: 10px; padding-top: 3px; }
.sidebar-card strong, .user-card strong { display: block; font-size: 12px; }
.sidebar-card small, .user-card small { color: var(--muted); font-size: 10px; }
.user-card { display: flex; align-items: center; gap: 9px; border-top: 1px solid var(--line); margin-top: 16px; padding-top: 18px; }
.avatar { width: 35px; height: 35px; border-radius: 50%; background: #d6e7cc; display: grid; place-items: center; color: #557c3f; font-size: 11px; font-weight: 800; }
.user-card button, .logout-link { border: 0; background: none; margin-left: auto; color: #7e8984; text-decoration: none; }
.main { margin-left: 252px; min-height: 100vh; }
.app-footer { margin-left: 252px; padding: 20px 40px 26px; color: #8b9690; text-align: center; font-size: 10px; }
.topbar { padding: 31px 40px 25px; display: flex; align-items: center; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.72); backdrop-filter: blur(15px); }
.eyebrow { margin: 0 0 5px; color: #6f7e76; letter-spacing: 1.8px; font-size: 10px; font-weight: 800; }
.topbar h1 { margin: 0; font: 700 25px "Manrope"; letter-spacing: -.8px; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.live-pill { padding: 9px 13px; border: 1px solid var(--line); border-radius: 20px; background: white; font-size: 11px; font-weight: 600; color: #5b6761; }
.live-pill i, .tracking-header i { width: 7px; height: 7px; display: inline-block; margin-right: 6px; border-radius: 50%; background: #55c47e; box-shadow: 0 0 0 4px rgba(85,196,126,.15); animation: live 2s infinite; }
@keyframes live { 50% { box-shadow: 0 0 0 7px rgba(85,196,126,0); } }
.icon-button { width: 39px; height: 39px; border: 1px solid var(--line); border-radius: 10px; background: white; position: relative; }
.icon-button span { position: absolute; top: 8px; right: 9px; width: 5px; height: 5px; background: #ee795f; border-radius: 50%; }
.primary-button { border: 0; border-radius: 10px; padding: 11px 18px; background: var(--dark); color: white; font-weight: 700; font-size: 12px; box-shadow: 0 8px 20px rgba(17,27,24,.14); }
.primary-button:hover { background: #24332e; transform: translateY(-1px); }
.primary-button:disabled { opacity: .55; transform: none; }
.menu-button { display: none; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; padding: 24px 40px; }
.metrics article { background: var(--white); border: 1px solid var(--line); border-radius: 14px; min-height: 126px; padding: 22px 20px; display: flex; align-items: flex-start; gap: 15px; box-shadow: 0 6px 26px rgba(35,51,45,.03); }
.metric-icon { width: 39px; height: 39px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; font-weight: 800; }
.metric-icon.lime { background: #eef9e3; color: #73ac43; }
.metric-icon.orange { background: #fff1e6; color: #f19048; }
.metric-icon.green { background: #e8f7ef; color: #3ca86b; }
.metric-icon.purple { background: #f0edfc; color: #8066d8; }
.metrics small { color: #7a8781; font-size: 9px; letter-spacing: .8px; font-weight: 800; }
.metrics strong { display: block; font: 700 27px "Manrope"; margin: 4px 0 2px; letter-spacing: -1px; }
.metrics strong small { font-size: 13px; letter-spacing: 0; }
.metrics p { margin: 0; color: #909a95; font-size: 10px; }
.metrics em { color: #4caa6c; font-style: normal; font-weight: 700; }
.workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 310px); align-items: start; gap: 16px; padding: 0 40px 40px; }
.deliveries-panel, .activity-panel { background: white; border: 1px solid var(--line); border-radius: 15px; min-width: 0; box-shadow: 0 7px 30px rgba(31,49,42,.035); }
.section-head { min-height: 81px; padding: 19px 20px; display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.section-head h2 { font: 700 15px "Manrope"; margin: 0 0 4px; letter-spacing: -.2px; }
.section-head p { color: #8b9691; font-size: 10px; margin: 0; }
.filters { margin-left: auto; display: flex; gap: 8px; }
.search { width: 220px; height: 36px; display: flex; align-items: center; gap: 7px; border: 1px solid var(--line); padding: 0 10px; border-radius: 9px; color: #7b8882; }
.search input { border: 0; outline: 0; width: 100%; font-size: 11px; }
.filters select { height: 36px; border: 1px solid var(--line); border-radius: 9px; color: #58665f; background: white; padding: 0 28px 0 10px; font-size: 11px; }
.table-wrap { width: 100%; overflow-x: auto; overflow-y: visible; scrollbar-width: thin; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 13px 16px; color: #9aa39f; font-size: 8px; letter-spacing: .7px; background: #fbfcfb; }
td { padding: 15px 16px; border-top: 1px solid #f0f2f0; font-size: 11px; vertical-align: middle; }
td > strong { font-size: 11px; }
td > small, td div > small { display: block; max-width: 160px; color: #929c97; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 9px; margin-top: 3px; }
.person { display: flex; align-items: center; gap: 9px; min-width: 145px; }
.person strong { font-size: 11px; }
.mini-avatar { width: 31px; height: 31px; flex: 0 0 auto; border-radius: 9px; background: #eaf1e7; display: grid; place-items: center; color: #647d58; font-size: 9px; font-weight: 800; }
.driver-dot { width: 27px; height: 27px; border-radius: 50%; background: linear-gradient(135deg, #263c34, #8eaa9f); box-shadow: inset 0 0 0 3px white, 0 0 0 1px #dce2df; }
.status { display: inline-flex; align-items: center; white-space: nowrap; gap: 6px; padding: 6px 8px; border-radius: 7px; font-size: 9px; font-weight: 700; }
.status i { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status.confirmed { color: #7864c9; background: #f0edfb; }
.status.preparing { color: #cc7c3d; background: #fff0e4; }
.status.route { color: #57972f; background: #eaf7df; }
.status.delivered { color: #25885a; background: #e4f5eb; }
.status.cancelled { color: #ba5656; background: #fae8e8; }
.row-actions { position: relative; display: flex; justify-content: flex-end; gap: 4px; }
.row-actions > a, .row-actions > button { width: 29px; height: 29px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: white; color: #66736d; text-decoration: none; }
.action-menu { display: none; position: absolute; right: 0; top: 34px; z-index: 20; width: 175px; padding: 6px; background: white; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.action-menu.open { display: grid; }
.action-menu button { border: 0; border-radius: 7px; background: white; padding: 9px 10px; text-align: left; font-size: 10px; color: #4d5a54; }
.action-menu button:hover { background: #f0f6ec; color: #466f2c; }
.empty-state { display: none; text-align: center; padding: 60px 20px; }
.empty-state.visible { display: block; }
.empty-state span { display: block; font-size: 34px; color: #8cbf68; }
.empty-state h3 { margin: 8px 0 4px; font: 700 15px "Manrope"; }
.empty-state p { color: var(--muted); font-size: 11px; }
.activity-panel { width: 100%; overflow: hidden; }
.activity-panel .section-head button { margin-left: auto; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: white; color: #6b7972; }
.message-list { max-height: 430px; overflow: auto; }
.message-item { display: flex; gap: 10px; padding: 16px 18px; border-bottom: 1px solid #f0f2f0; }
.message-status { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: #4ca969; background: #e8f7ed; font-size: 10px; }
.message-status.failed { color: #c35454; background: #fae7e7; }
.message-item strong { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 10px; line-height: 1.45; }
.message-item p { margin: 5px 0 0; color: #99a29e; font-size: 9px; }
.message-item p span { color: #4d9b67; font-weight: 700; }
.no-messages { color: #929c97; font-size: 11px; padding: 45px 20px; text-align: center; }
.whatsapp-note { margin: 14px; padding: 13px; border-radius: 11px; background: #f3f9ef; display: flex; gap: 11px; }
.wa-icon { width: 32px; height: 32px; flex: 0 0 auto; border-radius: 50%; background: #4cb76f; color: white; display: grid; place-items: center; }
.whatsapp-note strong { font-size: 10px; }
.whatsapp-note strong span { color: #4c9c65; }
.whatsapp-note p { color: #77847d; font-size: 9px; line-height: 1.45; margin: 3px 0 0; }
dialog { width: min(600px, calc(100% - 30px)); border: 0; border-radius: 18px; padding: 0; box-shadow: 0 30px 100px rgba(15,25,21,.3); }
dialog::backdrop { background: rgba(12,21,18,.55); backdrop-filter: blur(3px); }
.dialog-head { padding: 24px 26px 18px; display: flex; border-bottom: 1px solid var(--line); }
.dialog-head h2 { font: 700 22px "Manrope"; margin: 0; }
.close-dialog { margin-left: auto; border: 0; background: none; font-size: 24px; color: #7b8681; }
.dialog-head-actions { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.dialog-head-actions .close-dialog { margin-left: 0; }
.pdf-import-button { border: 1px solid #cfe2c5; border-radius: 9px; padding: 9px 12px; color: #477333; background: #eff8e9; font-size: 10px; font-weight: 800; }
.pdf-import-button:hover { background: #e4f3dc; }
.pdf-import-button:disabled { cursor: wait; opacity: .65; }
.pdf-import-status { margin: 14px 26px 0; padding: 10px 12px; border-radius: 9px; font-size: 10px; line-height: 1.45; }
.pdf-import-status.loading { color: #6c7554; background: #f7f5df; }
.pdf-import-status.success { color: #34774d; background: #e8f6ec; }
.pdf-import-status.warning { color: #916526; background: #fff3df; }
.pdf-import-status.error { color: #a54b4b; background: #fdeaea; }
.branches-dialog { width: min(900px, calc(100% - 30px)); max-height: calc(100vh - 30px); }
.branches-layout { display: grid; grid-template-columns: minmax(300px, .85fr) minmax(320px, 1.15fr); gap: 16px; padding: 20px; background: #f5f7f5; overflow-y: auto; max-height: calc(100vh - 110px); }
.branch-form, .branches-list-section { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.branch-form-title h3, .branches-list-head h3 { margin: 0 0 4px; font: 700 14px "Manrope"; }
.branch-form-title p, .branches-list-head p { margin: 0; color: #87938d; font-size: 10px; }
.branch-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin: 18px 0; }
.branch-form-grid label { display: grid; gap: 6px; color: #4f5d56; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; }
.branch-form-grid label:nth-child(2), .branch-form-grid label.wide { grid-column: 1/-1; }
.branch-form-grid input { min-width: 0; width: 100%; padding: 11px 12px; border: 1px solid #dfe5e1; border-radius: 10px; outline: 0; color: var(--ink); background: #fbfcfb; font-size: 11px; text-transform: none; }
.branch-form-grid input:focus { border-color: #8fc768; box-shadow: 0 0 0 3px rgba(143,199,104,.13); }
.branches-list-head { display: flex; align-items: center; margin-bottom: 15px; }
.branches-list-head button { margin-left: auto; width: 31px; height: 31px; border: 1px solid var(--line); border-radius: 8px; color: #647169; background: white; }
.branches-list { display: grid; gap: 9px; }
.branch-card { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfb; }
.branch-code { min-width: 60px; padding: 8px 9px; border-radius: 8px; color: #486f34; background: #eaf5e3; text-align: center; font-size: 9px; font-weight: 900; }
.branch-details { min-width: 0; }
.branch-details strong, .branch-details span, .branch-details small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.branch-details strong { font-size: 11px; }
.branch-details span { margin-top: 3px; color: #74817a; font-size: 9px; }
.branch-details small { margin-top: 3px; color: #9aa39f; font-size: 8px; }
.branch-card-actions { display: flex; gap: 5px; }
.branch-card-actions button { width: 28px; height: 28px; border: 0; border-radius: 8px; color: #527344; background: #eaf3e6; font-size: 13px; }
.branch-card-actions button:last-child { color: #a65a5a; background: #fae8e8; font-size: 16px; }
.branch-form-actions { display: flex; gap: 8px; }
.branches-empty { padding: 35px 15px; border: 1px dashed #dce2de; border-radius: 10px; color: #8b9690; text-align: center; font-size: 10px; }
.branches-empty.error { color: #a64f4f; border-color: #edcccc; background: #fff7f7; }
.users-dialog { width: min(920px, calc(100% - 30px)); max-height: calc(100vh - 30px); }
.users-layout { display: grid; grid-template-columns: minmax(320px, .9fr) minmax(340px, 1.1fr); gap: 16px; padding: 20px; background: #f5f7f5; overflow-y: auto; max-height: calc(100vh - 110px); }
.user-form, .users-list-section { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.user-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; margin: 18px 0 14px; }
.user-form-grid label { display: grid; gap: 6px; color: #4f5d56; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .4px; }
.user-form-grid label.wide { grid-column: 1/-1; }
.user-form-grid input, .user-form-grid select { min-width: 0; width: 100%; padding: 11px 12px; border: 1px solid #dfe5e1; border-radius: 10px; outline: 0; color: var(--ink); background: #fbfcfb; font-size: 11px; text-transform: none; }
.user-form-grid input:focus, .user-form-grid select:focus { border-color: #8fc768; box-shadow: 0 0 0 3px rgba(143,199,104,.13); }
.admin-checkbox { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 12px; border: 1px solid #dfe6db; border-radius: 11px; background: #f8fbf6; cursor: pointer; }
.admin-checkbox input { position: absolute; opacity: 0; pointer-events: none; }
.admin-checkbox > span { width: 22px; height: 22px; flex: 0 0 auto; display: grid; place-items: center; border: 1px solid #cdd8c8; border-radius: 7px; color: transparent; background: white; font-size: 11px; font-weight: 900; }
.admin-checkbox input:checked + span { color: white; border-color: #579c38; background: #65aa45; }
.admin-checkbox strong, .admin-checkbox small { display: block; }
.admin-checkbox strong { font-size: 10px; }
.admin-checkbox small { margin-top: 3px; color: #859189; font-size: 8px; }
.admin-branch select { color: #77906c; background: #f2f7ef; }
.users-list { display: grid; gap: 9px; }
.user-card-item { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfb; }
.user-list-avatar { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 50%; color: #496f39; background: #e5f1df; font-size: 9px; font-weight: 900; }
.user-list-details { min-width: 0; }
.user-list-details > div { display: flex; align-items: center; gap: 6px; }
.user-list-details strong, .user-list-details span, .user-list-details small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.user-list-details strong { font-size: 11px; }
.user-list-details > span { margin-top: 3px; color: #74817a; font-size: 9px; }
.user-list-details small { margin-top: 3px; color: #9aa39f; font-size: 8px; }
.user-list-details .admin-badge { display: inline-block; padding: 3px 5px; border-radius: 5px; color: #7655bd; background: #eee8fb; font-size: 7px; font-weight: 900; }
.user-card-item > button { width: 28px; height: 28px; border: 0; border-radius: 8px; color: #a65a5a; background: #fae8e8; font-size: 16px; }
.form-grid { padding: 23px 26px; display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-grid label { display: grid; gap: 6px; font-size: 10px; font-weight: 700; color: #5d6963; }
.form-grid label.wide { grid-column: 1/-1; }
.form-grid .wide { grid-column: 1/-1; }
.form-grid input { width: 100%; border: 1px solid #dfe5e1; border-radius: 9px; padding: 10px 11px; outline: 0; color: var(--ink); font-size: 12px; }
.form-grid input:focus { border-color: #8fc768; box-shadow: 0 0 0 3px rgba(143,199,104,.13); }
.form-grid input:read-only { color: #65736c; background: #f5f7f5; }
.address-lookup-status { margin-top: -5px; padding: 9px 11px; border-radius: 8px; color: #7c8882; background: #f7f9f7; font-size: 9px; }
.address-lookup-status.loading { color: #806b35; background: #faf4df; }
.address-lookup-status.success { color: #367e50; background: #e7f5eb; }
.address-lookup-status.warning { color: #916526; background: #fff3df; }
.address-lookup-status.error { color: #a54b4b; background: #fdeaea; }
.address-lookup-status.error { overflow-wrap: anywhere; }
.retry-geocoding { justify-self: start; margin-top: -6px; border: 0; padding: 4px 0; color: #527d3b; background: transparent; font-size: 9px; font-weight: 800; }
.retry-geocoding:hover { text-decoration: underline; }
.nearby-branches { padding: 12px; border: 1px solid #dfe6dc; border-radius: 11px; background: #f8faf7; }
.nearby-branches > p { margin: 0; color: #87938d; font-size: 9px; }
.nearby-title { display: block; margin-bottom: 9px; color: #526058; font-size: 10px; }
.nearby-list { display: grid; gap: 7px; }
.nearby-branch { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 9px; padding: 10px; border: 1px solid #e0e5e2; border-radius: 9px; color: var(--ink); background: white; text-align: left; }
.nearby-branch:hover, .nearby-branch.selected { border-color: #7db657; box-shadow: 0 0 0 3px rgba(125,182,87,.12); }
.nearby-branch.selected { background: #f4faef; }
.nearby-rank { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; color: #567447; background: #e7f1e2; font-size: 9px; font-weight: 900; }
.nearby-branch strong, .nearby-branch small { display: block; }
.nearby-branch strong { font-size: 10px; }
.nearby-branch small { margin-top: 3px; color: #87938d; font-size: 8px; }
.nearby-branch em { padding: 5px 7px; border-radius: 7px; color: #3d7e28; background: #e2f3d8; font-size: 7px; font-style: normal; font-weight: 900; text-transform: uppercase; }
.geocoding-attribution { margin: -4px 0 0; color: #9aa39f; font-size: 8px; }
.dialog-actions { padding: 16px 26px 24px; display: flex; justify-content: flex-end; gap: 9px; }
.secondary-button { border: 1px solid var(--line); background: white; border-radius: 10px; padding: 10px 17px; color: #65716b; font-size: 12px; font-weight: 700; }
.settings-dialog { width: min(720px, calc(100% - 30px)); max-height: calc(100vh - 30px); }
.settings-dialog form { max-height: calc(100vh - 30px); display: flex; flex-direction: column; }
.settings-content { display: grid; gap: 12px; padding: 20px 24px 5px; background: #f7f9f7; }
.settings-dialog .settings-content { overflow-y: auto; }
.settings-section { padding: 18px; border: 1px solid var(--line); border-radius: 13px; background: white; }
.settings-title { display: flex; align-items: center; gap: 12px; }
.settings-title h3 { margin: 0 0 3px; font: 700 13px "Manrope"; }
.settings-title p { margin: 0; color: #8a9690; font-size: 10px; }
.settings-icon { width: 35px; height: 35px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 10px; color: white; background: #48b56c; }
.settings-icon.neutral { color: #61746a; background: #edf1ee; }
.settings-badge { margin-left: auto; padding: 6px 9px; border-radius: 8px; color: #a36a31; background: #fff0df; white-space: nowrap; font-size: 9px; font-weight: 800; }
.settings-badge.success { color: #378556; background: #e5f5ea; }
.settings-info { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.settings-info > div { padding: 11px 12px; border-radius: 9px; background: #f7f9f7; }
.settings-info small { display: block; color: #929d97; letter-spacing: .7px; font-size: 8px; font-weight: 800; }
.settings-info strong { display: block; margin-top: 4px; font-size: 11px; }
.online-text { color: #439562; }
.settings-hint { margin: 13px 0 0; color: #78847e; font-size: 10px; line-height: 1.55; }
.settings-toggle { display: flex; align-items: center; gap: 9px; margin-top: 16px; color: #526058; font-size: 10px; font-weight: 800; }
.settings-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.settings-toggle span { width: 34px; height: 19px; padding: 2px; border-radius: 20px; background: #d9dfdb; transition: .2s; }
.settings-toggle span::after { content: ""; display: block; width: 15px; height: 15px; border-radius: 50%; background: white; box-shadow: 0 1px 4px rgba(0,0,0,.18); transition: .2s; }
.settings-toggle input:checked + span { background: #65b642; }
.settings-toggle input:checked + span::after { transform: translateX(15px); }
.settings-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 15px; }
.settings-form-grid label { display: grid; gap: 6px; color: #5e6b64; font-size: 9px; font-weight: 800; }
.settings-form-grid label.wide { grid-column: 1/-1; }
.settings-form-grid input { min-width: 0; width: 100%; padding: 10px 11px; border: 1px solid #dfe5e1; border-radius: 9px; outline: 0; color: #34423a; background: #fbfcfb; font-size: 11px; }
.settings-form-grid input:focus { border-color: #8fc768; box-shadow: 0 0 0 3px rgba(143,199,104,.13); }
.secret-field { display: flex; }
.secret-field input { border-radius: 9px 0 0 9px; }
.secret-field input:disabled { color: #87928d; background: #f5f7f5; letter-spacing: 2px; opacity: 1; }
.secret-field button { flex: 0 0 auto; border: 1px solid #dfe5e1; border-left: 0; border-radius: 0 9px 9px 0; padding: 0 13px; color: #4d6d3b; background: #eef7e8; font-size: 9px; font-weight: 800; }
.secret-status { color: #8b9690; font-size: 9px; font-weight: 600; }
.secret-status.saved { color: #378b57; }
.secret-status.editing { color: #a16d37; }
.settings-test-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.settings-test-row .secondary-button { padding: 8px 11px; }
.settings-test-row span { color: #8a9690; font-size: 9px; }
.settings-test-row span.is-success { color: #378b57; font-weight: 800; }
.settings-test-row span.is-error { color: #b75858; font-weight: 800; }
.evolution-instances { display: grid; gap: 8px; margin-top: 14px; }
.evolution-instances > p { margin: 0; padding: 14px; border: 1px dashed #d9e0dc; border-radius: 10px; color: #88948e; background: #fafbfa; text-align: center; font-size: 10px; }
.evolution-instances > p.instances-error { color: #aa4f4f; border-color: #edcccc; background: #fff7f7; }
.evolution-instance-card { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--line); border-radius: 11px; background: #fbfcfb; }
.evolution-instance-card.selected { border-color: #84bd5e; box-shadow: 0 0 0 3px rgba(132,189,94,.12); background: #f7fbf4; }
.evolution-instance-card strong { display: block; font: 700 11px "Manrope"; }
.evolution-instance-card small { display: block; margin-top: 3px; color: #87938d; font-size: 9px; }
.instance-actions { display: flex; gap: 6px; }
.evolution-instance-card button { border: 0; border-radius: 8px; padding: 8px 10px; color: white; background: #1596b5; font-size: 9px; font-weight: 800; }
.evolution-instance-card button.connect-instance-button { color: #356124; background: #e6f3dd; }
.instance-state { padding: 5px 8px; border-radius: 20px; font-size: 8px; font-weight: 900; }
.instance-state.online { color: #168042; background: #d9f3e2; }
.instance-state.offline { color: #a64e4e; background: #f8dfdf; }
.evolution-connect-panel { margin-top: 14px; padding: 15px; border: 1px solid #cfe0c7; border-radius: 12px; background: #f7fbf4; }
.evolution-connect-panel[hidden] { display: none; }
.close-connect-panel { margin-left: auto; border: 0; background: none; color: #7a8780; font-size: 20px; }
.pairing-number { display: grid; gap: 6px; margin: 14px 0 9px; color: #5e6b64; font-size: 9px; font-weight: 800; }
.pairing-number input { padding: 10px 11px; border: 1px solid #d8e1d4; border-radius: 9px; outline: 0; background: white; font-size: 11px; }
.evolution-qr { min-height: 110px; margin-top: 12px; padding: 14px; display: grid; place-items: center; gap: 10px; border: 1px dashed #cad8c4; border-radius: 10px; background: white; text-align: center; }
.evolution-qr img { width: min(280px, 100%); border-radius: 8px; }
.evolution-qr p, .evolution-qr strong { margin: 0; color: #718078; font-size: 10px; }
.evolution-qr .pairing-code { color: #17201d; font: 800 24px "Manrope"; letter-spacing: 3px; }
.evolution-qr .connection-success { color: #378b57; }
.test-grid { grid-template-columns: 1fr auto; align-items: end; }
.test-grid .wide { grid-column: 1/2 !important; }
.test-grid .primary-button { height: 37px; }
.settings-field { display: grid; gap: 7px; margin-top: 15px; color: #5e6b64; font-size: 10px; font-weight: 700; }
.settings-field > div { display: flex; }
.settings-field input { min-width: 0; flex: 1; padding: 10px 11px; border: 1px solid #dfe5e1; border-radius: 9px 0 0 9px; outline: 0; color: #526159; background: #fbfcfb; font-size: 11px; }
.settings-field button { border: 1px solid #dfe5e1; border-left: 0; border-radius: 0 9px 9px 0; padding: 0 13px; color: #4d6d3b; background: #eef7e8; font-size: 10px; font-weight: 800; }
.compact-section { margin-bottom: 10px; }
.settings-doc-link { display: inline-flex; align-items: center; text-decoration: none; }
.toast { position: fixed; right: 25px; bottom: 25px; z-index: 100; max-width: 360px; padding: 13px 17px; border-radius: 10px; background: #18251f; color: white; font-size: 11px; box-shadow: var(--shadow); opacity: 0; transform: translateY(15px); pointer-events: none; transition: .25s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #9f4747; }

/* Login */
body.login-page { min-height: 100vh; background: var(--dark); }
.login-footer { position: fixed; z-index: 5; right: 24px; bottom: 14px; color: #87948e; font-size: 9px; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 1fr) minmax(420px, .85fr); }
.login-visual { position: relative; padding: 48px clamp(35px, 6vw, 90px); display: flex; flex-direction: column; overflow: hidden; color: white; background: radial-gradient(circle at 20% 80%, rgba(167,237,98,.17), transparent 34%), linear-gradient(145deg, #101a17, #1c2c26); }
.login-visual::before, .login-visual::after { content: ""; position: absolute; border: 1px solid rgba(167,237,98,.09); border-radius: 50%; }
.login-visual::before { width: 520px; height: 520px; right: -270px; top: -160px; }
.login-visual::after { width: 360px; height: 360px; left: -210px; bottom: -190px; }
.login-visual-copy { position: relative; z-index: 1; max-width: 570px; margin: auto 0; }
.login-visual-copy .eyebrow { color: var(--lime); }
.login-visual-copy h1 { margin: 10px 0 18px; font: 800 clamp(38px, 5vw, 70px)/1.04 "Manrope"; letter-spacing: -3px; }
.login-visual-copy > p:last-child { max-width: 490px; margin: 0; color: #aebbb5; font-size: 15px; line-height: 1.7; }
.login-route-art { position: relative; z-index: 1; width: min(430px, 90%); height: 90px; margin-top: 30px; }
.login-route-art::before { content: ""; position: absolute; left: 8px; right: 28px; top: 44px; border-top: 3px dashed rgba(167,237,98,.35); transform: rotate(-3deg); }
.login-route-art i { position: absolute; top: 38px; width: 14px; height: 14px; border: 3px solid var(--dark); border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 3px rgba(167,237,98,.18); }
.login-route-art i:nth-child(1) { left: 0; }
.login-route-art i:nth-child(2) { left: 44%; top: 29px; }
.login-route-art i:nth-child(3) { right: 22px; top: 23px; }
.login-route-art span { position: absolute; right: 0; top: 8px; color: var(--lime); font-size: 27px; transform: rotate(-28deg); }
.login-form-side { display: grid; place-items: center; padding: 35px; background: #f7f9f7; }
.login-form { width: min(430px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 22px; background: white; box-shadow: 0 24px 70px rgba(18,31,26,.12); }
.login-form h2 { margin: 4px 0 8px; font: 800 31px "Manrope"; letter-spacing: -1.2px; }
.login-subtitle { margin: 0 0 28px; color: #7e8a84; font-size: 12px; line-height: 1.55; }
.login-form > label { display: grid; gap: 7px; margin-top: 15px; color: #526058; font-size: 10px; font-weight: 800; }
.login-form input { width: 100%; padding: 13px 14px; border: 1px solid #dce3df; border-radius: 11px; outline: none; color: var(--ink); background: #fbfcfb; font-size: 12px; }
.login-form input:focus { border-color: #82bc5d; box-shadow: 0 0 0 4px rgba(130,188,93,.13); }
.password-field { position: relative; }
.password-field input { padding-right: 48px; }
.password-field button { position: absolute; right: 6px; top: 6px; width: 35px; height: 35px; border: 0; border-radius: 8px; color: #77847d; background: transparent; }
.login-submit { width: 100%; margin-top: 22px; padding: 13px 18px; }
.login-alert { margin: 18px 0 4px; padding: 11px 13px; border-radius: 10px; color: #a54848; background: #fdeaea; font-size: 10px; line-height: 1.5; }
.login-help { margin: 20px 0 0; color: #929c97; text-align: center; font-size: 9px; }

/* Public tracking */
.tracking-page { min-height: 100vh; background: #f4f6f3; }
.tracking-header { height: 76px; padding: 0 max(24px, calc((100vw - 1180px)/2)); background: var(--dark); display: flex; align-items: center; justify-content: space-between; }
.brand.light { color: white; }
.brand.light .brand-mark { background: var(--lime); }
.brand.light .brand-mark span { border-color: var(--dark); }
.brand.light > span:last-child > span { color: var(--lime); }
.tracking-header > div { color: #c9d3ce; border: 1px solid #33413c; border-radius: 20px; padding: 8px 13px; font-size: 10px; font-weight: 700; }
.tracking-main { width: min(1180px, calc(100% - 40px)); margin: auto; padding: 46px 0 35px; }
.tracking-copy { margin-bottom: 27px; }
.tracking-copy .eyebrow { color: #699e45; }
.tracking-copy h1 { margin: 7px 0 8px; font: 800 clamp(30px, 4vw, 48px) "Manrope"; letter-spacing: -2.2px; }
.tracking-copy h1 span { color: #8ad14f; }
.tracking-copy > p:last-child { color: #77827d; margin: 0; font-size: 13px; }
.tracking-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr); gap: 18px; }
.map-card { height: 475px; border: 7px solid white; border-radius: 20px; overflow: hidden; position: relative; box-shadow: var(--shadow); background: #dfe8dc; }
#map { height: 100%; width: 100%; z-index: 1; }
.map-status { position: absolute; z-index: 5; left: 17px; bottom: 17px; display: flex; align-items: center; gap: 9px; padding: 10px 13px; border-radius: 10px; background: rgba(255,255,255,.94); box-shadow: 0 5px 20px rgba(26,43,36,.12); font-size: 10px; color: #6c7973; }
.map-status i { width: 7px; height: 7px; background: #65bd48; border-radius: 50%; }
.map-status strong { color: #3f4d46; }
.driver-map-icon span, .destination-map-icon span { width: 100%; height: 100%; display: grid; place-items: center; border-radius: 50%; box-shadow: 0 5px 15px rgba(22,36,30,.25); }
.driver-map-icon span { color: var(--dark); background: var(--lime); border: 5px solid white; font-size: 19px; transform: rotate(-35deg); }
.destination-map-icon span { color: white; background: var(--dark); border: 4px solid white; font-size: 17px; }
.delivery-detail { display: grid; gap: 16px; }
.eta-card { min-height: 176px; color: white; padding: 26px; border-radius: 18px; background: var(--dark); position: relative; overflow: hidden; }
.eta-card::after { content: ""; position: absolute; width: 150px; height: 150px; border: 35px solid rgba(167,237,98,.08); border-radius: 50%; right: -55px; bottom: -80px; }
.eta-card > small, .order-card small { color: #85928c; letter-spacing: 1px; font-size: 8px; font-weight: 800; }
.eta-card > div { display: flex; align-items: baseline; margin: 5px 0 0; }
.eta-card strong { font: 800 62px "Manrope"; letter-spacing: -4px; line-height: 1; color: var(--lime); }
.eta-card div span { margin-left: 8px; color: #bfcbc5; font-size: 18px; font-weight: 700; }
.eta-card p { color: #9da9a3; font-size: 10px; margin: 12px 0 0; }
.order-card { background: white; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); overflow: hidden; }
.order-head, .driver, .destination { padding: 18px 20px; display: flex; align-items: center; }
.order-head { border-bottom: 1px solid var(--line); }
.order-head strong { display: block; font: 700 15px "Manrope"; margin-top: 2px; }
.order-head > span { margin-left: auto; color: #5d9c36; background: #ebf7e2; padding: 6px 9px; border-radius: 8px; font-size: 8px; font-weight: 800; }
.driver { gap: 11px; }
.driver-avatar { width: 43px; height: 43px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: #dde8d7; color: #58764a; font-size: 11px; font-weight: 800; }
.driver strong { display: block; font-size: 12px; margin: 2px 0; }
.driver p { margin: 0; color: #87928d; font-size: 9px; }
.driver a { width: 34px; height: 34px; margin-left: auto; display: grid; place-items: center; background: #e8f7ed; color: #3daa65; border-radius: 50%; text-decoration: none; }
.destination { align-items: flex-start; gap: 11px; border-top: 1px solid var(--line); background: #fbfcfb; }
.destination > span { color: #72a750; }
.destination p { margin: 3px 0 0; font-size: 10px; line-height: 1.5; color: #55625b; }
.timeline-card { margin-top: 18px; padding: 22px 25px 25px; border: 1px solid var(--line); border-radius: 17px; background: white; box-shadow: 0 8px 30px rgba(31,49,42,.035); }
.timeline-card h2 { font: 700 14px "Manrope"; margin: 0 0 20px; }
.progress-line { height: 4px; margin: 0 10%; background: #e5e9e6; border-radius: 4px; overflow: hidden; }
.progress-line span { display: block; height: 100%; width: 0; background: var(--lime); transition: width .8s ease; }
.timeline { display: grid; grid-template-columns: repeat(4, 1fr); margin-top: -13px; }
.timeline-step { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; color: #a2aaa6; }
.timeline-step > span { width: 22px; height: 22px; display: grid; place-items: center; border: 3px solid white; border-radius: 50%; background: #dfe4e1; font-size: 8px; font-weight: 800; }
.timeline-step.complete > span { color: #2c4a20; background: var(--lime); }
.timeline-step.current > span { box-shadow: 0 0 0 4px rgba(167,237,98,.2); }
.timeline-step strong { font-size: 10px; color: #748078; }
.timeline-step.complete strong { color: #344139; }
.timeline-step small { display: block; margin-top: 2px; font-size: 8px; }
.tracking-help { text-align: center; color: #8b9590; font-size: 10px; margin: 24px 0 0; }
.public-footer { padding: 0 20px 28px; color: #8b9590; text-align: center; font-size: 10px; }
.tracking-error { display: none; width: min(600px, calc(100% - 40px)); margin: 100px auto; text-align: center; }
.tracking-error.visible { display: block; }
.tracking-error h1 { font: 800 32px "Manrope"; }
.tracking-error p { color: var(--muted); }
.pulse-update .eta-card { animation: pulseCard .8s; }
@keyframes pulseCard { 50% { box-shadow: 0 0 0 6px rgba(167,237,98,.25); } }

@media (max-width: 1500px) {
  .metrics { grid-template-columns: 1fr 1fr; }
  .workspace { grid-template-columns: 1fr; }
  .activity-panel { max-width: none; }
  .message-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); max-height: 430px; }
  .message-item { min-width: 0; }
  .whatsapp-note { max-width: 520px; }
}
@media (min-width: 1501px) {
  .activity-panel { position: sticky; top: 16px; }
}
@media (max-width: 820px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { min-height: 260px; padding: 30px; }
  .login-visual-copy { margin: 45px 0 0; }
  .login-visual-copy h1 { max-width: 570px; font-size: clamp(31px, 8vw, 48px); letter-spacing: -2px; }
  .login-route-art { display: none; }
  .login-form-side { padding: 24px 18px 35px; }
  .login-form { margin-top: -35px; position: relative; z-index: 3; }
  .sidebar { transform: translateX(-100%); transition: .25s; box-shadow: 20px 0 50px rgba(20,30,26,.15); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .app-footer { margin-left: 0; padding-left: 22px; padding-right: 22px; }
  .menu-button { display: grid; place-items: center; width: 38px; height: 38px; margin-right: 15px; border: 1px solid var(--line); border-radius: 9px; background: white; }
  .topbar { padding: 22px; }
  .live-pill, .icon-button { display: none; }
  .metrics, .workspace { padding-left: 22px; padding-right: 22px; }
  .section-head { align-items: flex-start; flex-direction: column; gap: 13px; }
  .filters { margin: 0; width: 100%; }
  .search { width: 100%; }
  .filters select { flex: 0 0 155px; }
  table { min-width: 760px; }
  .tracking-grid { grid-template-columns: 1fr; }
  .delivery-detail { grid-template-columns: 1fr 1fr; }
  .map-card { height: 400px; }
}
@media (max-width: 600px) {
  .login-visual { min-height: 230px; padding: 24px 20px; }
  .login-visual-copy { margin-top: 35px; }
  .login-visual-copy > p:last-child { font-size: 12px; }
  .login-form { padding: 26px 20px; border-radius: 18px; }
  .login-form h2 { font-size: 26px; }
  .login-footer { position: static; padding: 18px; color: #aab5b0; text-align: center; background: var(--dark); }
  .topbar { padding: 16px; }
  .topbar h1 { font-size: 18px; }
  .topbar .eyebrow { display: none; }
  .top-actions .primary-button { font-size: 0; padding: 10px 12px; }
  .top-actions .primary-button::after { content: "＋"; font-size: 18px; }
  .metrics { grid-template-columns: 1fr 1fr; padding: 16px; gap: 9px; }
  .metrics article { min-height: 110px; padding: 14px; }
  .metric-icon { width: 31px; height: 31px; }
  .metrics strong { font-size: 22px; }
  .metrics p { display: none; }
  .workspace { padding: 0 16px 25px; }
  .deliveries-panel, .activity-panel { border-radius: 13px; }
  .section-head { padding: 16px; }
  .filters { display: grid; grid-template-columns: 1fr; }
  .filters select { width: 100%; }
  .message-list { grid-template-columns: 1fr; }
  .message-item { padding: 14px 16px; }
  .whatsapp-note { margin: 10px; }
  .table-wrap { padding: 10px; overflow: visible; }
  table, tbody, tr, td { display: block; width: 100%; }
  table { min-width: 0; }
  thead { display: none; }
  tbody { display: grid; gap: 10px; }
  tbody tr { position: relative; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: white; box-shadow: 0 5px 18px rgba(31,49,42,.04); }
  tbody td { min-height: 32px; padding: 7px 0 7px 88px; border: 0; position: relative; }
  tbody td::before { content: attr(data-label); position: absolute; left: 0; top: 9px; width: 76px; color: #98a19d; letter-spacing: .5px; text-transform: uppercase; font-size: 8px; font-weight: 800; }
  tbody td > small, tbody td div > small { max-width: none; white-space: normal; }
  .person { min-width: 0; }
  .row-actions { justify-content: flex-start; }
  .action-menu { left: 0; right: auto; }
  .empty-state { padding: 45px 15px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid label.wide { grid-column: auto; }
  .settings-form-grid, .test-grid { grid-template-columns: 1fr; }
  .settings-form-grid label.wide, .test-grid .wide { grid-column: auto !important; }
  .settings-title { align-items: flex-start; flex-wrap: wrap; }
  .settings-title .settings-badge { margin-left: 47px; }
  .settings-dialog { width: calc(100% - 16px); max-height: calc(100vh - 16px); }
  .branches-dialog { width: calc(100% - 16px); max-height: calc(100vh - 16px); }
  .users-dialog { width: calc(100% - 16px); max-height: calc(100vh - 16px); }
  .branches-layout { grid-template-columns: 1fr; padding: 10px; max-height: calc(100vh - 85px); }
  .users-layout { grid-template-columns: 1fr; padding: 10px; max-height: calc(100vh - 85px); }
  .branch-form, .branches-list-section { padding: 15px; }
  .user-form, .users-list-section { padding: 15px; }
  .branch-form-grid { grid-template-columns: 1fr; }
  .user-form-grid { grid-template-columns: 1fr; }
  .branch-form-grid label:nth-child(2), .branch-form-grid label.wide { grid-column: auto; }
  .user-form-grid label.wide { grid-column: auto; }
  .settings-dialog form { max-height: calc(100vh - 16px); }
  .settings-content { padding: 12px 10px 4px; }
  .settings-section { padding: 14px; }
  .settings-test-row { display: grid; grid-template-columns: 1fr; }
  .settings-test-row .secondary-button { width: 100%; }
  .dialog-head { padding: 18px 16px 14px; }
  .delivery-dialog-head { align-items: flex-start; }
  .dialog-head-actions { gap: 5px; }
  .pdf-import-button { padding: 8px 9px; }
  .pdf-import-status { margin: 10px 16px 0; }
  .dialog-actions { padding: 12px 16px 18px; flex-wrap: wrap; }
  .dialog-actions .settings-doc-link { margin-right: auto; }
  .secret-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .evolution-instance-card { grid-template-columns: 1fr auto; }
  .instance-actions { grid-column: 1/-1; }
  .instance-actions button { flex: 1; }
  .tracking-header { padding: 0 20px; }
  .tracking-main { width: calc(100% - 28px); padding-top: 30px; }
  .tracking-copy h1 { letter-spacing: -1.5px; }
  .tracking-grid { gap: 12px; }
  .map-card { height: 330px; border-width: 5px; }
  .delivery-detail { grid-template-columns: 1fr; gap: 12px; }
  .eta-card { min-height: 145px; }
  .eta-card strong { font-size: 50px; }
  .timeline-card { padding: 20px 10px; }
  .timeline-step strong { font-size: 8px; }
  .timeline-step small { font-size: 7px; }
  .toast { left: 14px; right: 14px; bottom: 14px; max-width: none; text-align: center; }
}
@media (max-width: 390px) {
  .metrics { grid-template-columns: 1fr; }
  .metrics article { min-height: 90px; }
  tbody td { padding-left: 76px; }
  tbody td::before { width: 66px; }
  .dialog-actions > * { width: 100%; justify-content: center; text-align: center; }
  .nearby-branch { grid-template-columns: auto minmax(0, 1fr); }
  .nearby-branch em { grid-column: 2; justify-self: start; }
}
