/* Minimal, limpio, con toques de color (botones multicolor) */
:root{
  --bg:#0b0f12; --fg:#e7f0f4; --muted:#aabac3; --card:#12181d; --line:#1b242b;
  --green:#2ecc71; --blue:#3498db; --orange:#e67e22; --purple:#9b59b6; --teal:#1abc9c; --pink:#ff6bba;
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--fg);font:15px/1.45 system-ui,Segoe UI,Roboto,Inter,Arial}
h1,h2,h3{margin:0 0 .4rem}
small{color:var(--muted)}
hr{border:0;border-top:1px solid var(--line);margin:1rem 0}
.card{background:var(--card);border:1px solid var(--line);border-radius:16px;padding:14px;box-shadow:0 8px 24px rgba(0,0,0,.25)}
.topbar{display:flex;gap:16px;align-items:center;justify-content:space-between;padding:10px 14px;border-bottom:1px solid var(--line);position:sticky;top:0;background:linear-gradient(180deg,#0b0f12 70%,rgba(11,15,18,.6))}
.brand{display:flex;gap:10px;align-items:center}
.logo{width:36px;height:36px;fill:url(#g-green)}
.logo path{fill:#2ecc71}
.actions{display:flex;gap:8px;flex-wrap:wrap;align-items:center}
.btn{border:0;border-radius:12px;padding:8px 12px;font-weight:600;cursor:pointer;color:white;display:inline-flex;gap:.5rem;align-items:center;box-shadow:0 6px 16px rgba(0,0,0,.25)}
.btn:hover{transform:translateY(-1px)}
.btn.ghost{background:transparent;color:var(--fg);border:1px solid var(--line);box-shadow:none}
.grad-green{background:linear-gradient(135deg,#2ecc71,#27ae60)}
.grad-blue{background:linear-gradient(135deg,#3498db,#2980b9)}
.grad-orange{background:linear-gradient(135deg,#e67e22,#d35400)}
.grad-purple{background:linear-gradient(135deg,#9b59b6,#8e44ad)}
.grad-teal{background:linear-gradient(135deg,#1abc9c,#16a085)}
.grad-pink{background:linear-gradient(135deg,#ff6bba,#f368b5)}
.icon{font-size:1.15rem}
.input,.select,textarea{background:#0e1419;border:1px solid var(--line);color:var(--fg);padding:9px 10px;border-radius:10px;outline:none;min-width:180px}
.input:focus,.select:focus,textarea:focus{border-color:#2ecc71}
.kpis{display:grid;grid-template-columns:repeat(4,1fr);gap:12px;margin:12px}
.kpi{display:flex;flex-direction:column;gap:6px;text-align:left}
.kpi.warn{border-color:#633;box-shadow:0 8px 24px rgba(200,50,50,.18)}
.kpi-label{color:var(--muted);font-weight:600}
.kpi-value{font-size:1.8rem;font-weight:800}
.filters{margin:12px;display:flex;flex-direction:column;gap:10px}
.filters .row{display:flex;gap:8px;align-items:center}
.filters .row.wrap{flex-wrap:wrap}
.chip{display:inline-flex;gap:.5rem;align-items:center;background:#0e1419;padding:6px 10px;border-radius:999px;border:1px solid var(--line);cursor:pointer}
.grid{display:grid;grid-template-columns:360px 1fr;gap:12px;margin:12px}
.side{position:sticky;top:74px;height:calc(100vh - 120px);overflow:auto}
.table{overflow:hidden}
.table-head,.row{display:grid;grid-template-columns:1.1fr 1fr .9fr .7fr .7fr .7fr .6fr .7fr .6fr .9fr .8fr .8fr;gap:10px;align-items:center}
.table-head{padding:12px;background:#0f1419;border-bottom:1px solid var(--line)}
.table-rows{max-height:calc(100vh - 280px);overflow:auto}
.row{padding:12px;border-bottom:1px dashed var(--line)}
.cell{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.icon-btn{border:0;background:#0e1419;color:#fff;border-radius:10px;padding:6px 8px;cursor:pointer;border:1px solid var(--line)}
.icon-btn:hover{border-color:#2ecc71}
footer{margin:20px 12px;color:var(--muted);display:flex;gap:18px;flex-wrap:wrap}
/* modal */
dialog{border:0;padding:0;background:transparent}
.modal{max-width:960px;width:min(96vw,980px)}
.grid-form{display:grid;grid-template-columns:repeat(3,1fr);gap:10px}
.grid-form label{display:flex;flex-direction:column;gap:6px}
.grid-form .check{flex-direction:row;align-items:center;gap:8px}
.modal-actions{display:flex;justify-content:flex-end;gap:8px;margin-top:8px}
.calendar{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}
.calendar .slot{background:#0e1419;border:1px solid var(--line);border-radius:10px;padding:8px}
.badge{padding:3px 8px;border-radius:999px;font-size:.8rem;border:1px solid var(--line)}
.badge.ok{background:#0e1b12;color:#8de7b1;border-color:#174d2e}
.badge.warn{background:#1b120e;color:#f0b38a;border-color:#5a3116}
.badge.danger{background:#1b0e0e;color:#f59b9b;border-color:#5a1616}
@media (max-width: 1080px){
  .grid{grid-template-columns:1fr}
  .kpis{grid-template-columns:repeat(2,1fr)}
  .table-head,.row{grid-template-columns:repeat(3,1fr);grid-auto-flow:row}
  .side{position:static;height:auto}
}

/* Mejoras visuales */
.row:nth-child(odd){background:rgba(255,255,255,.02)}
.row:hover{background:rgba(46,204,113,.08)}
.cell .flag{margin-left:.4rem}
.flag.ok{background:#0e1b12;color:#8de7b1;border:1px solid #174d2e;border-radius:999px;padding:2px 6px;font-size:.75rem}
.flag.warn{background:#1b120e;color:#f0b38a;border:1px solid #5a3116;border-radius:999px;padding:2px 6px;font-size:.75rem}
.row.inseason{box-shadow:inset 0 0 0 1px rgba(46,204,113,.3)}

.btn{padding:10px 14px;font-size:14px}
.btn .icon{font-size:1.2rem}
.actions .btn{border:1px solid rgba(255,255,255,.08)}
.actions .btn:active{transform:translateY(0) scale(.98)}

/* Selected chips */
.chip input:checked + span,
.chip:has(input:checked){background:#133023;border-color:#1f6a44;color:#9ae6b4}

/* Light theme support quick */
:root.light{--bg:#f7fafc;--fg:#0b1320;--muted:#506273;--card:#ffffff;--line:#d7e2ea}
:root.light .row:nth-child(odd){background:rgba(0,0,0,.03)}


/* === A11Y & Modal Enhancements === */
:root{
  --a11y-focus:#ffd54f;
  --card-light:#ffffff;
  --fg-dark:#0b0f12;
}

dialog#modal::backdrop{
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
}

.modal.card{
  background: var(--card-light) !important;
  color: var(--fg-dark) !important;
  border-color: #e6e9ee !important;
  box-shadow: 0 18px 48px rgba(0,0,0,.35);
  max-width: 980px;
  width: min(92vw, 980px);
}

.grid-form{
  display:grid;
  grid-template-columns: repeat(2, minmax(180px,1fr));
  gap:12px 16px;
  margin-top:10px;
}

@media (max-width:720px){
  .grid-form{ grid-template-columns: 1fr; }
}

.grid-form label{
  display:flex;
  flex-direction:column;
  gap:6px;
  font-weight:600;
}

.grid-form input,
.grid-form select,
.grid-form textarea{
  padding:10px 12px;
  border:1.5px solid #d4dbe3;
  border-radius:10px;
  background:#f8fbff;
  color:#0b0f12;
  outline:none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}

.grid-form input::placeholder,
.grid-form textarea::placeholder{ color:#6c7a89; }

.grid-form input:focus,
.grid-form select:focus,
.grid-form textarea:focus{
  border-color:#7db8ff;
  box-shadow: 0 0 0 3px rgba(125,184,255,.25);
  background:#ffffff;
}

.grid-form .check{ flex-direction:row; align-items:center; gap:10px; font-weight:500; }

.modal-actions{
  display:flex; justify-content:flex-end; gap:10px; margin-top:14px;
}

.btn .i{ display:inline-flex; width:1.1em; height:1.1em; margin-right:.45rem; vertical-align:-.2em; }

/* Multicolor gradient helpers for buttons (matches your portfolio style) */
.grad-green{ background: linear-gradient(135deg, #22c55e, #16a34a); color:white; }
.grad-blue{ background: linear-gradient(135deg, #3b82f6, #1d4ed8); color:white; }
.grad-orange{ background: linear-gradient(135deg, #f59e0b, #d97706); color:white; }
.grad-purple{ background: linear-gradient(135deg, #a855f7, #7e22ce); color:white; }
.grad-pink{ background: linear-gradient(135deg, #ec4899, #db2777); color:white; }

/* Accessibility toolbar */
.a11y-toolbar{
  position: sticky; top: 0; z-index: 50;
  display:flex; flex-wrap:wrap; gap:8px; align-items:center;
  background: linear-gradient(90deg, rgba(22,163,74,.15), rgba(16,185,129,.10), rgba(20,184,166,.12));
  border-bottom: 1px dashed rgba(255,255,255,.15);
  padding:10px 12px;
}

.a11y-toolbar .btn{
  padding:8px 10px; border-radius:12px; border:1px solid rgba(255,255,255,.15);
  background: rgba(255,255,255,.06);
  color: var(--fg);
  font-weight:600;
}
.a11y-toolbar .btn:focus{ outline:3px solid var(--a11y-focus); outline-offset:2px; }

/* High-contrast / readable modes */
body.is-contrast{
  --bg:#000; --fg:#fff; --card:#0f0f0f; --line:#222;
}
body.is-readable{
  font-size:17px;
  line-height:1.6;
  letter-spacing:.2px;
}

/* Green garden theme */
body.theme-garden{
  background: radial-gradient(1200px 600px at 20% -10%, #0c3b2e 0%, transparent 60%),
              radial-gradient(1000px 500px at 120% 10%, #064e3b 0%, transparent 60%),
              linear-gradient(180deg, #071a14 0%, #0b0f12 60%);
}

/* Light theme (optional) */
body.theme-light{
  --bg:#f7fafc; --fg:#0b0f12; --card:#ffffff; --line:#e3e8ef;
  color: var(--fg);
}
body.theme-light .topbar{ border-bottom-color:#e3e8ef; }
body.theme-light .card{ border-color:#e3e8ef; box-shadow:0 6px 18px rgba(0,0,0,.06); }
body.theme-light .table-header, body.theme-light .table-rows .row{ background:#ffffff; }

/* Bigger primary action button in modal */
#btn-save{ font-size:15px; padding:10px 14px; border-radius:12px; }
#btn-cancel{ font-weight:600; }


/* === Dashboard tabs with icons === */
.actions.tabs{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}
.actions.tabs .btn{
  display:flex; align-items:center; gap:6px;
  border-radius:14px;
  padding:10px 14px;
  font-weight:600;
  box-shadow:0 4px 10px rgba(0,0,0,.15);
  transition: transform .15s, box-shadow .2s;
}
.actions.tabs .btn:hover{ transform: translateY(-2px); box-shadow:0 6px 14px rgba(0,0,0,.2); }

/* Daltonic-friendly palette (Color Universal Design) */
body.is-daltonic{
  --green:#009e73; --blue:#0072b2; --orange:#e69f00; --purple:#cc79a7; --pink:#f0e442;
}
body.is-daltonic .grad-green{ background: linear-gradient(135deg, #009e73, #56b4e9); }
body.is-daltonic .grad-blue{ background: linear-gradient(135deg, #0072b2, #56b4e9); }
body.is-daltonic .grad-orange{ background: linear-gradient(135deg, #e69f00, #f0e442); }
body.is-daltonic .grad-purple{ background: linear-gradient(135deg, #cc79a7, #f0e442); }
body.is-daltonic .grad-pink{ background: linear-gradient(135deg, #f0e442, #e69f00); }


/* === Tabs estilo portafolio + Tooltips === */
.actions{
  display:flex; flex-wrap:wrap; gap:10px; align-items:center; margin-top:8px;
}
.actions .btn{
  display:inline-flex; align-items:center; gap:.5rem;
  padding:10px 14px; border-radius:12px; border:1px solid rgba(255,255,255,.15);
  box-shadow: 0 6px 18px rgba(0,0,0,.18);
  transform: translateZ(0);
  transition: transform .12s ease, box-shadow .2s ease, filter .15s ease;
}
.actions .btn .icon{ font-size:1.1em; }
.actions .btn:hover{ transform: translateY(-1px); box-shadow:0 10px 22px rgba(0,0,0,.25); }
.actions .btn:active{ transform: translateY(0); }

/* Tooltips accesibles (con data-tip) */
label[data-tip], .btn[data-tip]{
  position:relative;
}
label[data-tip]:hover::after, .btn[data-tip]:hover::after{
  content: attr(data-tip);
  position:absolute;
  z-index:40;
  left:0; top:100%;
  margin-top:6px;
  max-width: 320px;
  background: rgba(0,0,0,.85);
  color: #fff;
  font-size: .85em;
  line-height:1.3;
  padding:8px 10px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.2);
  pointer-events:none;
  white-space:normal;
  box-shadow:0 6px 18px rgba(0,0,0,.35);
}
label[data-tip]:hover::before, .btn[data-tip]:hover::before{
  content:"";
  position:absolute; left:12px; top:calc(100% + 1px);
  width:10px; height:10px;
  background: rgba(0,0,0,.85);
  transform:rotate(45deg);
  border-left:1px solid rgba(255,255,255,.2);
  border-top:1px solid rgba(255,255,255,.2);
}

/* Modo daltónicos: agrega patrones y garantiza diferencias más allá del color */
body.is-cvd .grad-green,
body.is-cvd .grad-blue,
body.is-cvd .grad-orange,
body.is-cvd .grad-purple,
body.is-cvd .grad-pink,
body.is-cvd .grad-teal{
  background-image:
    repeating-linear-gradient(45deg, rgba(255,255,255,.28) 0 6px, transparent 6px 12px),
    linear-gradient(135deg, #6b7280, #374151) !important; /* gris alto contraste */
  color:#fff !important;
  outline: 2px dashed #fff;
  text-decoration: underline;
}

body.is-cvd .btn .icon{ filter: drop-shadow(0 1px 0 rgba(0,0,0,.4)); }
body.is-cvd a{text-decoration: underline; text-underline-offset: 2px;}

