/* ================================================
   GESTIÓN DE OBRAS — STYLESHEET
   ================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --c-nueva:     #3b82f6;
    --c-agendada:  #10b981;
    --c-pendiente: #f59e0b;
    --c-terminada: #ef4444;
    --c-cobrado:   #6b7280;
    --c-bg:        #f1f5f9;
    --c-white:     #ffffff;
    --c-text:      #0f172a;
    --c-muted:     #475569;
    --c-border:    #e2e8f0;
    --radius:      6px;
    --shadow:      0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
    --shadow-md:   0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
    line-height: 1.4;
    font-size: 12px;
}

/* ---- LOGIN ---- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 1rem;
}
.login-container {
    background: var(--c-white);
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    padding: 0.85rem 0.95rem;
    width: 100%;
    max-width: 260px;
    text-align: center;
}
.login-logo { font-size: 1.4rem; margin-bottom: 0.2rem; }
.login-container h1 { font-size: 1.15rem; font-weight: 800; margin-bottom: 0.9rem; line-height: 1.3; }
.login-container {
    max-width: 320px;
    padding: 1.25rem 1.15rem;
}
.login-container .form-group { margin-bottom: 1rem; }
.login-container .form-group label { font-size: 0.95rem; margin-bottom: 0.4rem; }
.login-container .form-group input[type="text"],
.login-container .form-group input[type="password"] {
    padding: 0.65rem 0.75rem;
    font-size: 1rem;
    min-height: 44px;
    border-radius: 10px;
}
.login-container .form-group input[type="checkbox"] { width: 1.4rem; height: 1.4rem; }
.login-container .btn-primary {
    padding: 0.75rem 1rem;
    font-size: 1rem;
    min-height: 52px;
    border-radius: 10px;
}
.login-container .alert { font-size: 0.95rem; padding: 0.65rem 0.85rem; }

/* ---- FORMS ---- */
.form-group { margin-bottom: 0.85rem; text-align: left; }
.form-group label {
    display: block;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--c-text);
    margin-bottom: 0.35rem;
    letter-spacing: .02em;
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.32rem 0.5rem;
    border: 1.5px solid var(--c-border);
    border-radius: var(--radius);
    font-size: 0.78rem;
    font-family: inherit;
    color: var(--c-text);
    background: var(--c-white);
    transition: border-color .15s;
    min-height: 26px;
}
.form-group input[type="checkbox"],
.form-group input[type="radio"] { min-height: auto; padding: 0; width: 1.25rem; height: 1.25rem; cursor: pointer; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--c-nueva);
    box-shadow: 0 0 0 4px rgba(59,130,246,.2);
}
.form-group textarea { resize: vertical; min-height: 52px; font-size: 0.78rem; line-height: 1.35; padding: 0.35rem 0.5rem; }

/* ---- BUTTONS ---- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .25rem;
    padding: 0.35rem 0.75rem;
    min-height: 28px;
    border: none;
    border-radius: var(--radius);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    transition: filter .15s, transform .1s;
    line-height: 1.3;
    white-space: nowrap;
}
.btn:active          { transform: scale(.97); }
.btn:hover           { filter: brightness(.93); }
.btn-primary         { background: #3b82f6; color: #fff; }
.btn-success         { background: #059669; color: #fff; }
.btn-warning         { background: #d97706; color: #fff; }
.btn-danger          { background: #dc2626; color: #fff; }
.btn-secondary       { background: var(--c-border); color: var(--c-text); }
.btn-dark            { background: var(--c-text);   color: #fff; }
.btn-full            { width: 100%; }
.btn-sm              { padding: 0.2rem 0.5rem; font-size: 0.7rem; min-height: 26px; }

/* ---- ALERTS ---- */
.alert {
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    margin-bottom: 0.6rem;
    font-size: 0.78rem;
    line-height: 1.45;
}
.alert-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }

/* ---- STATUS BADGES ---- */
.badge {
    display: inline-block;
    padding: 0.12rem 0.4rem;
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
}
.badge-nueva     { background: #dbeafe; color: #1d4ed8; }
.badge-agendada  { background: #d1fae5; color: #065f46; }
.badge-pendiente { background: #fef3c7; color: #92400e; }
.badge-instalada { background: #cffafe; color: #0e7490; }
.badge-terminada { background: #fee2e2; color: #991b1b; }
.badge-cobrado   { background: #f1f5f9; color: #475569; }
/* Instalador: badges en tonos neutros */
body.instalador-view .badge-nueva,
body.instalador-view .badge-agendada,
body.instalador-view .badge-pendiente,
body.instalador-view .badge-instalada,
body.instalador-view .badge-terminada,
body.instalador-view .badge-cobrado { background: #f1f5f9; color: #475569; }

/* ---- TOPNAV ---- */
.nav {
    background: var(--c-text);
    color: #fff;
    padding: 0.4rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.nav-brand {
    font-size: 0.9rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: .5rem;
    color: #fff;
    text-decoration: none;
}
.nav-links {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}
.nav-links a {
    color: #cbd5e1;
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
    padding: .5rem .75rem;
    border-radius: 8px;
    transition: color .15s, background .15s;
}
.nav-links a:hover { color: #fff; background: rgba(255,255,255,.1); }
.nav-links a.active { color: #fff; font-weight: 700; background: rgba(255,255,255,.15); }
.nav-logout {
    font-size: 1rem;
    color: #94a3b8;
    padding: .5rem .75rem;
}
.nav-logout:hover { color: #94a3b8; }

/* ---- OFICINA: Menú estilo instalador (hamburger + drawer) ---- */
.nav-oficina {
    padding: 0 1.5rem;
}
.nav-oficina-inner {
    flex: 1;
    max-width: 1000px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 32px;
}
.nav-oficina-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.nav-oficina .nav-brand {
    font-size: 0.95rem;
    font-weight: 800;
    flex-shrink: 0;
    color: #fff;
    text-decoration: none;
}
.nav-oficina-links {
    display: flex;
    align-items: center;
    gap: 1rem;
}
.nav-oficina-link {
    padding: .32rem .7rem;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #cbd5e1;
    text-decoration: none;
    transition: color .15s, background .15s;
}
.nav-oficina-link:hover {
    color: #fff;
    background: rgba(255,255,255,.08);
}
.nav-oficina-link.active {
    color: #fff;
    font-weight: 600;
    background: rgba(255,255,255,.12);
}
.nav-oficina-btn {
    padding: .4rem .85rem;
    min-height: 30px;
    background: #fff;
    color: var(--c-text) !important;
    font-weight: 700;
    font-size: 0.8rem;
    border-radius: 8px;
    text-decoration: none;
    transition: transform .1s, box-shadow .15s;
}
.nav-oficina-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.drawer-item.active { background: #eff6ff; color: var(--c-nueva); font-weight: 700; }

/* ---- INSTALADOR: HAMBURGER + DRAWER MENU — grandes para pulgares ---- */
.nav-hamburger {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    line-height: 1;
    padding: .5rem .6rem;
    min-width: 48px;
    min-height: 48px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.nav-hamburger:hover { opacity: .9; }
.nav-hamburger:active { opacity: .8; }

.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s, visibility .2s;
}
.drawer-overlay[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
}

.drawer-panel {
    position: fixed;
    top: 0;
    left: 0;
    width: min(280px, 85vw);
    height: 100%;
    background: var(--c-white);
    z-index: 1000;
    box-shadow: 4px 0 20px rgba(0,0,0,.15);
    transform: translateX(-100%);
    transition: transform .25s ease-out;
    display: flex;
    flex-direction: column;
}
.drawer-panel[aria-hidden="false"] {
    transform: translateX(0);
}

.drawer-header {
    padding: 0.85rem 0.85rem;
    border-bottom: 1px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--c-text);
    color: #fff;
}
.drawer-user {
    font-weight: 700;
    font-size: 0.85rem;
}
.drawer-close {
    background: rgba(255,255,255,.2);
    border: none;
    color: #fff;
    font-size: 1.3rem;
    min-width: 48px;
    min-height: 48px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}
.drawer-close:hover { background: rgba(255,255,255,.3); }

.drawer-nav {
    padding: 1rem 0;
    flex: 1;
    display: flex;
    flex-direction: column;
}
.drawer-item {
    padding: 1rem 1rem;
    min-height: 52px;
    color: var(--c-text);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 600;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    -webkit-tap-highlight-color: transparent;
}
.drawer-item:hover { background: var(--c-bg); }
.drawer-item:active { background: var(--c-border); }
.drawer-logout {
    color: var(--c-muted);
    margin-top: auto;
    border-top: 1px solid var(--c-border);
    padding-top: 1.25rem;
    margin-top: .5rem;
}
.drawer-logout:hover { color: #dc2626; background: #fef2f2; }

body.drawer-open { overflow: hidden; }

/* ---- LAYOUT ---- */
.container {
    width: 100%;
    max-width: min(960px, 95vw);
    margin: 0 auto;
    padding: 0.7rem 0.65rem;
    box-sizing: border-box;
}

/* ---- OFICINA PAGE ---- */
.oficina-page {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    min-height: 100vh;
}
.oficina-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
    padding: 0.6rem 0.85rem;
    background: var(--c-white);
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--c-border);
}
.oficina-buscar-form { flex: 1; min-width: 280px; }
.oficina-buscar-wrap {
    display: flex;
    gap: .75rem;
    flex-wrap: wrap;
    align-items: center;
}
.oficina-buscar-wrap .oficina-buscar-icon {
    font-size: 1.1rem;
    opacity: .7;
}
.oficina-buscar-input {
    flex: 1;
    min-width: 140px;
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
    border: 2px solid var(--c-border);
    border-radius: 10px;
    background: #fafbfc;
    min-height: 28px;
}
.oficina-buscar-input:focus {
    outline: none;
    border-color: var(--c-nueva);
    box-shadow: 0 0 0 4px rgba(59,130,246,.15);
}
.oficina-instalador-form {
    display: flex;
    align-items: center;
    gap: .75rem;
}
.oficina-filter-label {
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--c-text);
    text-transform: uppercase;
}
.oficina-instalador-select {
    padding: 0.32rem 0.6rem;
    font-size: 0.8rem;
    border: 2px solid var(--c-border);
    border-radius: 10px;
    background: var(--c-white);
    min-width: 120px;
    min-height: 28px;
}
.btn-ghost {
    background: transparent;
    color: var(--c-muted);
    border: 1px solid transparent;
}
.btn-ghost:hover { background: #f1f5f9; color: var(--c-text); }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    border: 0;
}

/* ---- STAT CARDS ---- */
.oficina-instalador-form {
    display: flex;
    align-items: center;
    gap: .5rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(65px, 1fr));
    gap: 0.5rem;
    margin-bottom: 0.85rem;
}
.stat-card {
    background: var(--c-white);
    border-radius: 6px;
    padding: 0.55rem 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .2s;
    text-decoration: none;
    color: inherit;
    display: block;
}
.stat-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    transform: translateY(-1px);
}
.stat-card.active {
    border-color: var(--c-nueva);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.stat-num {
    font-size: 1.15rem;
    font-weight: 900;
    line-height: 1.1;
    margin-bottom: .2rem;
    letter-spacing: -0.02em;
}
.stat-label {
    font-size: 0.58rem;
    color: var(--c-text);
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.stat-card.stat-terminada .stat-num { color: #dc2626; }
.stat-card.stat-terminada { background: linear-gradient(180deg, #fff5f5 0%, #fff 100%); }
.stat-card.stat-terminada:hover { box-shadow: 0 4px 12px rgba(220,38,38,.12); }

/* ---- ALERT BANNER ---- */
.alert-banner {
    background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
    border: 1.5px solid #fca5a5;
    border-radius: 6px;
    padding: 0.6rem 0.85rem;
    margin-bottom: 0.85rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: 0 2px 8px rgba(220,38,38,.06);
}
.alert-banner-icon { font-size: 1rem; flex-shrink: 0; }
.alert-banner-title { font-weight: 800; color: #991b1b; font-size: 0.8rem; }
.alert-banner-body { font-size: 0.74rem; color: #b91c1c; margin-top: .2rem; line-height: 1.4; }

/* ---- FILTER TABS ---- */
.filter-tabs {
    display: flex;
    gap: 0.3rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}
.filter-tab {
    padding: 0.28rem 0.7rem;
    min-height: 26px;
    border-radius: 5px;
    font-size: 0.72rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--c-text);
    background: var(--c-white);
    border: 2px solid var(--c-border);
    transition: all .15s;
}
.filter-tab:hover {
    border-color: var(--c-nueva);
    color: var(--c-nueva);
    background: rgba(59,130,246,.05);
}
.filter-tab.active {
    background: var(--c-text);
    color: #fff;
    border-color: var(--c-text);
}

/* ---- SECTION HEADER ---- */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.65rem;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.section-header h2 {
    font-size: 0.88rem;
    font-weight: 800;
    color: var(--c-text);
    letter-spacing: -0.02em;
}

/* ---- OBRAS TABLE (responsive) ---- */
.obras-table {
    background: var(--c-white);
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.04);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--c-border);
}
.obras-table table {
    width: 100%;
    min-width: 0;
    border-collapse: collapse;
    font-size: 0.76rem;
}
.obras-table thead th {
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    padding: 0.4rem 0.7rem;
    text-align: left;
    font-size: 0.62rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--c-text);
    border-bottom: 2px solid var(--c-border);
}
.obras-table tbody td {
    padding: 0.45rem 0.7rem;
    border-bottom: 1px solid var(--c-border);
    vertical-align: middle;
    line-height: 1.4;
}
.obras-table tbody tr:last-child td { border-bottom: none; }
.obras-table tbody tr:hover { background: #fafbfc; }
.obras-table tbody tr.row-instalada { background: #f0fdfa; }
.obras-table tbody tr.row-instalada:hover { background: #ccfbf1; }
.obras-table tbody tr.row-terminada { background: #fff5f5; }
.obras-table tbody tr.row-terminada:hover { background: #fee2e2; }

.obra-cliente { font-weight: 700; font-size: 0.78rem; color: var(--c-text); }
.obra-dir { font-size: 0.68rem; color: var(--c-muted); margin-top: .12rem; line-height: 1.32; }

/* Oficina tabla: botones Ver, Cobrado, Deshacer */
.oficina-row-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.oficina-btn-ver {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 6px;
    text-decoration: none;
    color: #1e40af;
    background: #dbeafe;
    border: 1px solid #93c5fd;
    transition: background .15s, color .15s;
}
.oficina-btn-ver:hover {
    background: #93c5fd;
    color: #1e3a8a;
}
.oficina-btn-cobrado {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 700;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    color: #fff;
    background: #059669;
    border: 1px solid #047857;
    font-family: inherit;
    transition: background .15s, filter .15s;
}
.oficina-btn-cobrado:hover { background: #047857; filter: brightness(1.05); }
.oficina-btn-deshacer {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.35rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid #cbd5e1;
    cursor: pointer;
    color: #64748b;
    background: transparent;
    font-family: inherit;
    transition: background .15s, color .15s;
}
.oficina-btn-deshacer:hover {
    background: #f1f5f9;
    color: #475569;
}

/* ---- DETAIL PAGE ---- */
.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
    margin-bottom: 0.85rem;
}
.detail-card {
    background: var(--c-white);
    border-radius: var(--radius);
    padding: 0.7rem;
    box-shadow: var(--shadow);
}
.detail-card h3 {
    font-size: 0.65rem;
    color: var(--c-text);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--c-border);
}
.detail-field         { margin-bottom: 0.75rem; }
.detail-field label   {
    display: block;
    font-size: 0.68rem;
    color: var(--c-text);
    font-weight: 700;
    letter-spacing: .02em;
    margin-bottom: .25rem;
}
.detail-field .value       { font-size: 0.78rem; color: var(--c-text); font-weight: 600; line-height: 1.4; }
.detail-field .value a     { color: var(--c-nueva); text-decoration: none; }
.detail-field .value a:hover { text-decoration: underline; }

/* ---- HISTORIAL ---- */
.historial-list { list-style: none; }
.historial-item {
    display: flex;
    gap: 0.5rem;
    padding: 0.4rem 0;
    border-bottom: 1px solid var(--c-border);
    font-size: 0.76rem;
    align-items: flex-start;
    line-height: 1.45;
}
.historial-item:last-child { border-bottom: none; }
.historial-date { color: var(--c-muted); white-space: nowrap; min-width: 100px; font-size: 0.7rem; line-height: 1.45; }
.historial-text { color: var(--c-text); }

/* ---- BACK LINK ---- */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    color: var(--c-text);
    text-decoration: none;
    font-size: 0.78rem;
    font-weight: 600;
    margin-bottom: 1rem;
    padding: .25rem 0;
}
.back-link:hover { color: var(--c-nueva); }

/* ---- PAGE TITLE ---- */
.page-title            { margin-bottom: 0.85rem; }
.page-title h1         { font-size: 1.05rem; font-weight: 800; }
.page-title p          { color: var(--c-muted); font-size: 0.75rem; margin-top: .15rem; }

/* ---- EMPTY STATE ---- */
.empty-state {
    text-align: center;
    padding: 1.5rem 1rem;
    color: var(--c-text);
    background: var(--c-white);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
    border: 2px dashed var(--c-border);
}
.empty-state-icon { font-size: 1.6rem; margin-bottom: 0.6rem; opacity: .8; }
.empty-state h3 { font-size: 0.88rem; margin-bottom: .2rem; color: var(--c-text); font-weight: 700; }
.empty-state p { font-size: 0.76rem; line-height: 1.4; color: var(--c-muted); }

/* ---- CARD ---- */
.card {
    background: var(--c-white);
    border-radius: var(--radius);
    padding: 0.85rem;
    box-shadow: var(--shadow);
    margin-bottom: 0.85rem;
}
.card h2 { font-size: 0.88rem; font-weight: 800; margin-bottom: 0.65rem; }

/* ---- USER ROWS ---- */
.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--c-border);
    flex-wrap: wrap;
    gap: 0.5rem;
}
.user-row:last-child { border-bottom: none; }
.user-name { font-weight: 700; font-size: 0.82rem; }
.user-sub  { font-size: 0.72rem; color: var(--c-muted); }

/* ============================================================
   INSTALADOR VIEW — very large, high-contrast, mobile-first
   ============================================================ */

body.instalador-view {
    font-size: 14px;
    background: #ecf0f5;
    line-height: 1.5;
}
body.instalador-view .nav { padding: 0.6rem 1rem; }
body.instalador-view .nav-brand { font-size: 1rem; padding: .5rem .4rem; min-height: 44px; align-items: center; }
body.instalador-view .nav-links a { font-size: 1rem; padding: .65rem 1rem; min-height: 44px; display: flex; align-items: center; }
body.instalador-view .back-link { font-size: 1rem; padding: .6rem .5rem; min-height: 48px; display: inline-flex; align-items: center; }

.instalador-greeting {
    text-align: center;
    padding: 0.5rem .6rem .1rem;
}
.instalador-greeting .greeting-name {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--c-text);
}
.instalador-greeting .greeting-sub {
    font-size: 0.74rem;
    color: var(--c-muted);
    margin-top: .25rem;
}

.obras-list-instalador {
    padding: .12rem 0.6rem 0.6rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: 460px;
    margin: 0 auto;
}
/* top-level wrapper (empty state only) */
.obras-list-instalador.standalone {
    padding-top: 1.1rem;
    padding-bottom: 1.5rem;
}

.obra-card-instalador {
    background: var(--c-white);
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    overflow: visible;
    border-left: 6px solid;
}
.obra-card-instalador.estado-nueva,
.obra-card-instalador.estado-pendiente { border-left-color: #d97706; }
.obra-card-instalador.estado-agendada   { border-left-color: #059669; }
.obra-card-instalador.estado-instalada  { border-left-color: #2563eb; }
.obra-card-instalador.estado-incidencias { border-left-color: #dc2626; }
.obra-card-instalador.estado-terminada,
.obra-card-instalador.estado-cobrado   { border-left-color: #94a3b8; }

.obra-card-header  { padding: 0.6rem 0.75rem 0.5rem; }
.obra-card-cliente {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--c-text);
    line-height: 1.3;
    margin-bottom: .4rem;
}
.obra-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .6rem;
    align-items: center;
    margin-bottom: .5rem;
}
.obra-card-meta .tel-link {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--c-text);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .5rem .65rem;
    margin: -.25rem -.2rem;
    border-radius: 10px;
    -webkit-tap-highlight-color: rgba(59,130,246,.15);
}
.obra-card-meta .tel-link:active { background: #f1f5f9; }
.obra-card-dir {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--c-text);
    margin-bottom: .4rem;
    display: flex;
    align-items: flex-start;
    gap: .3rem;
}
.obra-card-desc {
    font-size: 0.92rem;
    color: var(--c-text);
    background: #f8fafc;
    border-radius: 6px;
    padding: .5rem .7rem;
    margin-top: .4rem;
    line-height: 1.5;
    border-left: 3px solid #cbd5e1;
}
/* Link button inside installer card — destacado y fácil de pulsar */
.obra-enlace-btn {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-top: .5rem;
    padding: .65rem .9rem;
    min-height: 48px;
    background: #eff6ff;
    border: 1.5px solid #93c5fd;
    border-radius: 10px;
    color: #1d4ed8;
    font-size: .95rem;
    font-weight: 700;
    text-decoration: none;
    word-break: break-all;
}
.obra-enlace-btn:active { background: #dbeafe; }

/* Fila header con ver incidencias + menú */
.obra-card-header-row {
    display: flex; align-items: center; justify-content: space-between;
    gap: .5rem; margin-top: .35rem; flex-wrap: wrap;
}
/* Ver incidencias en el card (fuera del menú) — fácil de pulsar */
.obra-card-ver-incidencias {
    display: inline-flex; align-items: center;
    font-size: .9rem; font-weight: 700; color: #b45309;
    text-decoration: none; padding: .6rem .85rem; min-height: 44px;
    background: #fffbeb; border: 1px solid #fcd34d;
    border-radius: 10px;
}
.obra-card-ver-incidencias:hover { background: #fef3c7; color: #92400e; }
.obra-card-ver-incidencias:active { background: #fde68a; }

/* Card menu ⋯ — mínimo 48px para pulgares */
.obra-card-menu-wrap { position: relative; flex-shrink: 0; }
.obra-card-menu-btn {
    display: flex; align-items: center; justify-content: center;
    min-width: 48px; min-height: 48px; padding: 0;
    background: #f8fafc; border: 1px solid var(--c-border);
    border-radius: 12px; box-shadow: 0 1px 2px rgba(0,0,0,.05);
    cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.obra-card-menu-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }
.obra-card-menu-btn:active { background: #e2e8f0; }
.obra-card-menu-dots {
    font-size: 1.4rem; font-weight: 700; color: var(--c-muted);
    line-height: 1;
}
.obra-card-menu-btn:hover .obra-card-menu-dots { color: var(--c-text); }

/* Dialog overlay */
.obra-card-menu-dialog {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; align-items: flex-end; justify-content: center;
    padding: 0;
}
.obra-card-menu-dialog[hidden] { display: none !important; }
.obra-card-menu-backdrop {
    position: absolute; inset: 0;
    background: rgba(0,0,0,.45);
    animation: obra-dialog-fade-in .2s ease-out;
}
.obra-card-menu-dropdown {
    position: relative; width: 100%; max-width: 400px;
    background: var(--c-white); border-radius: 16px 16px 0 0;
    padding: 1rem 1.25rem 1.5rem; padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 20px rgba(0,0,0,.15);
    animation: obra-dialog-slide-up .25s ease-out;
}
@keyframes obra-dialog-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes obra-dialog-slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
.obra-card-menu-item {
    display: flex; align-items: center; gap: .85rem; width: 100%;
    padding: 1rem 1.15rem; margin-bottom: .35rem; text-align: left;
    min-height: 52px; font-size: 1rem; font-weight: 600; text-decoration: none;
    color: var(--c-text); background: #f8fafc; border: none; border-radius: 12px;
    cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.obra-card-menu-item:hover { background: #f1f5f9; }
.obra-card-menu-item:active { background: #e2e8f0; }
.obra-card-menu-item:focus { outline: none; }
button.obra-card-menu-item { font-family: inherit; }
.obra-card-menu-icon { font-size: 1.2rem; flex-shrink: 0; opacity: .9; }
.obra-card-menu-close {
    display: block; width: 100%; margin-top: 1rem; padding: 1rem 1.2rem;
    min-height: 56px; font-size: 1rem; font-weight: 700; background: var(--c-text); color: #fff;
    border: none; border-radius: 12px; cursor: pointer;
    font-family: inherit;
}
.obra-card-menu-close:hover { opacity: .95; }
.obra-card-menu-close:active { opacity: .9; }

/* Form inside menu (ej. Sin fecha en agendada) */
.obra-card-menu-form {
    width: 100%;
    margin: 0 0 .35rem 0;
}
.obra-card-menu-form .obra-card-menu-item { width: 100%; }

.incidencia-link-mini {
    display: inline-block;
    margin-top: .35rem;
    padding: .4rem .5rem;
    font-size: 0.92rem;
    color: var(--c-muted);
    text-decoration: none;
    opacity: .85;
    border-radius: 6px;
}
.incidencia-link-mini:hover { color: #b91c1c; opacity: 1; }

.obra-card-fecha {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--c-text);
    background: #f1f5f9;
    border-radius: 8px;
    padding: .45rem .9rem;
    margin-top: .5rem;
}
.obra-card-actions {
    padding: .75rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.obra-card-actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* BIG INSTALLER BUTTONS - grandes para pulgares (min 48x48px recomendado) */
.btn-big {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 1rem 1.1rem;
    min-height: 62px;
    font-size: 1.1rem;
    font-weight: 800;
    text-align: center;
    border: none;
    cursor: pointer;
    text-decoration: none;
    color: #fff;
    letter-spacing: .01em;
    line-height: 1.25;
    gap: .35rem;
    transition: filter .15s, transform .1s;
    border-radius: 12px;
}
.btn-big:active        { transform: scale(.97); }
.btn-big:hover         { filter: brightness(.9); }
.btn-big-azul          { background: #2563eb; }
.btn-big-verde         { background: #059669; }
.btn-big-coste         { background: #2563eb; }
.btn-big-llamar        { background: #d97706; }
.btn-big-naranja       { background: #64748b; }
.btn-big-rojo          { background: #64748b; }
.btn-big-secondary     { background: #e2e8f0; color: #475569; }
.btn-enviar-coste     { flex-direction: column; gap: 2px; }
.btn-enviar-main      { font-size: 0.82rem; line-height: 1.2; }
.btn-enviar-sub       { font-size: 0.74rem; font-weight: 700; opacity: .9; }

.obra-done-badge {
    text-align: center;
    padding: .85rem 1rem;
    font-size: 1rem;
    font-weight: 700;
    color: #475569;
    background: #f1f5f9;
    border-radius: 10px;
}
.obra-done-badge.cobrado {
    background: #f0fdf4;
    color: #166534;
    border: 1.5px solid #86efac;
}
.obra-coste-instalador {
    margin-top: .5rem;
    font-size: 1.35rem;
    color: #0f766e;
    font-weight: 900;
    letter-spacing: .01em;
}

/* ---- DURATION BUTTONS (crear_obra) ---- */
.duracion-btn {
    text-align: center;
    padding: .32rem .4rem;
    min-height: 26px;
    border: 2px solid var(--c-border);
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--c-muted);
    background: var(--c-white);
    transition: all .15s;
    cursor: pointer;
}
.duracion-btn:hover,
input[type="radio"]:checked + .duracion-btn,
.duracion-btn-active {
    border-color: #059669;
    background: #d1fae5;
    color: #065f46;
}

/* ---- SECCIONES INSTALADOR ---- */
.seccion-instalador {
    margin-bottom: 1rem;
    padding-bottom: .5rem;
}
.seccion-llamar,
.seccion-agendada,
.seccion-cerrada {
    background: transparent;
}
.seccion-cerrada {
    opacity: .9;
}
.seccion-header {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem .75rem .5rem;
    max-width: 460px;
    margin: 0 auto;
    border-top: 4px solid var(--c-border);
}
.seccion-llamar .seccion-header   { border-top-color: #d97706; }
.seccion-agendada .seccion-header { border-top-color: #059669; }
.seccion-cerrada .seccion-header  { border-top-color: #94a3b8; }

.seccion-icon  { font-size: 1.3rem; }
.seccion-titulo {
    font-size: 1rem;
    font-weight: 800;
    color: var(--c-text);
    flex: 1;
    text-transform: uppercase;
    letter-spacing: .04em;
}
.seccion-count {
    color: #fff;
    font-size: 0.85rem;
    font-weight: 800;
    padding: .25rem .7rem;
    border-radius: 999px;
}
.seccion-llamar   .seccion-titulo { color: #92400e; }
.seccion-llamar   .seccion-count  { background: #d97706; }
.seccion-agendada .seccion-titulo { color: #065f46; }
.seccion-agendada .seccion-count  { background: #059669; }
.seccion-instalada .seccion-header { border-top-color: #2563eb; }
.seccion-instalada .seccion-titulo { color: #1d4ed8; font-weight: 900; }
.seccion-instalada .seccion-count  { background: #3b82f6; }
.seccion-incidencias .seccion-header { border-top-color: #dc2626; }
.seccion-incidencias .seccion-titulo { color: #b91c1c; font-weight: 900; }
.seccion-incidencias .seccion-count  { background: #ef4444; }
.seccion-header-cerrada .seccion-titulo { color: #475569; }
.seccion-count-cerrada { background: #64748b; }

.btn-big-incidencias { background: #dc2626; }
.btn-big-incidencias:hover { filter: brightness(.95); }

/* Compact card style for finished obras */
.obra-card-header-cerrada  { padding: .75rem 1.1rem .6rem; }
.obra-card-cliente-cerrada { font-size: 1rem; color: var(--c-text); opacity: .85; }

/* "Ver anteriores" collapsible */
.cerradas-antiguas { border: none; }
.cerradas-antiguas-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    width: 100%;
    padding: 1rem .9rem;
    min-height: 52px;
    background: #f1f5f9;
    border: 2px dashed var(--c-border);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 700;
    color: var(--c-muted);
    cursor: pointer;
    list-style: none;
    text-align: center;
}
.cerradas-antiguas-toggle::-webkit-details-marker { display: none; }
.cerradas-antiguas[open] .cerradas-antiguas-toggle {
    border-style: solid;
    color: var(--c-text);
    margin-bottom: 0;
}
.cerradas-antiguas-toggle::before { content: '▸ '; }
.cerradas-antiguas[open] .cerradas-antiguas-toggle::before { content: '▾ '; }

.seccion-divider {
    max-width: 460px;
    margin: .25rem auto 0;
    border: none;
    border-top: 2px solid var(--c-border);
}

/* ---- PONER FECHA PAGE ---- */
.poner-fecha-wrap {
    max-width: 380px;
    margin: 0.65rem auto;
    padding: 0 0.7rem;
}
.poner-fecha-card {
    background: var(--c-white);
    border-radius: 6px;
    box-shadow: var(--shadow-md);
    padding: 0.7rem 0.75rem;
}
.poner-fecha-card .pf-title {
    font-size: 0.88rem;
    font-weight: 800;
    margin-bottom: .18rem;
}
.poner-fecha-card .pf-sub {
    font-size: 0.88rem;
    color: var(--c-text);
    margin-bottom: 1rem;
    line-height: 1.4;
}
.poner-fecha-card .pf-sub strong {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--c-text);
    display: block;
    margin-bottom: .1rem;
}
@media (max-width: 600px) {
    .poner-fecha-card .pf-title {
        font-size: 1.05rem;
    }
    .poner-fecha-card .pf-sub {
        font-size: 1.05rem;
    }
    .poner-fecha-card .pf-sub strong {
        font-size: 1.2rem;
        margin-bottom: .08rem;
    }
}
/* ---- INDICAR COSTE (rediseño) ---- */
.ic-page {
    max-width: 440px;
    margin: 0 auto;
    padding: 0.75rem 0.85rem 2rem;
}
.ic-back {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--c-muted);
    text-decoration: none;
    padding: .4rem 0;
    margin-bottom: 1.1rem;
    min-height: 44px;
}
.ic-back:hover { color: var(--c-text); }

/* Hero cliente */
.ic-hero {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--c-white);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.07);
    border: 1px solid var(--c-border);
}
.ic-hero-icon {
    font-size: 2rem;
    line-height: 1;
    flex-shrink: 0;
}
.ic-hero-nombre {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--c-text);
    line-height: 1.25;
}
.ic-hero-dir {
    font-size: 0.88rem;
    color: var(--c-muted);
    margin-top: .2rem;
}

/* Botón calculadora */
.ic-btn-calc {
    display: flex;
    align-items: center;
    gap: .9rem;
    width: 100%;
    padding: 1rem 1.2rem;
    min-height: 64px;
    background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%);
    border-radius: 14px;
    text-decoration: none;
    box-shadow: 0 3px 10px rgba(37,99,235,.35);
    transition: filter .15s, transform .1s;
    margin-bottom: 1.1rem;
}
.ic-btn-calc:active { transform: scale(.98); }
.ic-btn-calc:hover { filter: brightness(1.07); }
.ic-btn-calc-icon { font-size: 1.75rem; flex-shrink: 0; }
.ic-btn-calc-text { flex: 1; }
.ic-btn-calc-main {
    display: block;
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
    line-height: 1.2;
}
.ic-btn-calc-sub {
    display: block;
    font-size: 0.78rem;
    color: rgba(255,255,255,.8);
    margin-top: .15rem;
}
.ic-btn-calc-arrow {
    font-size: 1.3rem;
    color: rgba(255,255,255,.85);
    font-weight: 700;
}

/* Divisor */
.ic-divider {
    display: flex;
    align-items: center;
    margin: 0.9rem 0 1.1rem;
}
.ic-divider::before,
.ic-divider::after {
    content: "";
    flex: 1;
    height: 1.5px;
    background: var(--c-border);
}
.ic-divider span {
    padding: 0 .85rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--c-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
}

/* Formulario */
.ic-form { display: flex; flex-direction: column; gap: 1rem; }

/* Campo coste */
.ic-campo-coste {
    background: #f0fdf4;
    border: 2.5px solid #059669;
    border-radius: 16px;
    padding: 1rem 1.1rem 1.1rem;
}
.ic-campo-coste-label {
    font-size: 1.05rem;
    font-weight: 800;
    color: #065f46;
    margin-bottom: .65rem;
}
.ic-campo-coste-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.ic-campo-coste-euro {
    position: absolute;
    left: 1rem;
    font-size: 1.6rem;
    font-weight: 800;
    color: #059669;
    pointer-events: none;
    line-height: 1;
}
.ic-input-coste {
    width: 100%;
    font-size: 2.2rem;
    font-weight: 900;
    padding: .9rem 1rem .9rem 2.8rem;
    min-height: 80px;
    text-align: center;
    letter-spacing: .04em;
    border: 2px solid #a7f3d0;
    border-radius: 12px;
    background: #fff;
    color: #064e3b;
    box-shadow: 0 2px 8px rgba(5,150,105,.1);
    font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.ic-input-coste:focus {
    border-color: #059669;
    box-shadow: 0 0 0 4px rgba(5,150,105,.2);
    outline: none;
}

/* Checkbox descripción */
.ic-checkbox-label {
    display: flex;
    align-items: center;
    gap: .85rem;
    cursor: pointer;
    padding: .85rem 1rem;
    background: var(--c-white);
    border: 1.5px solid var(--c-border);
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--c-text);
    -webkit-tap-highlight-color: transparent;
    transition: border-color .15s, background .15s;
}
.ic-checkbox-label:active { background: #f1f5f9; }
.ic-checkbox-label input[type="checkbox"] {
    width: 1.5rem;
    height: 1.5rem;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #2563eb;
}

/* Textarea */
.ic-textarea {
    width: 100%;
    font-size: 1rem;
    font-family: inherit;
    padding: .85rem 1rem;
    border: 1.5px solid var(--c-border);
    border-radius: 12px;
    resize: vertical;
    min-height: 100px;
    background: var(--c-white);
    color: var(--c-text);
    transition: border-color .15s, box-shadow .15s;
}
.ic-textarea:focus {
    border-color: var(--c-nueva);
    box-shadow: 0 0 0 3px rgba(59,130,246,.15);
    outline: none;
}

/* Botón enviar */
.ic-btn-enviar {
    width: 100%;
    padding: 1.15rem;
    min-height: 64px;
    font-size: 1.2rem;
    font-weight: 900;
    letter-spacing: .03em;
    color: #fff;
    background: #059669;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 3px 10px rgba(5,150,105,.4);
    transition: filter .15s, transform .1s;
}
.ic-btn-enviar:active { transform: scale(.98); }
.ic-btn-enviar:hover { filter: brightness(1.07); }

.date-input-big input[type="date"] {
    width: 100%;
    padding: .32rem .6rem;
    font-size: 0.82rem;
    font-weight: 700;
    border: 2px solid var(--c-border);
    border-radius: 8px;
    text-align: center;
    color: var(--c-text);
    background: var(--c-white);
    font-family: inherit;
}
.date-input-big input[type="date"]:focus {
    outline: none;
    border-color: #059669;
    box-shadow: 0 0 0 3px rgba(5,150,105,.15);
}

/* ---- RESPONSIVE ---- */
@media (max-width: 768px) {
    .container        { padding: 1rem 1rem; }
    .oficina-toolbar   { flex-direction: column; }
    .oficina-buscar-form { min-width: 0; }
}
@media (max-width: 640px) {
    .detail-grid      { grid-template-columns: 1fr; }
    .obras-table table { min-width: 650px; }
    .stats-grid       { grid-template-columns: repeat(3, 1fr); }
    .nav              { padding: .7rem 1rem; }
    .container        { padding: 1rem .75rem; }
    .nav-oficina-inner { flex-wrap: wrap; gap: 1rem; }
    .nav-oficina-links { flex-wrap: wrap; gap: .5rem; }
}
@media (max-width: 400px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .obra-card-actions-row { grid-template-columns: 1fr; }
}

/* ================================================
   TOAST DE CONFIRMACIÓN — instalador.php
   ================================================ */
.ins-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    max-width: 90vw;
    min-width: 280px;
    padding: 1.1rem 1.6rem;
    border-radius: 14px;
    font-size: 1.25rem;
    font-weight: 700;
    text-align: center;
    box-shadow: 0 6px 28px rgba(0,0,0,.28);
    transition: opacity .4s ease, transform .4s ease;
    cursor: pointer;
    user-select: none;
}
.ins-toast-ok   { background: #16a34a; color: #fff; }
.ins-toast-warn { background: #d97706; color: #fff; }
.ins-toast-hide {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
    pointer-events: none;
}

/* Highlight de tarjeta al volver de acción */
@keyframes card-highlight-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(16,185,129,.7); }
    50%  { box-shadow: 0 0 0 10px rgba(16,185,129,.2); }
    100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}
.obra-card-highlight {
    animation: card-highlight-pulse 2.5s ease forwards;
    outline: 3px solid #10b981;
    outline-offset: 2px;
}
