/* =============================================================
   Servicio Laguna Tools - componentes reutilizables
   CSS plano (funciona con Tailwind CDN o compilado)
   ============================================================= */

[x-cloak] { display: none !important; }

body { font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; }

.tabular-nums { font-variant-numeric: tabular-nums; }

/* Scrollbar del sidebar */
.sidebar-scrollbar::-webkit-scrollbar { width: 4px; }
.sidebar-scrollbar::-webkit-scrollbar-track { background: transparent; }
.sidebar-scrollbar::-webkit-scrollbar-thumb { background: #404040; border-radius: 4px; }

/* ---------- Formularios ---------- */
.form-label {
    display: block;
    margin-bottom: .375rem;
    font-size: .875rem;
    font-weight: 500;
    color: #374151;
}
.form-input {
    display: block;
    width: 100%;
    border-radius: .5rem;
    border: 1px solid #d1d5db;
    background: #fff;
    padding: .5rem .75rem;
    font-size: .875rem;
    line-height: 1.25rem;
    color: #111827;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);
    transition: border-color .15s, box-shadow .15s;
}
.form-input::placeholder { color: #9ca3af; }
.form-input:focus {
    outline: none;
    border-color: #f0a80c;
    box-shadow: 0 0 0 3px rgb(249 191 24 / .3);
}
.form-input:disabled { background: #f9fafb; color: #6b7280; }
.form-input.is-invalid { border-color: #f87171; }
.form-input.is-invalid:focus { box-shadow: 0 0 0 3px rgb(248 113 113 / .2); }
.form-help { margin-top: .25rem; font-size: .75rem; color: #6b7280; }
.form-error { margin-top: .25rem; font-size: .75rem; font-weight: 500; color: #dc2626; }

.form-checkbox {
    height: 1rem; width: 1rem;
    border-radius: .25rem;
    border: 1px solid #d1d5db;
    accent-color: #f0a80c;
}

/* ---------- Botones ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    border-radius: .5rem;
    padding: .5rem 1rem;
    font-size: .875rem;
    font-weight: 500;
    line-height: 1.25rem;
    border: 1px solid transparent;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);
    transition: background-color .15s, border-color .15s, color .15s, opacity .15s;
    cursor: pointer;
    white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 1rem; height: 1rem; }
.btn-primary { background: #f9bf18; color: #0a0a0a; border-color: #e0a90f; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: #f0a80c; }
.btn-secondary { background: #fff; color: #374151; border-color: #d1d5db; }
.btn-secondary:hover:not(:disabled) { background: #f9fafb; }
.btn-dark { background: #0a0a0a; color: #fff; }
.btn-dark:hover:not(:disabled) { background: #262626; }
.btn-success { background: #059669; color: #fff; }
.btn-success:hover:not(:disabled) { background: #047857; }
.btn-danger { background: #db011c; color: #fff; }
.btn-danger:hover:not(:disabled) { background: #b80018; }
.btn-sm { padding: .375rem .75rem; font-size: .8125rem; }

.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: .5rem; padding: .375rem; color: #9ca3af;
    transition: background-color .15s, color .15s;
}
.btn-icon:hover { background: #f3f4f6; color: #4b5563; }
.btn-icon svg { width: 1rem; height: 1rem; }

/* ---------- Tarjetas y tablas ---------- */
.card {
    border-radius: .75rem;
    border: 1px solid #e5e7eb;
    background: #fff;
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / .05);
}
.table { min-width: 100%; border-collapse: separate; border-spacing: 0; }
.table thead th {
    background: #f9fafb;
    padding: .75rem 1rem;
    text-align: left;
    font-size: .6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6b7280;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}
.table tbody td {
    padding: .75rem 1rem;
    font-size: .875rem;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #f9fafb; }

/* ---------- Badges ---------- */
.badge {
    display: inline-flex; align-items: center; gap: .25rem;
    border-radius: 9999px;
    padding: .125rem .625rem;
    font-size: .75rem; font-weight: 500;
    white-space: nowrap;
}
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-amber  { background: #fef3c7; color: #b45309; }
.badge-red    { background: #ffe0e3; color: #b80018; }
.badge-orange { background: #ffedd5; color: #c2410c; }
.badge-blue   { background: #dbeafe; color: #1d4ed8; }
.badge-sky    { background: #e0f2fe; color: #0369a1; }
.badge-purple { background: #f3e8ff; color: #7e22ce; }
.badge-gray   { background: #f3f4f6; color: #4b5563; }
.badge-indigo { background: #e0e7ff; color: #4338ca; }
.badge-slate  { background: #e2e8f0; color: #334155; }

/* ---------- Orden de servicio ---------- */
.dl-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: .75rem 1.5rem; }
@media (min-width: 640px) { .dl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.dl-grid dt { font-size: .75rem; font-weight: 500; color: #6b7280; }
.dl-grid dd { margin-top: .125rem; font-size: .875rem; color: #111827; white-space: pre-line; word-break: break-word; }

.section-title {
    font-size: .75rem; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: #6b7280;
}

.folio {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-weight: 700; letter-spacing: .02em; white-space: nowrap;
}

/* En el detalle, cortar palabras muy largas en lugar de desbordar */
main dd, main p, main h1, main h2 { overflow-wrap: anywhere; }

/* Textos capturados largos o sin espacios: máximo 2 renglones en listados */
.texto-corto {
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden; overflow-wrap: anywhere; max-width: 28rem;
}

.dias-alerta { color: #db011c; font-weight: 700; }

@media print {
    aside, header, footer, .no-print { display: none !important; }
    main { padding: 0 !important; overflow: visible !important; }
    .lg\:ml-64, .lg\:ml-20 { margin-left: 0 !important; }
}

/* Presupuesto en celular: cada partida en dos renglones (cant · código · quitar / descripción / precio · importe) */
@media (max-width: 767px) {
    .tabla-partidas thead { display: none; }
    .tabla-partidas tbody tr:not(.vacia) { position: relative; display: grid; grid-template-columns: 4.5rem 1fr minmax(2.25rem, auto); gap: .5rem; padding: .875rem 1rem; border-bottom: 1px solid #f3f4f6; }
    .tabla-partidas tbody tr:not(.vacia) > td { display: block; padding: 0; border: 0; }
    .tabla-partidas td:nth-child(3) { grid-column: 1 / -1; grid-row: 2; }
    .tabla-partidas td:nth-child(4) { grid-column: 1 / 3; grid-row: 3; }
    .tabla-partidas td:nth-child(5) { grid-column: 3; grid-row: 3; align-self: center; white-space: nowrap; justify-self: end; font-weight: 600; }
    .tabla-partidas td:nth-child(6) { grid-column: 3; grid-row: 1; align-self: center; justify-self: end; }
    .tabla-partidas td.relative { position: static; }
    .tabla-partidas ul.absolute { left: 1rem; right: 1rem; top: 6.6rem; width: auto; } /* debajo de la descripción, sin tapar lo que se escribe */
}
