:root {
  color-scheme: light;
  --bg: #f3f6f9;
  --panel: #ffffff;
  --text: #121a2a;
  --muted: #5f6d80;
  --line: #dce3ec;
  --primary: #e1251b;
  --primary-dark: #b91c17;
  --accent: #0b3a66;
  --danger: #b42318;
  --soft: #fff1f0;
  --sidebar: #111b22;
  --sidebar-panel: #1b2a34;
  --success: #117f74;
  --shadow: 0 18px 42px rgba(16, 24, 40, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
  background:
    radial-gradient(circle at 86% 4%, rgba(225, 37, 27, .08), transparent 28%),
    linear-gradient(180deg, #fbfcfe 0, var(--bg) 290px);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 28px;
  background: #ffffff;
}
.login-screen.active { display: grid; }
.login-card {
  width: min(560px, 100%);
  background: white;
  border-radius: 8px;
  padding: 34px;
  box-shadow: 0 24px 70px rgba(16, 24, 40, .22);
}
.login-logo {
  width: min(330px, 100%);
  display: block;
  margin: 0 auto 24px;
}
.login-card h1 { font-size: 38px; margin-bottom: 8px; }
.login-card p { font-size: 18px; line-height: 1.25; margin-bottom: 24px; }
.login-card label { font-size: 15px; }
.login-card input,
.login-card select,
.login-card button { min-height: 52px; font-size: 16px; }
.login-error {
  display: none;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 8px;
  background: #fff1f2;
  color: #b42318;
  font-weight: 800;
  line-height: 1.35;
}
.login-error.show {
  display: block;
}
.two-factor-box {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.setup-box {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid #f1c7c4;
  border-radius: 8px;
  background: #fff6f5;
}
.setup-box p {
  margin-bottom: 0;
  font-size: 14px;
}
.setup-box small {
  color: var(--muted);
  line-height: 1.35;
}
.qr-box {
  width: 210px;
  max-width: 100%;
  padding: 12px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  place-self: center;
}
.qr-box svg {
  display: block;
  width: 100%;
  height: auto;
}

aside {
  min-height: 100vh;
  padding: 22px;
  background:
    linear-gradient(180deg, rgba(225, 37, 27, .14), transparent 190px),
    var(--sidebar);
  color: white;
  position: sticky;
  top: 0;
  box-shadow: 14px 0 34px rgba(17, 27, 34, .08);
}

.brand { display: grid; gap: 8px; margin-bottom: 28px; }
.brand-logo {
  width: 100%;
  max-width: 210px;
  height: auto;
  display: block;
  background: white;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 6px;
  box-shadow: 0 18px 30px rgba(0, 0, 0, .24);
}
.brand b { font-size: 20px; }
.brand span { color: #aeb8c2; font-size: 13px; }

.user-pill {
  display: grid;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .05), rgba(255, 255, 255, .02)), var(--sidebar-panel);
}
.user-pill span { color: #aeb8c2; font-size: 12px; }
.user-pill b { color: white; }
.user-pill button { width: 100%; }

.tab {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 13px 14px;
  margin-bottom: 8px;
  text-align: left;
  color: #dbe1e8;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
}
.tab.active, .tab:hover { background: rgba(255, 255, 255, .08); color: white; }
.tab.active { box-shadow: inset 4px 0 0 var(--primary); }

main { padding: 30px 34px; overflow-x: hidden; }
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 30px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(217, 225, 234, .7);
}
header p {
  max-width: 620px;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: 34px; letter-spacing: 0; }
h2 { font-size: 20px; margin-bottom: 14px; }
h3 { font-size: 16px; margin-bottom: 0; }
p { color: var(--muted); }

.actions, .line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.line { justify-content: space-between; margin-bottom: 12px; }

#shiftPanel {
  min-height: 134px;
  display: flex;
  align-items: center;
  position: relative;
  overflow: hidden;
  border: 0;
  background:
    linear-gradient(120deg, rgba(225, 37, 27, .1), rgba(255, 255, 255, 0) 58%),
    var(--panel);
}
#shiftPanel::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: var(--primary);
}
#shiftPanel .line {
  width: 100%;
  margin-bottom: 0;
  position: relative;
  z-index: 1;
}
#shiftStatus {
  font-size: 16px;
}
#shiftButton {
  min-width: 160px;
  min-height: 44px;
}

button, .import {
  border: 0;
  border-radius: 8px;
  padding: 10px 13px;
  background: var(--primary);
  color: white;
  cursor: pointer;
  font-weight: 700;
  white-space: nowrap;
}
button:hover, .import:hover { background: var(--primary-dark); }
.button-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border-radius: 8px;
  padding: 8px 12px;
  background: #eef2f6;
  color: #172033;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.button-link:hover { background: #d8e0e5; }
.light {
  background: #eef2f6;
  color: #172033;
}
.light:hover { background: #d8e0e5; }
.danger { background: #fee4e2; color: var(--danger); }
.danger:hover { background: #fecdca; }
.full { width: 100%; margin-top: 12px; }
.import input { display: none; }

input, select, textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font: inherit;
  background: white;
  color: var(--text);
}
label {
  display: grid;
  min-width: 0;
  gap: 6px;
  font-size: 13px;
  color: #47515d;
  font-weight: 700;
}
label small { color: var(--muted); font-weight: 400; }
textarea { resize: vertical; }
input[readonly] { background: #f0f3f5; color: #47515d; }
.inline-save {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.inline-save input {
  min-height: 34px;
  padding: 8px 10px;
}

.view { display: none; }
.view.active { display: block; }
.admin-hidden { display: none !important; }
.technician-hidden { display: none !important; }
.fleet-actions {
  display: grid;
  gap: 16px;
}
.fleet-layout {
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
}
.fleet-actions .panel {
  padding: 14px;
}
.fleet-actions h2 {
  margin-bottom: 12px;
}
.fleet-actions .formgrid.small {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.fleet-actions label:has(input[type="file"]),
.fleet-actions button.full,
.fleet-actions .photo-summary {
  grid-column: 1 / -1;
}
.productivity-panel, #shiftPanel { margin-bottom: 18px; }
.primary-action {
  width: 100%;
  min-height: 58px;
  margin-bottom: 20px;
  font-size: 18px;
  background: linear-gradient(90deg, var(--primary), #f04b42);
  box-shadow: 0 18px 28px rgba(225, 37, 27, .22);
}
.primary-action:hover { background: linear-gradient(90deg, var(--primary-dark), var(--primary)); }
.shift-active {
  background: var(--danger);
}
.shift-active:hover {
  background: #8f1d16;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.cards article, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.cards span {
  color: var(--muted);
  display: block;
  margin-bottom: 10px;
  font-size: 14px;
}
.cards b {
  font-size: 36px;
  color: var(--text);
  line-height: 1;
}
.cards article {
  position: relative;
  overflow: hidden;
  min-height: 104px;
  transition: transform .18s ease, box-shadow .18s ease;
}
.cards article:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 46px rgba(16, 24, 40, .11);
}
.cards article::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  width: auto;
  background: var(--primary);
}
.cards article::after {
  content: "";
  position: absolute;
  right: -30px;
  top: -34px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  background: rgba(225, 37, 27, .08);
}
.finance-cards {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.finance-chart {
  display: grid;
  gap: 10px;
  margin: 8px 0 18px;
}
.finance-bar-row {
  display: grid;
  grid-template-columns: minmax(170px, 260px) 1fr 110px;
  gap: 12px;
  align-items: center;
}
.finance-bar-row span,
.finance-bar-row b {
  min-width: 0;
  overflow-wrap: anywhere;
}
.finance-bar-row b {
  text-align: right;
}
.finance-bar-track {
  height: 12px;
  border-radius: 999px;
  background: #eef2f6;
  overflow: hidden;
}
.finance-bar {
  height: 100%;
  border-radius: inherit;
}
.finance-bar.positive { background: #16803a; }
.finance-bar.negative { background: var(--primary); }
.finance-table td:nth-child(7) {
  font-weight: 800;
}

.grid2 {
  display: grid;
  grid-template-columns: minmax(320px, 470px) 1fr;
  gap: 18px;
  align-items: start;
}
.wide-left { grid-template-columns: minmax(360px, 620px) 1fr; }
.material-layout {
  display: grid;
  grid-template-columns: minmax(300px, 470px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}
.material-side,
.material-main {
  display: grid;
  gap: 18px;
}
.material-side .formgrid.small {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.table-scroll {
  width: 100%;
  overflow-x: auto;
}
.table-scroll table {
  min-width: 760px;
}
.inventory-list {
  display: grid;
  gap: 12px;
}
.inventory-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.inventory-card h3 {
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  font-size: 15px;
}
.inventory-materials {
  display: grid;
}
.inventory-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.inventory-row:last-child {
  border-bottom: 0;
}
.inventory-row b,
.inventory-row small {
  display: block;
}
.inventory-row small {
  color: var(--muted);
  margin-top: 2px;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 800;
}
.inventory-row strong {
  min-width: 46px;
  padding: 7px 11px;
  border-radius: 8px;
  background: #eef2f6;
  text-align: center;
  font-size: 16px;
}
.inventory-row.low strong {
  background: #fee2e2;
  color: var(--primary);
}
.empty-note {
  color: var(--muted);
  margin: 0;
  padding: 12px 14px;
}

.catalog-category-list {
  display: grid;
  gap: 12px;
}
.catalog-category-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}
.catalog-category-card h3 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  font-size: 15px;
}
.catalog-category-card h3 span {
  min-width: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef2f6;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}
.catalog-materials {
  display: grid;
}
.catalog-material-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.catalog-material-row:last-child {
  border-bottom: 0;
}
.catalog-material-row b,
.catalog-material-row small {
  display: block;
}
.catalog-material-row small {
  color: var(--muted);
  margin-top: 2px;
  font-size: 12px;
}
.catalog-material-row strong {
  min-width: 46px;
  padding: 7px 11px;
  border-radius: 8px;
  background: #eef2f6;
  text-align: center;
  font-size: 16px;
}
.catalog-material-row.low strong {
  background: #fee2e2;
  color: var(--primary);
}
.technician-stock-list {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}
.technician-stock-list .inventory-card h3 {
  background: #fff;
  border-left: 4px solid var(--primary);
}

.tech-layout {
  grid-template-columns: minmax(320px, 470px) minmax(0, 1fr);
}

#tecnicos.planning-mode .tech-layout {
  display: block;
  max-width: 980px;
}
#tecnicos.planning-mode #backup,
#tecnicos.planning-mode #restoreLabel {
  display: none !important;
}
#tecnicos.planning-mode .panel {
  padding: 20px;
}
#tecnicos.planning-mode .line {
  margin-bottom: 16px;
}
#tecnicos.planning-mode .tech-table thead {
  display: none;
}
#tecnicos.planning-mode .tech-table,
#tecnicos.planning-mode .tech-table tbody,
#tecnicos.planning-mode .tech-table tr,
#tecnicos.planning-mode .tech-table td {
  display: block;
  width: 100%;
}
#tecnicos.planning-mode .tech-table td,
#tecnicos.planning-mode .tech-table td:last-child {
  text-align: left;
}
.planning-tech-card td {
  border: 0;
  padding: 0 0 12px;
}
.planning-tech-card article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(190px, auto);
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  background: #fff;
  min-height: 76px;
  text-align: left;
}
.planning-tech-card b,
.planning-tech-card span,
.planning-tech-card small {
  display: block;
}
.planning-tech-card b {
  font-size: 16px;
}
.planning-tech-card span,
.planning-tech-card small {
  color: var(--muted);
  margin-top: 3px;
}
.planning-tech-card button {
  justify-self: end;
  min-height: 40px;
  white-space: nowrap;
}
#incidencias:not(.creating) .order-form-panel { display: none; }
#incidencias:not(.creating) .order-layout { grid-template-columns: 1fr; }
#incidencias.creating .order-layout {
  grid-template-columns: minmax(0, 920px);
  justify-content: center;
}
#incidencias.creating .order-list-panel { display: none; }
.order-list-title {
  margin-bottom: 12px;
}
.import-excel-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
}
.import-excel-box b {
  display: block;
  margin-bottom: 3px;
}
.import-excel-box small {
  display: block;
  color: var(--muted);
  line-height: 1.35;
}
.import-excel-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  cursor: pointer;
}
.order-filters {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.order-filters.admin-active {
  grid-template-columns: 1fr 180px 240px;
}
.order-filters input,
.order-filters select {
  width: 100%;
}
.bulk-order-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  margin: -4px 0 10px;
  color: var(--muted);
  font-weight: 700;
}
.bulk-order-actions:empty {
  display: none;
}
.bulk-order-actions div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.select-cell {
  width: 34px;
  text-align: center;
}
.select-cell input {
  width: 18px;
  height: 18px;
  margin: 0;
  accent-color: var(--primary);
}
.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  color: var(--muted);
  font-weight: 700;
}
.pager div {
  display: flex;
  gap: 8px;
}
.worked-days-form {
  display: grid;
  grid-template-columns: minmax(190px, 260px) 90px auto;
  gap: 8px;
  align-items: end;
}
.worked-days-form input,
.worked-days-form select {
  min-height: 36px;
}
.manual-note {
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  margin-left: 6px;
  text-transform: uppercase;
}
.checkbox-label {
  display: flex;
  gap: 8px;
  align-items: center;
  min-height: 42px;
}
.checkbox-label input {
  width: auto;
  min-height: auto;
}
.fleet-list {
  display: grid;
  gap: 12px;
}
#fleetRows.fleet-list {
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 12px;
}
.fleet-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}
#fleetRows .fleet-card-head {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  align-items: start;
}
#fleetRows .fleet-card-head select {
  min-height: 38px;
  font-size: 13px;
}
.fleet-card b {
  display: block;
  font-size: 17px;
}
.fleet-card span {
  color: var(--muted);
  display: block;
  margin-top: 2px;
  min-height: 18px;
}
.fleet-docs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}
.fleet-doc-link {
  min-height: 30px;
  padding: 7px 9px;
  font-size: 12px;
}
.work-ticket-layout {
  grid-template-columns: minmax(320px, 520px) minmax(0, 1fr);
}
.participant-picker {
  display: grid;
  gap: 10px;
  margin: 4px 0 12px;
}
.participant-picker .line {
  margin: 0;
}
.participant-lines {
  display: grid;
  gap: 8px;
}
.participant-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 46px;
  gap: 8px;
  align-items: center;
}
.participant-line select,
.participant-line button {
  min-height: 42px;
}
#workTicketRows td:nth-child(2) {
  max-width: 360px;
}
#workTicketRows small {
  color: var(--muted);
  line-height: 1.35;
}
.order-form-panel {
  width: 100%;
  max-width: 920px;
  min-width: 0;
}
.order-list-panel { min-width: 0; }
.personal-grid { grid-template-columns: minmax(420px, 1fr) minmax(320px, 520px); }
.material-admin-grid { margin-top: 18px; }
.wimax-layout {
  grid-template-columns: minmax(320px, 430px) 1fr;
  margin-bottom: 18px;
}
.wimax-map {
  width: 100%;
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #eef2f6;
}
.map-empty {
  min-height: inherit;
  display: grid;
  place-items: center;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}
.wimax-marker span {
  display: block;
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 6px 18px rgba(16, 24, 40, .28);
}
.formgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.formgrid.small { grid-template-columns: repeat(3, minmax(0, 1fr)); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th, td {
  border-bottom: 1px solid var(--line);
  padding: 11px 8px;
  text-align: left;
  vertical-align: middle;
}
th { color: #667085; font-size: 12px; text-transform: uppercase; }
td:last-child { text-align: right; }
.actions-cell {
  min-width: 260px;
}
.actions-cell button {
  margin: 2px;
}
.status {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 700;
  vertical-align: middle;
}
.status.pending {
  background: #fff4e5;
  color: #9a5b00;
}
.status.ok {
  background: #e7f7ef;
  color: #087443;
}
.tech-with-light {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}
.shift-light {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(18, 26, 42, .06);
}
.shift-light.on {
  background: #12b76a;
  box-shadow: 0 0 0 3px rgba(18, 183, 106, .18), 0 0 12px rgba(18, 183, 106, .55);
}
.shift-light.off {
  background: #e1251b;
  box-shadow: 0 0 0 3px rgba(225, 37, 27, .16), 0 0 12px rgba(225, 37, 27, .42);
}
.latest .status {
  margin-left: 8px;
}
.locked-note {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.material-line {
  display: grid;
  grid-template-columns: 1fr 120px 42px;
  gap: 8px;
  margin-bottom: 8px;
}
.assigned-tech {
  margin: 12px 0;
  padding: 11px 12px;
  border-radius: 8px;
  background: var(--soft);
  color: #7f1d1d;
  font-size: 14px;
}
.photos-block {
  border-top: 1px solid var(--line);
  margin-top: 16px;
  padding-top: 16px;
}
.photos-block h3 { margin-bottom: 12px; }
.photos-block input[type="file"] {
  font-size: 13px;
  padding: 9px;
}
.photo-summary {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.absence-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.calendar-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}
.absence-day {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: white;
}
.absence-day b {
  display: block;
  margin-bottom: 6px;
}
.absence-day span {
  display: block;
  border-radius: 6px;
  padding: 4px 6px;
  background: #fff1f0;
  color: #a32018;
  font-size: 11px;
  font-weight: 700;
  overflow-wrap: anywhere;
}
.absence-day.has-absence {
  border-color: rgba(225, 37, 27, .35);
  background: #fffafa;
}
.muted-day {
  background: transparent;
  border-color: transparent;
}
.latest { display: grid; gap: 10px; }
.latest article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  border-left: 4px solid var(--primary);
  background: linear-gradient(90deg, #fff4f3, #ffffff);
  padding: 12px;
  border-radius: 8px;
}
.latest article > div {
  min-width: 0;
}
.latest article button {
  flex: 0 0 auto;
}
.latest b { display: block; }
.latest span { color: var(--muted); font-size: 13px; }
.latest b,
.latest span {
  overflow-wrap: anywhere;
}
.low { color: var(--danger); font-weight: 700; }

#toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  background: #172026;
  color: white;
  padding: 12px 14px;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(10px);
  transition: .2s ease;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 980px) {
  body { grid-template-columns: 1fr; }
  aside {
    min-height: auto;
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }
  .brand { grid-column: 1 / -1; margin-bottom: 8px; }
  .tab { margin: 0; text-align: center; }
  header, .grid2, .wide-left, .material-layout, .tech-layout, .personal-grid, .wimax-layout, #incidencias.creating .order-layout { display: grid; grid-template-columns: minmax(0, 1fr); }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  body { font-size: 13px; }
  aside {
    padding: 10px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }
  .brand {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 8px 10px;
    margin-bottom: 2px;
  }
  .brand-logo {
    width: 120px;
    max-width: 120px;
    padding: 6px;
    margin: 0;
    border-radius: 7px;
    box-shadow: 0 10px 18px rgba(0, 0, 0, .2);
  }
  .brand b { font-size: 15px; line-height: 1.1; }
  .brand span { font-size: 11px; }
  .user-pill {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 4px 10px;
    padding: 9px;
    margin: 0;
  }
  .user-pill span { grid-column: 1 / -1; font-size: 10px; }
  .user-pill b { font-size: 12px; line-height: 1.1; }
  .user-pill button {
    width: auto;
    min-height: 30px;
    padding: 6px 12px;
    font-size: 12px;
  }
  .tab {
    min-height: 36px;
    margin: 0;
    padding: 8px 6px;
    border-radius: 7px;
    font-size: 12px;
    text-align: center;
  }
  .tab.active {
    border-left: 0;
    box-shadow: inset 0 -3px 0 var(--primary);
  }
  main { padding: 12px; }
  header {
    gap: 10px;
    margin-bottom: 14px;
    padding-bottom: 10px;
  }
  h1 { font-size: 24px; }
  h2 { font-size: 17px; }
  header p { font-size: 13px; }
  .actions { width: 100%; }
  .actions input, .actions button {
    min-height: 36px;
    font-size: 12px;
  }
  .panel { padding: 14px; }
  #shiftPanel {
    min-height: 92px;
    margin-bottom: 12px;
    border-left-width: 4px;
  }
  #shiftPanel .line {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: center;
  }
  #shiftStatus { font-size: 13px; }
  #shiftButton {
    min-width: 118px;
    min-height: 36px;
    padding: 8px 10px;
    font-size: 11px;
  }
  .primary-action {
    min-height: 46px;
    margin-bottom: 12px;
    font-size: 15px;
  }
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
  }
  .cards article {
    min-height: 76px;
    padding: 12px;
  }
  .cards span { font-size: 12px; }
  .cards b { font-size: 28px; }
  .finance-cards {
    grid-template-columns: 1fr;
  }
  .finance-bar-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }
  .finance-bar-row b {
    text-align: left;
  }
  .wimax-map {
    min-height: 360px;
  }
  .latest article {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 11px;
  }
  .latest article button {
    width: 100%;
    min-height: 38px;
    justify-content: center;
    font-size: 12px;
  }
  .latest .status {
    margin-left: 0;
    margin-top: 5px;
  }
  .login-screen { padding: 14px; }
  .login-card { padding: 22px; }
  .login-card h1 { font-size: 30px; }
  .login-card p { font-size: 16px; }
  .formgrid, .formgrid.small { grid-template-columns: 1fr; }
  .order-form-panel {
    padding: 12px;
  }
  .order-form-panel .line {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    align-items: center;
  }
  .order-form-panel .line h2 {
    margin-bottom: 0;
  }
  .order-form-panel .line button {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 12px;
  }
  .order-form-panel label {
    font-size: 12px;
  }
  .order-form-panel input,
  .order-form-panel select,
  .order-form-panel textarea {
    min-height: 38px;
    padding: 8px;
    font-size: 13px;
  }
  .order-filters {
    grid-template-columns: 1fr;
  }
  .worked-days-form {
    grid-template-columns: 1fr;
    width: 100%;
  }
  .fleet-card-head {
    grid-template-columns: 1fr;
  }
  .fleet-docs .button-link {
    width: 100%;
    justify-content: center;
  }
  .pager {
    align-items: stretch;
    flex-direction: column;
  }
  .pager div {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .pager button {
    width: 100%;
  }
  .photos-block {
    margin-top: 12px;
    padding-top: 12px;
  }
  .photos-block h3 {
    font-size: 14px;
  }
  .photos-block input[type="file"] {
    min-height: 36px;
    font-size: 12px;
  }
  .material-line { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .payroll-table {
    display: table;
    overflow: visible;
    white-space: normal;
  }
  .payroll-table thead { display: none; }
  .payroll-table,
  .payroll-table tbody,
  .payroll-table tr,
  .payroll-table td {
    display: block;
    width: 100%;
  }
  .payroll-table tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    background: #fff;
  }
  .payroll-table td {
    border-bottom: 0;
    padding: 3px 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .payroll-table td:first-child::before {
    content: "Documento";
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 2px;
  }
  .payroll-table td:last-child {
    padding-top: 8px;
    text-align: left;
  }
  .payroll-table .button-link {
    width: 100%;
    justify-content: center;
    min-height: 40px;
    background: var(--primary);
    color: white;
  }
  .tech-table {
    display: table;
    overflow: visible;
    white-space: normal;
  }
  .tech-table thead { display: none; }
  .tech-table,
  .tech-table tbody,
  .tech-table tr,
  .tech-table td {
    display: block;
    width: 100%;
  }
  .tech-table tr {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
    background: #fff;
  }
  .tech-table td {
    border-bottom: 0;
    padding: 4px 0;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  .tech-table td::before {
    display: block;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 2px;
  }
  .tech-table td:nth-child(1)::before { content: "Usuario"; }
  .tech-table td:nth-child(2)::before { content: "Nombre"; }
  .tech-table td:nth-child(3)::before { content: "Email"; }
  .tech-table td:nth-child(4)::before { content: "Rol"; }
  .tech-table td:nth-child(5)::before { content: "Telefono"; }
  .tech-table td:nth-child(6)::before { content: "Zona"; }
  .tech-table td:last-child {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-top: 10px;
  }
  .tech-table td:last-child::before { content: ""; display: none; }
  .tech-table td:last-child button,
  .tech-table td:last-child select {
    flex: 1 1 130px;
    min-height: 38px;
  }
  #tecnicos.planning-mode .tech-table tr {
    border: 0;
    padding: 0;
    background: transparent;
  }
  #tecnicos.planning-mode .tech-table td::before {
    display: none;
  }
  .planning-tech-card article {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .planning-tech-card button {
    justify-self: stretch;
    width: 100%;
  }
  .participant-line {
    grid-template-columns: 1fr;
  }
  .absence-calendar {
    gap: 5px;
  }
  .absence-day {
    min-height: 58px;
    padding: 6px;
    font-size: 11px;
  }
  .absence-day span {
    font-size: 9px;
    padding: 2px 3px;
    overflow-wrap: anywhere;
  }
}
