/* WebHeroe Time — hoja de estilos única */

:root {
  --bg:        #0b0e14;
  --bg-soft:   #10141d;
  --panel:     #151a24;
  --panel-2:   #1b2130;
  --line:      #232b3a;
  --line-soft: #1c2330;
  --text:      #e7ecf5;
  --muted:     #8d99b0;
  --muted-2:   #626e85;
  --accent:    #4f7cff;
  --accent-2:  #7aa2ff;
  --green:     #2dd4a7;
  --amber:     #f5b74e;
  --red:       #ff6b6b;
  --violet:    #a78bfa;
  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 12px 40px rgba(0,0,0,.45);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9;
      stroke-linecap: round; stroke-linejoin: round; }
h1,h2,h3,h4 { margin: 0; font-weight: 650; letter-spacing: -.01em; }
input, select, textarea, button { font: inherit; color: inherit; }

/* ------------------------------ Layout ------------------------------ */

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 236px; flex: 0 0 236px;
  background: var(--bg-soft);
  border-right: 1px solid var(--line-soft);
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 18px 14px;
  font-size: 15px; letter-spacing: -.02em;
}
.brand strong { color: var(--accent-2); font-weight: 700; }

.nav { padding: 6px 10px; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border: 0; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); cursor: pointer;
  text-align: left; width: 100%; transition: .13s;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
.nav-item.is-active { background: var(--panel-2); color: var(--text); }
.nav-item.is-active svg { color: var(--accent-2); }

.sidebar-foot { margin-top: auto; padding: 12px 10px; }
.running-mini { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.running-mini .rm {
  display: flex; align-items: center; gap: 8px;
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: 7px 9px; font-size: 12px;
}
.running-mini .rm .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  animation: pulse 1.6s infinite; flex: 0 0 auto; }
.running-mini .rm .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--muted); }
.running-mini .rm .tm { font-family: var(--mono); color: var(--green); font-size: 12px; }

@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.user-box {
  display: flex; align-items: center; gap: 9px;
  padding: 9px; background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}
.avatar {
  width: 30px; height: 30px; flex: 0 0 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--violet));
  display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff;
}
.user-meta { flex: 1; min-width: 0; line-height: 1.25; }
.user-meta strong { display: block; font-size: 12.5px; }
.user-meta span { display: block; font-size: 11px; color: var(--muted-2);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 24px; border-bottom: 1px solid var(--line-soft);
  background: rgba(11,14,20,.85); backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.topbar-left h1 { font-size: 19px; }
.topbar-left p { margin: 2px 0 0; color: var(--muted-2); font-size: 12.5px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

.clock {
  display: flex; flex-direction: column; align-items: flex-end;
  padding: 4px 12px; border-right: 1px solid var(--line); margin-right: 4px;
}
.clock-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .09em; color: var(--muted-2); }
.clock-value { font-family: var(--mono); font-size: 16px; color: var(--text); }

.views { padding: 22px 24px 60px; flex: 1; }
.view { display: none; }
.view.is-active { display: block; animation: fade .18s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ------------------------------ Botones ------------------------------ */

.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--panel-2); color: var(--text); cursor: pointer;
  font-size: 13px; font-weight: 550; transition: .13s; white-space: nowrap;
}
.btn:hover { filter: brightness(1.15); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn-ghost:hover { color: var(--text); border-color: var(--muted-2); }
.btn-danger { background: transparent; border-color: rgba(255,107,107,.4); color: var(--red); }
.btn-danger:hover { background: rgba(255,107,107,.12); }
.btn-success { background: var(--green); color: #06231c; }
.btn-block { width: 100%; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.icon-btn {
  display: inline-grid; place-items: center; width: 30px; height: 30px;
  border-radius: 8px; border: 1px solid transparent; background: transparent;
  color: var(--muted); cursor: pointer; transition: .13s;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }
.icon-btn.danger:hover { color: var(--red); background: rgba(255,107,107,.1); }

/* ------------------------------ Tarjetas ----------------------------- */

.card {
  background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 16px;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 14px;
}
.card-head h2 { font-size: 15px; }
.card-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted-2); }

.grid { display: grid; gap: 14px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 1100px) { .grid-4 { grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 900px)  { .grid-3, .grid-2 { grid-template-columns: 1fr; } }

.stat { background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 14px 16px; }
.stat .label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); }
.stat .value { font-family: var(--mono); font-size: 24px; margin-top: 6px; letter-spacing: -.02em; }
.stat .sub { font-size: 11.5px; color: var(--muted-2); margin-top: 3px; }
.stat.accent .value { color: var(--accent-2); }
.stat.green .value  { color: var(--green); }
.stat.amber .value  { color: var(--amber); }
.stat.violet .value { color: var(--violet); }

/* --------------------------- Cronómetros ----------------------------- */

.timers { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.timer-card {
  position: relative; overflow: hidden;
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
}
.timer-card::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--green);
}
.timer-card .tc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.timer-card .tc-task { font-size: 14.5px; font-weight: 600; }
.timer-card .tc-path { font-size: 11.5px; color: var(--muted-2); margin-top: 2px; }
.timer-card .tc-time {
  font-family: var(--mono); font-size: 34px; letter-spacing: -.03em;
  color: var(--green); margin: 12px 0 4px; font-variant-numeric: tabular-nums;
}
.timer-card .tc-since { font-size: 11.5px; color: var(--muted-2); }
.timer-card .tc-actions { display: flex; gap: 8px; margin-top: 13px; }

.empty {
  text-align: center; padding: 34px 18px; color: var(--muted-2);
  border: 1px dashed var(--line); border-radius: var(--radius); background: var(--bg-soft);
}
.empty strong { display: block; color: var(--muted); margin-bottom: 4px; font-size: 14px; }

/* ------------------------------ Tablas ------------------------------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line-soft); border-radius: var(--radius);
  background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  text-align: left; padding: 11px 14px; font-size: 11px; text-transform: uppercase;
  letter-spacing: .07em; color: var(--muted-2); border-bottom: 1px solid var(--line);
  background: var(--bg-soft); white-space: nowrap; position: sticky; top: 0;
}
tbody td { padding: 11px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(255,255,255,.022); }
td.num, th.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
td.actions { text-align: right; white-space: nowrap; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px;
  border-radius: 999px; font-size: 11.5px; background: var(--panel-2); color: var(--muted);
  border: 1px solid var(--line);
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; }
.chip.green { color: var(--green); border-color: rgba(45,212,167,.3); background: rgba(45,212,167,.1); }
.chip.amber { color: var(--amber); border-color: rgba(245,183,78,.3); background: rgba(245,183,78,.1); }
.chip.red   { color: var(--red);   border-color: rgba(255,107,107,.3); background: rgba(255,107,107,.1); }
.chip.muted { opacity: .65; }

.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 7px;
  vertical-align: -1px; }

/* ----------------------------- Formularios --------------------------- */

.field { display: block; margin-bottom: 13px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.field input[type=text], .field input[type=email], .field input[type=password],
.field input[type=number], .field input[type=date], .field input[type=datetime-local],
.field select, .field textarea, .inp {
  width: 100%; padding: 9px 11px; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--line); color: var(--text);
  outline: none; transition: .13s;
}
.field input:focus, .field select:focus, .field textarea:focus, .inp:focus {
  border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,124,255,.16);
}
.field textarea { min-height: 78px; resize: vertical; }
.field input[type=color] { width: 46px; height: 36px; padding: 3px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--line); }
.field-row { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0,1fr)); }
.field-row-3 { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0,1fr)); }
.check { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted);
  margin-bottom: 13px; cursor: pointer; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters .f { display: flex; flex-direction: column; gap: 5px; }
.filters .f span { font-size: 11px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .07em; }
.filters select, .filters input { min-width: 150px; padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--panel); border: 1px solid var(--line); color: var(--text); outline: none; }
.filters .grow { flex: 1; }

/* ------------------------------ Modales ------------------------------ */

.modal-root {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: rgba(4,6,10,.68); backdrop-filter: blur(3px); padding: 20px;
  overflow-y: auto;
}
/* Imprescindible: `display: grid` gana al display:none que el navegador aplica
   a [hidden], así que la capa oscura y difuminada taparía toda la aplicación. */
.modal-root[hidden] { display: none; }
.modal {
  width: 100%; max-width: 560px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow); animation: pop .16s ease;
  max-height: calc(100vh - 40px); display: flex; flex-direction: column;
}
.modal.wide { max-width: 820px; }
@keyframes pop { from { opacity: 0; transform: scale(.97) translateY(6px); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between;
  padding: 15px 18px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { font-size: 15.5px; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px;
  padding: 13px 18px; border-top: 1px solid var(--line-soft); }

/* ------------------------------ Avisos ------------------------------- */

.alert { padding: 10px 13px; border-radius: var(--radius-sm); font-size: 13px; margin-bottom: 14px; }
.alert-error { background: rgba(255,107,107,.12); border: 1px solid rgba(255,107,107,.3); color: #ffb4b4; }
.alert-info  { background: rgba(79,124,255,.1); border: 1px solid rgba(79,124,255,.28); color: var(--accent-2); }

.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 11px 15px; border-radius: var(--radius-sm); background: var(--panel-2);
  border: 1px solid var(--line); box-shadow: var(--shadow); font-size: 13px;
  animation: slide .2s ease; max-width: 360px;
}
.toast.ok  { border-left: 3px solid var(--green); }
.toast.err { border-left: 3px solid var(--red); }
@keyframes slide { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }

.loading-bar {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: linear-gradient(90deg, var(--accent), var(--violet));
  z-index: 300; transition: width .2s ease, opacity .3s;
}
.loading-bar.on { width: 78%; }
.loading-bar.done { width: 100%; opacity: 0; }

/* ------------------------------ Gráficas ----------------------------- */

.charts { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0,1fr)); }
@media (max-width: 980px) { .charts { grid-template-columns: 1fr; } }
.chart-card { background: var(--panel); border: 1px solid var(--line-soft);
  border-radius: var(--radius); padding: 14px 16px 8px; }
.chart-card h3 { font-size: 13px; color: var(--muted); margin-bottom: 10px; font-weight: 550; }
.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 330px; }

/* ------------------------------- Login ------------------------------- */

.login-body { display: grid; place-items: center; min-height: 100vh;
  background: radial-gradient(1000px 600px at 50% -10%, #17203a 0%, var(--bg) 55%); }
.login-card { width: 100%; max-width: 380px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 18px; padding: 30px; box-shadow: var(--shadow); }
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand h1 { font-size: 20px; margin-top: 10px; }
.login-brand p { margin: 3px 0 0; color: var(--muted-2); font-size: 13px; }
.login-foot { text-align: center; font-size: 11.5px; color: var(--muted-2); margin: 16px 0 0; }

/* ------------------------------ Utiles ------------------------------- */

.muted { color: var(--muted-2); }
.mono  { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.row   { display: flex; align-items: center; gap: 9px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.mb0 { margin-bottom: 0; } .mb14 { margin-bottom: 14px; } .mb20 { margin-bottom: 20px; }
.mt14 { margin-top: 14px; } .mt20 { margin-top: 20px; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .09em;
  color: var(--muted-2); margin: 0 0 11px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #26304099; border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #35415a; }

/* ------------------------- Menú móvil y avisos ----------------------- */

.menu-btn { display: none; flex: 0 0 auto; }
.sidebar-backdrop { position: fixed; inset: 0; z-index: 55; background: rgba(4,6,10,.6); }
.sidebar-backdrop[hidden] { display: none; }

.alert-warn { background: rgba(245,183,78,.1); border: 1px solid rgba(245,183,78,.35); color: #ffd58a;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.alert-warn strong { color: var(--amber); }
.alert-warn .grow { flex: 1; }

.logo-box { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; }
.logo-box .logo-prev { width: 96px; height: 56px; border-radius: 8px; border: 1px dashed var(--line);
  background: #fff; display: grid; place-items: center; overflow: hidden; }
.logo-box .logo-prev img { max-width: 92px; max-height: 52px; object-fit: contain; }
.logo-box .logo-prev.empty { background: var(--bg); color: var(--muted-2); font-size: 11px; }
.logo-box input[type=file] { display: none; }

.chip.blue { color: var(--accent-2); border-color: rgba(79,124,255,.35); background: rgba(79,124,255,.12); }

@media (max-width: 820px) {
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); z-index: 60; transition: .2s; }
  .sidebar.open { transform: none; }
  .menu-btn { display: inline-grid; }
  .views { padding: 16px; }
  .topbar { padding: 12px 16px; gap: 10px; }
  .topbar-left p { display: none; }
  .clock { display: none; }
  #btnQuickStart span { display: none; }
  .grid-4, .grid-3, .grid-2, .charts, .field-row, .field-row-3 { grid-template-columns: 1fr; }
  .timers { grid-template-columns: 1fr; }
  .filters select, .filters input { min-width: 0; width: 100%; }
  .filters .f { flex: 1 1 45%; }
}

/* Informe: subtareas (notas de los registros) bajo cada tarea */
tr.task-row td:first-child { font-weight: 600; }
tr.subtask-row td { font-size: 12.5px; color: var(--muted); padding-top: 6px; padding-bottom: 6px; }
tr.subtask-row td:first-child { padding-left: 30px; color: var(--text); }
.sub-mark { color: var(--accent); margin-right: 6px; }
