/* Cockpit — crisp instrument panel. Calm but modern. */
:root {
  --bg: #F6F7FB;
  --card: #FFFFFF;
  --ink: #14181F;
  --muted: #6B7280;
  --muted-soft: #9AA1AC;
  --line: #E7E9F0;
  --line-soft: #F0F1F6;
  --research: #3B63E0;
  --teaching: #0F9D7C;
  --admin: #DA8A1F;
  --family: #9333EA;
  --personal: #0891B2;
  --alert: #E1493F;
  --disp: 'Archivo', system-ui, sans-serif;
  --body: 'Public Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(20, 24, 31, 0.04), 0 1px 1px rgba(20, 24, 31, 0.03);
  --shadow-md: 0 12px 28px -12px rgba(20, 24, 31, 0.16), 0 2px 6px rgba(20, 24, 31, 0.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(1100px 480px at 100% -8%, rgba(59, 99, 224, 0.06), transparent 60%),
    var(--bg);
  color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.shell { display: grid; grid-template-columns: 184px 1fr; min-height: 100vh; }
.rail {
  background: rgba(255, 255, 255, 0.6);
  border-right: 1px solid var(--line);
  padding: 24px 14px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 0; height: 100vh;
  backdrop-filter: saturate(160%) blur(6px);
}
.brand { font-family: var(--disp); font-weight: 800; font-size: 20px; letter-spacing: -0.02em; margin: 4px 6px 20px; }
.brand span { color: var(--research); font-weight: 500; }
.navbtn {
  text-align: left; background: none; border: none; border-left: 3px solid transparent;
  font-family: var(--disp); font-weight: 600; font-size: 14.5px; color: var(--muted);
  padding: 10px 12px; border-radius: 10px; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.navbtn:hover { color: var(--ink); background: rgba(59, 99, 224, 0.06); }
.navbtn.active { color: var(--research); background: rgba(59, 99, 224, 0.09); border-left-color: var(--research); font-weight: 700; }
.navbtn:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--research); outline-offset: 2px; border-radius: 4px;
}
.rail-foot { margin-top: auto; font-family: var(--mono); font-size: 11px; color: var(--muted-soft); line-height: 1.6; padding: 0 6px; }

main { padding: 30px 34px 90px; max-width: 1020px; }
.tab { display: none; }
.tab.active { display: block; animation: fade-in 0.18s ease; }
@keyframes fade-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; margin-bottom: 16px; box-shadow: var(--shadow-sm);
}
.card-eyebrow { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 12px; font-weight: 600; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* Capture bar */
.capturebar { display: flex; gap: 8px; margin-bottom: 20px; }
.capturebar input {
  flex: 1; padding: 13px 16px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--body); font-size: 15px; background: var(--card); box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease;
}
.capturebar input:focus-visible { border-color: var(--research); }
.capturebar button, button.primary {
  background: var(--ink); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 0 20px; font-family: var(--disp); font-weight: 700; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: transform 0.1s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.capturebar button:hover, button.primary:hover { background: #262C36; box-shadow: var(--shadow-md); }
.capturebar button:active, button.primary:active { transform: translateY(1px); }

/* Now card — the signature */
.now-card {
  border-radius: 22px; padding: 26px 28px; color: #fff;
  display: grid; grid-template-columns: 1fr 150px; gap: 18px; align-items: center;
  margin-bottom: 16px; box-shadow: var(--shadow-md); position: relative; overflow: hidden;
}
.now-card::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.14), rgba(255,255,255,0) 55%);
}
.now-card .roles-tag { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; opacity: 0.88; }
.now-card h1 { font-family: var(--disp); font-weight: 800; font-size: 31px; letter-spacing: -0.02em; margin: 7px 0 4px; }
.now-card .outcome { font-size: 15px; opacity: 0.94; }
.now-card .times { font-family: var(--mono); font-size: 13px; margin-top: 12px; opacity: 0.88; }
.now-card .remaining { font-family: var(--mono); font-weight: 600; font-size: 15px; }
.now-actions { margin-top: 16px; display: flex; gap: 8px; position: relative; }
.now-actions button {
  background: rgba(255,255,255,0.18); border: 1px solid rgba(255,255,255,0.38); color: #fff;
  border-radius: 9px; padding: 8px 16px; font-family: var(--disp); font-weight: 700; cursor: pointer;
  backdrop-filter: blur(2px); transition: background 0.15s ease;
}
.now-actions button:hover { background: rgba(255,255,255,0.3); }
.disc { width: 150px; height: 150px; position: relative; }
.disc .face { fill: rgba(255,255,255,0.16); }
.disc .left { fill: rgba(255,255,255,0.94); }
.disc text { font-family: var(--mono); font-weight: 600; }

.open-card { background: var(--card); border: 1px dashed var(--line); border-radius: 20px; padding: 26px 28px; margin-bottom: 16px; }
.open-card h1 { font-family: var(--disp); font-size: 22px; margin: 0 0 6px; letter-spacing: -0.01em; }

.next-card { border-left: 4px solid var(--line); }
.next-card .nx-title { font-family: var(--disp); font-weight: 700; font-size: 17px; }
.next-card .nx-time { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 2px; }

.events { display: flex; flex-direction: column; gap: 7px; }
.ev { display: flex; gap: 10px; font-size: 13px; align-items: baseline; }
.ev .t { font-family: var(--mono); color: var(--muted); min-width: 88px; }
.ev .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; align-self: center; }
.ev.err { color: var(--alert); }

/* Plan rows */
.plan-row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-bottom: 1px solid var(--line-soft); }
.plan-row:last-child { border-bottom: none; }
.plan-row .pt { font-family: var(--mono); font-size: 12px; color: var(--muted); min-width: 100px; }
.plan-row .pl { font-weight: 600; flex: 1; }
.plan-row .role-pill { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: #fff; border-radius: 20px; padding: 3px 10px; }
.plan-row.done .pl { text-decoration: line-through; color: var(--muted); }
.plan-row .tick { font-family: var(--mono); font-size: 12px; color: var(--teaching); font-weight: 600; }
.plan-meta { font-size: 12.5px; color: var(--muted); margin-bottom: 4px; }

/* Projects */
.proj { margin-bottom: 16px; padding-bottom: 4px; }
.proj + .proj { border-top: 1px solid var(--line-soft); padding-top: 14px; }
.proj-head { display: flex; align-items: center; gap: 10px; }
.proj-head h3 { font-family: var(--disp); font-size: 17px; margin: 0; flex: 1; letter-spacing: -0.01em; }
.proj .next-step {
  background: rgba(59, 99, 224, 0.07); border: 1px solid rgba(59, 99, 224, 0.14);
  border-radius: var(--radius-sm); padding: 9px 13px; margin: 9px 0; font-weight: 600;
  display: flex; gap: 8px; align-items: center;
}
.proj .next-step .ns-tag { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.step { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 14px; }
.step.done { color: var(--muted); text-decoration: line-through; }
.step input[type=checkbox] { accent-color: var(--research); width: 15px; height: 15px; }
.addstep { display: flex; gap: 6px; margin-top: 8px; }
.addstep input { flex: 1; }
.ghost {
  background: none; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px 12px;
  cursor: pointer; font-family: var(--disp); font-weight: 600; color: var(--muted); transition: all 0.15s ease;
}
.ghost:hover { color: var(--ink); border-color: var(--muted-soft); background: var(--line-soft); }

/* Forms */
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 8px 0; }
input, select {
  padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-family: var(--body); font-size: 14px; background: #fff; color: var(--ink);
  transition: border-color 0.15s ease;
}
input:focus-visible, select:focus-visible { border-color: var(--research); }
label { display: block; font-size: 13px; color: var(--muted); margin: 10px 0; font-weight: 600; }
label input { display: block; width: 100%; margin-top: 5px; font-weight: 400; }
.inline-form label input { width: auto; display: inline-block; }
.hint { font-size: 12.5px; color: var(--muted); }
button { font-size: 14px; }
#set-save, #np-add, #history-upload, #capture-btn, #tpl-save, #plan-save {
  background: var(--ink); color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 10px 18px; font-family: var(--disp); font-weight: 700; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: background 0.15s ease, box-shadow 0.15s ease;
}
#set-save:hover, #np-add:hover, #history-upload:hover, #capture-btn:hover, #tpl-save:hover, #plan-save:hover {
  background: #262C36; box-shadow: var(--shadow-md);
}
#tpl-addrow { background: none; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 18px; cursor: pointer; transition: border-color 0.15s ease; }
#tpl-addrow:hover { border-color: var(--muted-soft); }

.toggle-row { display: flex; align-items: center; gap: 10px; margin: 10px 0; }
.toggle-row input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--research); }
.toggle-row label { margin: 0; font-weight: 600; color: var(--ink); }

/* Review */
.triage-row, .inbox-row { display: flex; align-items: center; gap: 8px; padding: 8px 2px; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.triage-row .dm { font-family: var(--mono); font-size: 13px; flex: 1; min-width: 180px; }
.triage-row .cnt { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.cat-btn { border: 1px solid var(--line); background: none; border-radius: 20px; padding: 5px 13px; cursor: pointer; font-size: 12px; font-weight: 600; transition: all 0.15s ease; }
.cat-btn.work:hover { border-color: var(--teaching); color: var(--teaching); background: rgba(15,157,124,0.06); }
.cat-btn.neutral:hover { border-color: var(--muted); }
.cat-btn.distraction:hover { border-color: var(--alert); color: var(--alert); background: rgba(225,73,63,0.06); }
.inbox-row .cap-text { flex: 1; min-width: 200px; }
.inbox-row .cap-ts { font-family: var(--mono); font-size: 11px; color: var(--muted); }

.bal-row { display: grid; grid-template-columns: 80px 1fr 60px; gap: 8px; align-items: center; margin: 9px 0; font-size: 13px; }
.bal-track { background: var(--line-soft); border-radius: 6px; height: 14px; overflow: hidden; }
.bal-fill { height: 100%; border-radius: 6px; transition: width 0.3s ease; }
.bal-num { font-family: var(--mono); font-size: 12px; color: var(--muted); text-align: right; }

/* Template editor */
.tpl-row { display: grid; grid-template-columns: 92px 84px 84px 130px 1fr 1fr 30px; gap: 6px; margin-bottom: 6px; align-items: center; }
.tpl-row input, .tpl-row select { width: 100%; padding: 7px 9px; font-size: 13px; }
.tpl-head { font-family: var(--mono); font-size: 10px; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.tpl-del { background: none; border: none; color: var(--alert); cursor: pointer; font-size: 17px; line-height: 1; padding: 4px; border-radius: 6px; transition: background 0.15s ease; }
.tpl-del:hover { background: rgba(225,73,63,0.08); }
.tpl-row input:disabled, .tpl-row select:disabled, .tpl-row button:disabled { opacity: 0.5; cursor: not-allowed; background: var(--line-soft); }

.mix-row { display: grid; grid-template-columns: 96px repeat(4, 1fr); gap: 8px; align-items: center; margin: 6px 0; }
.mix-row input { width: 100%; }
.mix-head { font-family: var(--mono); font-size: 10px; text-transform: uppercase; color: var(--muted); font-weight: 600; }

#metrics-chart svg { width: 100%; height: auto; }

#toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(90px);
  background: var(--ink); color: #fff; padding: 11px 22px; border-radius: 12px;
  font-family: var(--disp); font-weight: 600; box-shadow: var(--shadow-md);
  transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1); z-index: 50;
}
#toast.show { transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  #toast, .tab.active, .navbtn, .card, button, input, select { transition: none; animation: none; }
}
@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .rail { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 12px 14px; border-right: none; border-bottom: 1px solid var(--line); }
  .brand { margin: 0 12px 0 0; }
  .rail-foot { display: none; }
  main { padding: 18px 16px 60px; }
  .two-col { grid-template-columns: 1fr; }
  .now-card { grid-template-columns: 1fr; }
  .disc { margin: 0 auto; }
  .tpl-row { grid-template-columns: 1fr 1fr; }
  .mix-row { grid-template-columns: 1fr 1fr; }
}
