  @import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Nunito:ital,wght@0,400;0,500;0,600;0,700;0,800;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

  :root {
    --amalfi-yellow: #F0E02A;
    --amalfi-yellow-bright: #FCEF4C;
    --amalfi-yellow-deep: #D8C700;
    --amalfi-yellow-soft: #FBF7C4;
    --amalfi-gray: #707070;
    --amalfi-gray-dark: #4D4D4D;
    --amalfi-gray-darker: #333333;
    --amalfi-teal: #4FB6B6;
    --amalfi-teal-dark: #2F8F8F;
    --amalfi-teal-soft: #DBF0F0;
    --amalfi-lime: #A9D06B;
    --amalfi-lime-dark: #7FA843;
    --amalfi-black: #1D1D1B;

    --neutral-0: #FFFFFF;
    --neutral-25: #FAFAFA;
    --neutral-50: #F4F4F4;
    --neutral-100: #ECECEC;
    --neutral-200: #DCDCDC;
    --neutral-300: #C0C0C0;
    --neutral-400: #9A9A9A;
    --neutral-500: #707070;
    --neutral-700: #404040;
    --neutral-900: #1D1D1B;

    --success: #6FAF3C; --success-soft: #E9F3D6;
    --warning: #E9B21E; --warning-soft: #FBEFC9;
    --danger: #D64545;  --danger-soft: #F7DEDE;
    --info: #4FB6B6;    --info-soft: #DBF0F0;

    --text-heading: var(--amalfi-gray-dark);
    --text-body: var(--neutral-700);
    --text-muted: var(--neutral-500);
    --surface-page: var(--neutral-25);
    --surface-card: var(--neutral-0);
    --border-subtle: var(--neutral-200);
    --border-default: var(--neutral-300);

    --font-display: 'Fredoka', 'Trebuchet MS', sans-serif;
    --font-body: 'Nunito', 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, monospace;

    --radius-lg: 18px;
    --radius-md: 12px;
    --radius-pill: 999px;
    --shadow-sm: 0 1px 3px rgba(29,29,27,0.08), 0 1px 2px rgba(29,29,27,0.06);
    --shadow-md: 0 4px 12px rgba(29,29,27,0.10);
  }

  * { box-sizing: border-box; }

  body {
    margin: 0;
    font-family: var(--font-body);
    background: var(--surface-page);
    color: var(--text-body);
    -webkit-font-smoothing: antialiased;
  }

  .app { max-width: 1280px; margin: 0 auto; padding: 20px 24px 60px; }

  /* ---------- Header ---------- */
  .topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 16px; padding: 14px 0 20px; flex-wrap: wrap;
  }
  .brand { display: flex; align-items: center; gap: 12px; }
  .brand-badge {
    width: 42px; height: 42px; border-radius: var(--radius-md);
    background: var(--amalfi-yellow); display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display); font-weight: 700; color: var(--amalfi-gray-darker); font-size: 18px;
    box-shadow: var(--shadow-sm);
  }
  .brand h1 {
    font-family: var(--font-display); font-weight: 600; font-size: 22px; margin: 0;
    color: var(--text-heading); line-height: 1.2;
  }
  .brand .subtitle { font-size: 13px; color: var(--text-muted); margin-top: 1px; }
  .sync-info { font-size: 12.5px; color: var(--text-muted); text-align: right; }
  .sync-info .dot {
    display: inline-block; width: 7px; height: 7px; border-radius: 50%;
    background: var(--success); margin-right: 5px;
  }

  /* ---------- Filters ---------- */
  .filters {
    background: var(--surface-card); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-sm);
    display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 20px;
  }
  .field { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
  .field label {
    font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-muted); font-weight: 700;
  }
  .field input, .field select {
    font-family: var(--font-body); font-size: 14px; padding: 8px 10px;
    border: 1.5px solid var(--border-default); border-radius: 10px; background: var(--neutral-0);
    color: var(--text-body);
  }
  .field input:focus, .field select:focus {
    outline: none; border-color: var(--amalfi-teal); box-shadow: 0 0 0 3px var(--amalfi-teal-soft);
  }
  .field.search { flex: 1 1 200px; }
  .btn {
    font-family: var(--font-body); font-weight: 700; font-size: 14px;
    padding: 9px 16px; border-radius: var(--radius-pill); border: none; cursor: pointer;
    transition: transform 120ms ease, background 120ms ease;
  }
  .btn:active { transform: scale(0.97); }
  .btn-primary { background: var(--amalfi-yellow); color: var(--amalfi-gray-darker); }
  .btn-primary:hover { background: var(--amalfi-yellow-bright); }
  .btn-ghost { background: var(--neutral-100); color: var(--text-body); }
  .btn-ghost:hover { background: var(--neutral-200); }

  /* ---------- KPI cards ---------- */
  .kpi-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px; margin-bottom: 20px;
  }
  .stat-card {
    background: var(--surface-card); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg); padding: 16px; box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--amalfi-yellow);
  }
  .stat-card .label {
    font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--text-muted); font-weight: 700; margin-bottom: 6px;
  }
  .stat-card .value {
    font-family: var(--font-display); font-size: 28px; font-weight: 600; color: var(--text-heading);
    line-height: 1.1;
  }
  .stat-card .value .unit { font-size: 14px; font-weight: 500; color: var(--text-muted); margin-left: 3px; }
  .stat-card.accent-teal { border-top-color: var(--amalfi-teal); }
  .stat-card.accent-lime { border-top-color: var(--amalfi-lime); }
  .stat-card.accent-gray { border-top-color: var(--amalfi-gray); }

  /* ---------- Panels / Charts ---------- */
  .panel-row { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; margin-bottom: 20px; }
  @media (max-width: 860px) { .panel-row { grid-template-columns: 1fr; } }
  .panel {
    background: var(--surface-card); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg); padding: 18px; box-shadow: var(--shadow-sm);
  }
  .panel h3 {
    font-family: var(--font-display); font-size: 16px; font-weight: 600; margin: 0 0 12px;
    color: var(--text-heading);
  }
  .panel canvas { max-width: 100%; }

  /* ---------- Cumplimiento chips ---------- */
  .chip-grid { display: flex; flex-wrap: wrap; gap: 8px; }
  .chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px;
    border-radius: var(--radius-pill); font-size: 13px; font-weight: 700;
    background: var(--neutral-100); color: var(--text-body);
  }
  .chip .dot { width: 8px; height: 8px; border-radius: 50%; }
  .chip.ok { background: var(--success-soft); color: #3F6B23; }
  .chip.ok .dot { background: var(--success); }
  .chip.warn { background: var(--warning-soft); color: #7A5B0A; }
  .chip.warn .dot { background: var(--warning); }
  .chip.bad { background: var(--danger-soft); color: #7A2323; }
  .chip.bad .dot { background: var(--danger); }
  .chip.na { background: var(--neutral-100); color: var(--text-muted); }
  .chip.na .dot { background: var(--neutral-400); }

  /* ---------- Table ---------- */
  .table-wrap {
    background: var(--surface-card); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: hidden;
  }
  table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
  thead th {
    text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
    color: var(--text-muted); background: var(--neutral-50); padding: 10px 12px;
    border-bottom: 1px solid var(--border-subtle); position: sticky; top: 0;
  }
  tbody td { padding: 10px 12px; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
  tbody tr:hover { background: var(--neutral-25); }
  .mono { font-family: var(--font-mono); font-size: 12.5px; }
  .obs-cell { max-width: 220px; color: var(--text-muted); font-style: italic; }
  .photo-btn {
    display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px;
    border-radius: var(--radius-pill); border: 1.5px solid var(--amalfi-teal); background: var(--amalfi-teal-soft);
    color: var(--amalfi-teal-dark); font-weight: 700; font-size: 12.5px; cursor: pointer;
  }
  .no-photo { color: var(--neutral-400); font-size: 12.5px; }
  .empty-state { padding: 40px 20px; text-align: center; color: var(--text-muted); }

  /* ---------- Lightbox ---------- */
  .lightbox-overlay {
    position: fixed; inset: 0; background: rgba(29,29,27,0.78);
    display: none; align-items: center; justify-content: center; z-index: 1000; padding: 24px;
  }
  .lightbox-overlay.open { display: flex; }
  .lightbox-box {
    background: var(--neutral-0); border-radius: var(--radius-lg); padding: 16px; max-width: 900px; width: 100%;
    max-height: 90vh; overflow: auto;
  }
  .lightbox-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
  .lightbox-head h4 { margin: 0; font-family: var(--font-display); color: var(--text-heading); }
  .lightbox-close { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-muted); }
  .lightbox-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }
  .lightbox-item { display: flex; flex-direction: column; gap: 6px; }
  .lightbox-item img {
    width: 100%; border-radius: var(--radius-md); border: 1px solid var(--border-subtle);
    display: block; background: var(--neutral-50);
  }
  .photo-download-btn {
    align-self: flex-start; padding: 4px 10px; border-radius: var(--radius-pill);
    border: 1.5px solid var(--amalfi-teal); background: var(--neutral-0);
    color: var(--amalfi-teal-dark); font-weight: 700; font-size: 12px; cursor: pointer;
  }
  .photo-download-btn:disabled { opacity: 0.6; cursor: default; }

  /* =====================================================================
     Tablero multi-servicio (portada + pestañas) — Barrido, Lavado, Poda,
     Cestas y líneas de servicio aún sin registros en la aplicación.
     ===================================================================== */
  .lx { --vg: var(--amalfi-lime-dark); --am: var(--amalfi-yellow); --te: var(--amalfi-teal); --gy: var(--amalfi-gray); --ink: var(--amalfi-gray-dark); max-width: 1280px; margin-inline: auto; font-family: var(--font-body); position: relative; }
  .lx * { box-sizing: border-box; }
  .lx h1 { font-family: var(--font-display); font-weight: 600; font-size: 22px; color: var(--text-heading); margin: 0 0 4px; }
  .lx .lx-take { margin: 0; color: var(--text-muted); max-width: 70ch; font-size: 13.5px; }
  .lx .lx-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; margin-bottom: 16px; }
  .lx label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--text-muted); letter-spacing: .04em; text-transform: uppercase; font-weight: 700; }
  .lx select, .lx button.lx-btn { font: inherit; font-size: 14px; color: var(--text-body); background: var(--surface-card); border: 1.5px solid var(--border-default); border-radius: 10px; padding: 8px 10px; min-width: 11rem; }
  .lx button.lx-btn { min-width: 0; cursor: pointer; font-weight: 700; }
  .lx select:focus-visible, .lx button:focus-visible { outline: 2px solid var(--vg); outline-offset: 2px; }
  .lx .lx-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10.5rem), 1fr)); gap: 14px; margin-bottom: 16px; }
  .lx .lx-card { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 16px; min-width: 0; box-shadow: var(--shadow-sm); }
  .lx .lx-kpi small { display: block; color: var(--text-muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
  .lx .lx-kpi strong { display: block; font-family: var(--font-display); font-weight: 600; font-size: 28px; line-height: 1.15; font-variant-numeric: tabular-nums; margin: 3px 0; color: var(--text-heading); }
  .lx .lx-kpi span { color: var(--text-muted); font-size: 12px; }
  .lx .lx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: 16px; margin-bottom: 16px; }
  .lx h2 { font-size: 16px; font-weight: 600; margin: 0 0 3px; color: var(--text-heading); font-family: var(--font-display); }
  .lx .lx-note { margin: 0 0 10px; color: var(--text-muted); font-size: 12px; }
  .lx .lx-chart { min-height: 120px; }
  .lx .lx-legend { display: flex; gap: 16px; font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
  .lx .lx-legend i { display: inline-block; width: .7rem; height: .7rem; border-radius: 2px; margin-right: .3rem; vertical-align: -1px; }
  .lx .lx-tablebox { overflow: auto; max-height: 26rem; }
  .lx table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 12.5px; }
  .lx th, .lx td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
  .lx th:nth-child(1), .lx td:nth-child(1), .lx th:nth-child(2), .lx td:nth-child(2) { text-align: left; }
  .lx td:nth-child(2) { white-space: normal; min-width: 14rem; }
  .lx th { position: sticky; top: 0; background: var(--neutral-50); color: var(--text-muted); font-weight: 700; cursor: pointer; }
  .lx tr.sel td { background: var(--amalfi-yellow-soft); }
  .lx .lx-acts { display: flex; flex-wrap: wrap; gap: 8px; }
  .lx .lx-pill { border: 1px dashed var(--border-default); border-radius: 999px; padding: .3rem .75rem; font-size: 12px; color: var(--text-muted); }
  .lx .lx-pill b { color: var(--text-body); font-weight: 500; }
  .lx ul.lx-obs { margin: 0; padding: 0; list-style: none; display: grid; gap: 10px; }
  .lx ul.lx-obs li { font-size: 13.5px; }
  .lx ul.lx-obs em { color: var(--text-muted); font-style: normal; font-size: 12px; display: block; }
  .lx .lx-tip { position: absolute; pointer-events: none; z-index: 5; background: var(--surface-card); border: 1px solid var(--border-default); border-radius: 10px; box-shadow: var(--shadow-md); padding: 6px 10px; font-size: 12px; max-width: 16rem; }
  .lx .lx-tip[hidden] { display: none; }
  .lx .lx-foot { color: var(--text-muted); font-size: 12px; margin: 16px 0 0; max-width: 80ch; }
  .lx .lx-tabs { display: flex; flex-wrap: wrap; gap: .4rem; margin: 0 0 16px; border-bottom: 1px solid var(--border-subtle); padding-bottom: 10px; }
  .lx .lx-tab { font: inherit; font-size: 14px; background: transparent; color: var(--text-muted); border: 1px solid transparent; border-radius: 999px; padding: 7px 16px; cursor: pointer; font-weight: 600; }
  .lx .lx-tab:hover { color: var(--text-body); }
  .lx .lx-tab[aria-selected="true"] { background: var(--amalfi-yellow); color: var(--amalfi-gray-darker); border-color: var(--amalfi-yellow-deep); font-weight: 700; }
  .lx .lx-tab:focus-visible { outline: 2px solid var(--vg); outline-offset: 2px; }
  .lx .lx-page[hidden] { display: none; }
  .lx .lx-gal { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 10px; }
  .lx .lx-ph { position: relative; border: 0; padding: 0; background: var(--neutral-50); border-radius: 10px; overflow: hidden; aspect-ratio: 1; cursor: zoom-in; }
  .lx .lx-ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .lx .lx-ph span { position: absolute; left: 0; right: 0; bottom: 0; padding: .25rem .4rem; font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7)); text-align: left; }
  .lx .lx-ph:focus-visible { outline: 2px solid var(--am); outline-offset: 2px; }
  .lx .lx-more { margin-top: 16px; }
  .lx .lx-svc { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 16px; margin-bottom: 16px; }
  .lx .lx-s { text-align: left; font: inherit; color: inherit; cursor: pointer; }
  .lx .lx-s h3 { margin: 0 0 3px; font-size: 14px; font-weight: 700; color: var(--text-heading); }
  .lx .lx-s p { margin: 0; color: var(--text-muted); font-size: 12px; }
  .lx .lx-s .st { display: inline-block; margin-top: 6px; font-size: 11px; border-radius: 999px; padding: 2px 10px; background: var(--success-soft); color: var(--text-body); }
  .lx .lx-s:focus-visible { outline: 2px solid var(--vg); outline-offset: 2px; }
  .lx .lx-lb { position: fixed; inset: 0; z-index: 1000; background: rgba(29,29,27,.86); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 1rem; }
  .lx .lx-lb[hidden] { display: none; }
  .lx .lx-lb img { max-width: min(92vw, 900px); max-height: 74vh; border-radius: 8px; }
  .lx .lx-lb .cap { color: #fff; font-size: 14px; }
  .lx .lx-lb .nav { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
  .lx .lx-lb button { font: inherit; background: rgba(255,255,255,.14); color: #fff; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 6px 16px; cursor: pointer; }
  .lx .lx-lb button:focus-visible { outline: 2px solid var(--am); }
  .lx .lx-empty { color: var(--text-muted); font-size: 14px; margin: 0; }
  .lx table.lx-t th, .lx table.lx-t td { text-align: right; }
  .lx table.lx-t th.l, .lx table.lx-t td.l { text-align: left; }
  .lx table.lx-t td.wrap { white-space: normal; min-width: 12rem; }
  .lx .lx-hd { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 16px 20px; margin-bottom: 0; box-shadow: var(--shadow-sm); }
  .lx .lx-hd > div { flex: 1 1 18rem; min-width: 0; }
  .lx .lx-hd h1 { margin: 0 0 4px; }
  .lx .lx-hd .lx-take { margin: 0; }
  .lx .lx-logo { height: 52px; width: auto; display: block; }
  .lx .lx-swoosh { height: 6px; border-radius: 0 0 6px 6px; margin: 0 .5rem 16px; background: linear-gradient(90deg, var(--amalfi-yellow) 0%, var(--amalfi-yellow) 35%, var(--amalfi-lime) 65%, var(--amalfi-teal) 100%); }
  .lx .lx-gbar { background: var(--surface-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 10px 14px; box-shadow: var(--shadow-sm); }
  .lx .lx-fnote { font-size: 12px; color: var(--amalfi-teal-dark); font-weight: 700; align-self: center; }
  .lx .lx-card.lx-kpi { border-top: 3px solid var(--vg); }
  .lx .lx-card.lx-kpi:nth-child(2n) { border-top-color: var(--am); }
  .lx .lx-card.lx-kpi:nth-child(3n) { border-top-color: var(--te); }
