/* ARSERVICIOS S.A.S — blanco y escala de grises */
:root {
    --c-900: #1f2023;
    --c-800: #3a3b3f;   /* gris del logo */
    --c-700: #4d4e53;
    --c-600: #6b6c72;
    --c-500: #8e8f95;
    --c-400: #b4b5ba;
    --c-300: #d4d5d9;
    --c-200: #e6e7ea;
    --c-100: #f2f3f5;
    --white: #ffffff;
    --ok: #2f6b3a;
    --ok-bg: #e7f1e9;
    --err: #8a2a2a;
    --err-bg: #f6e6e6;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 14px rgba(0,0,0,.05);
    --sidebar: 250px;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    color: var(--c-900);
    background: var(--c-100);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--c-800); }
h1, h2, h3 { font-family: Oswald, Impact, sans-serif; font-weight: 700; letter-spacing: .3px; color: var(--c-800); }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar);
    background: var(--white);
    border-right: 1px solid var(--c-200);
    display: flex; flex-direction: column;
    position: fixed; inset: 0 auto 0 0;
    z-index: 30;
    transition: transform .25s ease;
}
.brand { display: block; padding: 22px 20px 18px; border-bottom: 1px solid var(--c-200); }
.brand img { width: 100%; max-width: 200px; display: block; }
.nav, .sidebar-foot { display: flex; flex-direction: column; padding: 12px; gap: 2px; }
.nav { flex: 1; overflow-y: auto; }
.sidebar-foot { border-top: 1px solid var(--c-200); }
.nav a, .nav span, .sidebar-foot a {
    display: flex; align-items: center; justify-content: space-between;
    padding: 10px 12px; border-radius: 8px;
    text-decoration: none; color: var(--c-700); font-weight: 500;
}
.nav a:hover, .sidebar-foot a:hover { background: var(--c-100); color: var(--c-900); }
.nav a.active, .sidebar-foot a.active { background: var(--c-800); color: var(--white); }
.nav span.disabled { color: var(--c-400); cursor: default; }
.nav small { font-size: 10px; text-transform: uppercase; letter-spacing: .5px; background: var(--c-100); color: var(--c-500); padding: 2px 6px; border-radius: 99px; }

.main { flex: 1; margin-left: var(--sidebar); min-width: 0; display: flex; flex-direction: column; }
.topbar {
    position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: 14px;
    background: var(--white); border-bottom: 1px solid var(--c-200);
    padding: 12px 24px; min-height: 64px;
}
.topbar h1 { flex: 1; margin: 0; font-size: 22px; text-transform: uppercase; }
.user-chip { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--c-800); color: var(--white);
    display: grid; place-items: center; font-weight: 600;
}
.user-info { display: flex; flex-direction: column; line-height: 1.2; }
.user-info small { color: var(--c-500); font-size: 12px; }
.content { padding: 24px; width: 100%; max-width: 1200px; }

.menu-btn {
    display: none; width: 40px; height: 40px; border: 0; background: transparent;
    flex-direction: column; justify-content: center; gap: 5px; padding: 8px; cursor: pointer;
}
.menu-btn span { display: block; height: 2px; background: var(--c-800); border-radius: 2px; }
.backdrop { display: none; }

/* ---------- Componentes ---------- */
.card {
    background: var(--white); border: 1px solid var(--c-200);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 20px; margin-bottom: 20px;
}
.card h2 { margin: 0 0 14px; font-size: 18px; text-transform: uppercase; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head h2 { margin: 0; }
.muted { color: var(--c-600); }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.stat { background: var(--white); border: 1px solid var(--c-200); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.stat .label { color: var(--c-600); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.stat .value { font-family: Oswald, sans-serif; font-size: 32px; font-weight: 700; color: var(--c-800); margin-top: 4px; }
.stat .hint { color: var(--c-500); font-size: 12px; }

.form { display: grid; gap: 14px; max-width: 520px; }
.form-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
label { display: block; font-size: 13px; font-weight: 600; color: var(--c-700); margin-bottom: 6px; }
input[type=text], input[type=password], input[type=email], input[type=tel], select, textarea {
    width: 100%; padding: 11px 12px; font: inherit; color: var(--c-900);
    background: var(--white); border: 1px solid var(--c-300); border-radius: 8px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--c-700); box-shadow: 0 0 0 3px rgba(58,59,63,.12); }
.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--c-800); flex-shrink: 0; }
.perm-group { border: 1px solid var(--c-200); border-radius: 8px; padding: 12px 16px 6px; margin: 0 0 16px; }
.perm-group legend { font-family: Oswald, sans-serif; font-weight: 700; text-transform: uppercase; color: var(--c-800); padding: 0 6px; }
.perm-group .check { padding: 6px 0; margin: 0; font-size: 14px; color: var(--c-900); cursor: pointer; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 18px; border-radius: 8px; border: 1px solid var(--c-800);
    background: var(--c-800); color: var(--white);
    font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--c-900); }
.btn-light { background: var(--white); color: var(--c-800); border-color: var(--c-300); }
.btn-light:hover { background: var(--c-100); }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-block { width: 100%; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.actions form { margin: 0; }

.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid transparent; }
.alert-ok { background: var(--ok-bg); color: var(--ok); border-color: #c9dfcd; }
.alert-error { background: var(--err-bg); color: var(--err); border-color: #e8c8c8; }
.alert-info { background: var(--c-100); color: var(--c-700); border-color: var(--c-300); }

.badge { display: inline-block; padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--c-200); color: var(--c-700); }
.badge-dark { background: var(--c-800); color: var(--white); }
.badge-off { background: var(--c-100); color: var(--c-400); }

/* Tabla que pasa a tarjetas en celular */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--c-200); vertical-align: middle; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--c-600); font-weight: 600; }
.table tr:last-child td { border-bottom: 0; }

a.stat { text-decoration: none; color: inherit; transition: border-color .15s; }
a.stat:hover { border-color: var(--c-500); }
textarea { resize: vertical; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.filters select, .filters input[type=text] { width: auto; flex: 1 1 160px; }
.table-click tbody tr { cursor: pointer; }
.table-click tbody tr:hover td { background: var(--c-100); }

/* Estados de reclamos (grises + acentos suaves) */
.st-pend { background: #f3e9d2; color: #6b4e12; }
.st-asig { background: var(--c-800); color: var(--white); }
.st-post { background: #e3e6ef; color: #2f3a5a; }
.st-ok   { background: var(--ok-bg); color: var(--ok); }
.st-off  { background: var(--c-100); color: var(--c-500); text-decoration: line-through; }

/* Detalle de reclamo */
.datos { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 20px; margin: 0 0 16px; }
.datos dt { font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--c-500); }
.datos dd { margin: 2px 0 0; font-weight: 500; }
.descripcion { background: var(--c-100); border-radius: 8px; padding: 14px; line-height: 1.5; }
.firma-final { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.firma-final img { max-width: 320px; width: 100%; border: 1px solid var(--c-200); border-radius: 8px; background: #fff; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 22px; border-left: 2px solid var(--c-200); margin-left: 6px; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 3px; width: 12px; height: 12px; border-radius: 50%; background: var(--c-800); border: 2px solid var(--white); }
.timeline li.interno::before { background: var(--c-400); }
.tl-head { line-height: 1.6; }
.tl-date { display: block; font-size: 12px; color: var(--c-500); }
.tl-body { margin-top: 6px; background: var(--c-100); border-radius: 8px; padding: 10px 12px; line-height: 1.5; }
.timeline li.interno .tl-body { background: #fff; border: 1px dashed var(--c-300); }
.fotos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.fotos img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; border: 1px solid var(--c-200); display: block; }

.estado-opciones { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.estado-opciones .opt { display: flex; align-items: center; gap: 8px; margin: 0; padding: 12px; border: 1px solid var(--c-300); border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--c-800); }
.estado-opciones .opt:has(input:checked) { border-color: var(--c-800); background: var(--c-100); box-shadow: inset 0 0 0 1px var(--c-800); }
.estado-opciones input { accent-color: var(--c-800); width: 18px; height: 18px; }

.firma { position: relative; }
.firma canvas { display: block; width: 100%; height: 200px; border: 2px dashed var(--c-400); border-radius: 10px; background: #fff; touch-action: none; }
.firma .firma-limpiar { position: absolute; right: 8px; top: 8px; }

.txt-warn { color: #8a5a12; font-weight: 600; }
h3.grupo { font-family: Oswald, sans-serif; text-transform: uppercase; font-size: 15px; color: var(--c-600); margin: 18px 0 6px; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }
details.lote { border: 1px dashed var(--c-300); border-radius: 8px; padding: 10px 12px; margin-bottom: 12px; }
details.lote summary { cursor: pointer; font-weight: 600; color: var(--c-700); }

/* Tablero de mantenimiento */
.progreso { margin-top: 6px; }
.progreso-barra { height: 10px; background: var(--c-200); border-radius: 99px; overflow: hidden; }
.progreso-barra span { display: block; height: 100%; background: var(--c-800); }
.progreso-txt { margin-top: 6px; color: var(--c-700); }
.mant-lista { display: flex; flex-direction: column; }
.mant-fila { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--c-200); flex-wrap: wrap; }
.mant-fila:last-child { border-bottom: 0; }
.mant-info { display: flex; flex-direction: column; gap: 2px; min-width: 200px; flex: 1; }
.mant-info .muted { font-size: 13px; }
.mant-nota { font-size: 12px; color: #8a5a12; }
.mant-periodos { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-block; padding: 6px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; text-decoration: none; border: 1px solid transparent; white-space: nowrap; }
.chip-ok { background: var(--ok-bg); color: var(--ok); border-color: #c9dfcd; }
.chip-curso { background: var(--c-800); color: var(--white); }
.chip-pend { background: var(--white); color: var(--c-800); border-color: var(--c-400); }
a.chip-pend:hover { background: var(--c-100); }
.chip-no { background: var(--c-100); color: var(--c-400); }

/* Planilla de mantenimiento */
.eq-lista { display: flex; flex-direction: column; gap: 10px; }
.eq-item { position: relative; border: 1px solid var(--c-200); border-radius: 10px; padding: 12px; display: grid; gap: 10px; background: var(--white); }
.eq-item.hecho { border-color: #b7d3bd; background: #f7fbf8; }
.eq-check { display: flex; gap: 12px; align-items: flex-start; margin: 0; cursor: pointer; font-weight: 400; padding-right: 70px; }
.eq-check input { width: 26px; height: 26px; accent-color: var(--ok); flex-shrink: 0; margin: 0; }
.eq-datos { display: flex; flex-direction: column; gap: 2px; color: var(--c-900); font-size: 15px; }
.eq-datos small { color: var(--c-600); font-size: 13px; }
.eq-hist { position: absolute; right: 12px; top: 12px; font-size: 12px; color: var(--c-600); }
.eq-campos { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.eq-campos .campo { margin: 0; font-weight: 400; }
.eq-campos .campo span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--c-600); margin-bottom: 3px; }
.eq-campos input, .eq-campos select { padding: 9px 10px; }
.eq-obs { font-size: 14px; }
.eq-obs-txt { font-size: 14px; background: var(--c-100); border-radius: 6px; padding: 8px 10px; }
.tareas { display: flex; flex-direction: column; }
.tarea { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--c-200); }
.tarea:last-child { border-bottom: 0; }
.tarea small { display: block; }
.sino { display: flex; gap: 6px; flex-shrink: 0; }
.sino label { display: flex; align-items: center; gap: 4px; margin: 0; padding: 8px 12px; border: 1px solid var(--c-300); border-radius: 8px; cursor: pointer; font-weight: 600; }
.sino label:has(input:checked) { border-color: var(--c-800); background: var(--c-100); }
.tarea-edit { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--c-200); }
.tarea-edit input[type=text] { flex: 1 1 260px; width: auto; }
.tarea-edit select { width: auto; }
.tarea-edit .check { margin: 0; }
.tarea-edit.nueva { border-bottom: 0; }

/* Presupuestos, insumos y mensualidades */
.form-ancho { max-width: 900px; }
.form-row-3 { grid-template-columns: repeat(3, 1fr); }
.form-row-4 { grid-template-columns: repeat(4, 1fr); }
.items { display: flex; flex-direction: column; gap: 6px; }
.item { display: grid; grid-template-columns: 1fr 80px 120px 110px 40px; gap: 6px; align-items: center; }
.item-head { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--c-600); }
.item .importe { text-align: right; font-weight: 600; }
.item input { padding: 9px 10px; }
.totales { margin-top: 12px; text-align: right; color: var(--c-700); }
.totales .total { font-size: 18px; color: var(--c-900); }
details.pago { display: inline-block; }
details.pago summary { list-style: none; }
details.pago summary::-webkit-details-marker { display: none; }
.pago-form { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.pago-form input, .pago-form select { width: auto; padding: 7px 8px; }
.uso-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.uso-form select { flex: 1 1 220px; width: auto; }
.uso-form input { width: 110px; }

/* Nueva solicitud */
.opciones-grandes { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; }
.opcion-grande { display: flex; flex-direction: column; gap: 6px; padding: 22px; border: 2px solid var(--c-300); border-radius: 12px; text-decoration: none; color: var(--c-900); background: var(--white); }
.opcion-grande strong { font-family: Oswald, sans-serif; font-size: 22px; text-transform: uppercase; color: var(--c-800); }
.opcion-grande span { color: var(--c-600); }
.opcion-grande:hover { border-color: var(--c-800); background: var(--c-100); }

/* Globitos de equipos / materiales con cantidad */
.chips-box { border: 1px solid var(--c-300); border-radius: 8px; padding: 8px; background: var(--white); }
.chips-box .chips { margin-bottom: 6px; }
.chips-box .chips:empty { margin: 0; }
.chips-box input[list] { border: 0; padding: 6px 4px; box-shadow: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-item { display: inline-flex; align-items: center; gap: 6px; background: var(--c-100); border: 1px solid var(--c-300); border-radius: 99px; padding: 4px 6px 4px 12px; font-size: 14px; }
.chip-item.chip-eq { background: #e8edf6; border-color: #c7d2e6; }
.chip-item .cant { width: 58px; padding: 4px 6px; text-align: center; border-radius: 99px; }
.chip-item small { color: var(--c-600); }
.chip-item b { background: var(--white); border-radius: 99px; padding: 0 8px; }
.chip-item button { border: 0; background: transparent; cursor: pointer; color: var(--c-600); font-size: 14px; padding: 2px 6px; }

/* Presupuesto: agregar ítems */
.agregar-items { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.item { grid-template-columns: 1fr 80px 120px 110px 40px; }
.item-desc { display: flex; align-items: center; gap: 6px; min-width: 0; }
.item-desc input { flex: 1; min-width: 0; }
.item-tipo { font-size: 10px; text-transform: uppercase; letter-spacing: .4px; background: var(--c-200); color: var(--c-700); border-radius: 4px; padding: 2px 6px; white-space: nowrap; }
.item[data-tipo="equipo"] .item-tipo { background: #e8edf6; color: #2f3a5a; }
.notas-pre { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; }
.notas-pre .check { font-weight: 400; margin: 0; }

/* Fotos con vista previa y editor */
.fotos-previa { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; align-items: flex-end; }
.foto-item { display: flex; flex-direction: column; gap: 4px; }
.foto-item img { width: 110px; height: 110px; object-fit: cover; border-radius: 8px; border: 1px solid var(--c-300); }
.foto-item div { display: flex; gap: 4px; }
.editor-foto { position: fixed; inset: 0; z-index: 100; background: #111; display: flex; flex-direction: column; }
.ed-barra, .ed-pie { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px; background: #222; }
.ed-pie { justify-content: flex-end; color: #ddd; }
.ed-pie select { width: auto; padding: 6px; }
.ed-px { color: #999; font-size: 13px; margin-right: auto; }
.ed-grupo { display: flex; gap: 4px; padding-right: 8px; border-right: 1px solid #444; }
.ed-grupo:last-child { border-right: 0; }
.ed-grupo button { min-width: 40px; height: 40px; border-radius: 8px; border: 2px solid transparent; background: #333; color: #fff; font-size: 18px; cursor: pointer; }
.ed-grupo button.activo { border-color: #fff; background: #555; }
.ed-grupo .ed-color { min-width: 32px; width: 32px; height: 32px; border-radius: 50%; border: 2px solid #666; }
.ed-grupo .ed-color.activo { border-color: #fff; box-shadow: 0 0 0 2px #111, 0 0 0 4px #fff; }
.ed-lienzo { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 8px; }
.ed-lienzo canvas { max-width: 100%; max-height: 100%; touch-action: none; background: #fff; cursor: crosshair; }

/* ---------- Login ---------- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: var(--c-100); }
.login-box { width: 100%; max-width: 400px; background: var(--white); border: 1px solid var(--c-200); border-radius: 14px; box-shadow: var(--shadow); padding: 32px 28px; }
.login-box img { display: block; width: 100%; max-width: 280px; margin: 0 auto 8px; }
.login-box .sub { text-align: center; color: var(--c-600); margin: 0 0 24px; font-size: 14px; }
.login-box .form { max-width: none; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .sidebar { transform: translateX(-100%); box-shadow: none; }
    .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.2); }
    .backdrop.open { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
    .main { margin-left: 0; }
    .menu-btn { display: flex; }
}
@media (max-width: 640px) {
    .topbar { padding: 10px 16px; }
    .topbar h1 { font-size: 18px; }
    .user-info { display: none; }
    .content { padding: 16px; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .form-row-4 { grid-template-columns: 1fr 1fr; }
    .item { grid-template-columns: 1fr 1fr 1fr 32px; }
    .item > input[name="desc[]"], .item > .item-desc { grid-column: 1 / -1; }
    .agregar-items { grid-template-columns: 1fr; }
    .item-head { display: none; }
}
@media (max-width: 760px) {
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { border: 1px solid var(--c-200); border-radius: 8px; padding: 6px 10px; margin-bottom: 10px; }
    .table td { border: 0; padding: 6px 0; display: flex; justify-content: space-between; gap: 12px; }
    .table td::before { content: attr(data-label); font-size: 12px; color: var(--c-500); text-transform: uppercase; }
    .table td.actions { justify-content: flex-end; }
    .table td.actions::before { content: none; }
}
