/* Oyarzabal Dashboard — original stylesheet, written from scratch.
   Design tokens are my own definitions, informed by visual estimates
   (warm light gray page, white cards, black primary actions). */

/* ---------- Tokens ---------- */
:root {
  --radius-card: 22px;
  --radius-btn: 13px;
  --radius-pill: 999px;
  --pad-page: 56px;
  --pad-card: 26px;
  --gap: 24px;
  --shadow: 0 10px 30px rgba(20, 22, 26, .08), 0 2px 8px rgba(20, 22, 26, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* status colors stay constant across palettes */
  --ok: #2f9e6e; --ok-bg: #d7efe2;
  --warn: #b98a1e; --warn-bg: #f3e5bd;
  --bad: #c05a5a; --bad-bg: #f6d9d9;
  --neutral-bg: #e4e2de;
}

/* Mono light (default) */
:root, [data-theme="mono"][data-mode="light"] {
  --bg: #f1efe9; --bg-soft: #eceae4;
  --card: #ffffff; --card2: #eae7e0;
  --text: #17191c; --muted: #6f747a; --line: #e2ded6;
  --accent: #111214; --accent-text: #ffffff;
  --nav-bg: #ffffff; --dock-bg: #141518; --dock-text: #f2f2f0;
}
[data-theme="mono"][data-mode="dark"] {
  --bg: #121316; --bg-soft: #1a1c1f;
  --card: #1e2023; --card2: #26282c;
  --text: #f2f2f0; --muted: #9aa0a6; --line: #2c2f34;
  --accent: #f2f2f0; --accent-text: #141518;
  --nav-bg: #1e2023; --dock-bg: #000000; --dock-text: #f2f2f0;
  --shadow: 0 10px 30px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.3);
}
/* Pastel */
[data-theme="pastel"][data-mode="light"] {
  --bg: #f5eef6; --bg-soft: #efe6f2;
  --card: #ffffff; --card2: #f3eaf7;
  --text: #241f2b; --muted: #7a7284; --line: #e6ddef;
  --accent: #5b4a7a; --accent-text: #ffffff;
  --nav-bg: #ffffff; --dock-bg: #3d3450; --dock-text: #f2f2f0;
}
[data-theme="pastel"][data-mode="dark"] {
  --bg: #1d1922; --bg-soft: #241f2c;
  --card: #2b2336; --card2: #332a42;
  --text: #f1eef5; --muted: #a89fb8; --line: #3a3049;
  --accent: #c9b8e8; --accent-text: #241f2c;
  --nav-bg: #2b2336; --dock-bg: #120e18; --dock-text: #f2f2f0;
}
/* Ocean */
[data-theme="ocean"][data-mode="light"] {
  --bg: #e9f2f8; --bg-soft: #e0edf5;
  --card: #ffffff; --card2: #e4f0f7;
  --text: #16232e; --muted: #5f7686; --line: #d5e5ef;
  --accent: #1d5f86; --accent-text: #ffffff;
  --nav-bg: #ffffff; --dock-bg: #14324a; --dock-text: #f2f2f0;
}
[data-theme="ocean"][data-mode="dark"] {
  --bg: #101c26; --bg-soft: #15222e;
  --card: #1c2c3a; --card2: #223548;
  --text: #eef5fa; --muted: #93a9ba; --line: #2c4053;
  --accent: #7fb3d5; --accent-text: #101c26;
  --nav-bg: #1c2c3a; --dock-bg: #070f16; --dock-text: #f2f2f0;
}
/* Sage */
[data-theme="sage"][data-mode="light"] {
  --bg: #eef2e8; --bg-soft: #e7ecdc;
  --card: #ffffff; --card2: #e9efe0;
  --text: #20241c; --muted: #68705e; --line: #dde3cf;
  --accent: #3f5a36; --accent-text: #ffffff;
  --nav-bg: #ffffff; --dock-bg: #232b1e; --dock-text: #f2f2f0;
}
[data-theme="sage"][data-mode="dark"] {
  --bg: #171c14; --bg-soft: #1c2219;
  --card: #232b1e; --card2: #2a3324;
  --text: #eef2e8; --muted: #9aa48d; --line: #33402a;
  --accent: #a8bf9a; --accent-text: #171c14;
  --nav-bg: #232b1e; --dock-bg: #0c0f0a; --dock-text: #f2f2f0;
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.5;
  transition: background .35s ease, color .35s ease;
}
button { font: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }
a { color: inherit; }
.skip-link {
  position: absolute; left: -999px; top: 8px; background: var(--accent);
  color: var(--accent-text); padding: 8px 14px; border-radius: 8px; z-index: 200;
}
.skip-link:focus { left: 8px; }
h1 { font-size: 40px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
h2 { font-size: 18px; font-weight: 650; margin: 0 0 12px; }
h3 { font-size: 14px; font-weight: 600; margin: 0 0 8px; }

/* ---------- Top shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 20px;
  padding: 14px 28px; background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; cursor: pointer; min-width: 210px; }
.brand-mark {
  width: 38px; height: 38px; border-radius: 11px; background: var(--accent);
  color: var(--accent-text); display: grid; place-items: center;
  font-size: 20px; font-weight: 800; flex: none;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 15px; }
.brand-text small { color: var(--muted); font-size: 12px; }
.navpill {
  display: flex; gap: 4px; margin: 0 auto; background: var(--nav-bg);
  border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 4px;
  box-shadow: var(--shadow);
}
.navpill button {
  border: 0; background: transparent; color: var(--muted); padding: 8px 14px;
  border-radius: var(--radius-pill); font-size: 13.5px; font-weight: 500; white-space: nowrap;
  transition: background .2s ease, color .2s ease;
}
.navpill button:hover { color: var(--text); }
.navpill button.active { background: var(--accent); color: var(--accent-text); }
.badge {
  display: inline-block; min-width: 20px; text-align: center; font-size: 11px;
  font-weight: 700; background: var(--bad); color: #fff; border-radius: 10px; padding: 1px 6px;
}
.topright { display: flex; align-items: center; gap: 12px; position: relative; }
.icon-btn {
  position: relative; width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--nav-bg); color: var(--text);
  display: grid; place-items: center;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .dot {
  position: absolute; top: 8px; right: 9px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--bad); border: 1.5px solid var(--nav-bg);
}
.avatar-stack { display: flex; }
.avatar-stack span {
  width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--bg);
  background: var(--card2); color: var(--text); font-size: 11px; font-weight: 700;
  display: grid; place-items: center; margin-left: -8px;
}
.avatar-stack span:first-child { margin-left: 0; }
.profile-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-text); font-size: 13px; font-weight: 700;
}
.notif-panel {
  position: absolute; top: 52px; right: 0; width: 340px; background: var(--card);
  border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  padding: 14px; z-index: 60;
}
.notif-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.text-btn { border: 0; background: none; color: var(--muted); font-size: 13px; text-decoration: underline; padding: 0; }
.notif-item { padding: 10px 0; border-top: 1px solid var(--line); font-size: 13.5px; }
.notif-item small { color: var(--muted); display: block; }

/* ---------- Dock ---------- */
.dock {
  position: fixed; left: 20px; top: 50%; transform: translateY(-50%); z-index: 50;
  display: flex; flex-direction: column; gap: 4px; background: var(--dock-bg);
  color: var(--dock-text); border-radius: 22px; padding: 10px 8px; box-shadow: var(--shadow);
}
.dock button {
  position: relative; border: 0; background: transparent; color: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 8px; border-radius: 14px; font-size: 10.5px;
  transition: background .2s ease;
}
.dock button:hover, .dock button.active { background: rgba(255,255,255,.14); }
.dock svg { width: 20px; height: 20px; }
.dock .badge { position: absolute; top: 2px; right: 2px; }

/* ---------- Page ---------- */
.page-wrap { max-width: 1400px; margin: 0 auto; padding: 20px var(--pad-page) 90px 108px; }
.page-head { display: flex; justify-content: space-between; align-items: center; margin: 10px 0 24px; }
.live-pill {
  display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--line); background: var(--card); border-radius: var(--radius-pill);
  padding: 6px 14px;
}
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .4; } }
.caption { color: var(--muted); font-size: 13px; margin: -14px 0 18px; }

/* ---------- Cards / KPI ---------- */
.grid { display: grid; gap: var(--gap); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.split-13 { grid-template-columns: 1fr 2fr; }
.split-23 { grid-template-columns: 2fr 1fr; }
.card {
  background: var(--card); border-radius: var(--radius-card); box-shadow: var(--shadow);
  padding: var(--pad-card);
}
.card.soft { background: var(--card2); }
.card.dark { background: var(--accent); color: var(--accent-text); }
.card.dark .muted { color: color-mix(in srgb, var(--accent-text) 70%, transparent); }
.muted { color: var(--muted); }
.card-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.info { color: var(--muted); font-size: 13px; cursor: help; }
.kpi { font-size: 32px; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -.01em; margin: 6px 0 2px; }
.delta { font-size: 13px; font-weight: 600; }
.delta.up { color: var(--ok); } .delta.down { color: var(--bad); }
.foot-link {
  display: block; margin-top: 16px; padding-top: 12px; border-top: 1.5px dotted var(--line);
  font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none;
}
.foot-link:hover { color: var(--text); }

/* ---------- Buttons / controls ---------- */
.btn {
  border: 0; border-radius: var(--radius-btn); padding: 10px 18px; font-weight: 600;
  font-size: 14px; background: var(--accent); color: var(--accent-text);
  transition: transform .15s ease, opacity .15s ease;
}
.btn:hover { opacity: .92; } .btn:active { transform: scale(.97); }
.btn.secondary { background: var(--card); color: var(--text); border: 1px solid var(--line); }
.btn.danger-outline { background: transparent; color: var(--bad); border: 1.5px solid var(--bad); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.seg {
  display: inline-flex; gap: 2px; background: var(--card2); border-radius: var(--radius-pill); padding: 3px;
}
.seg button {
  border: 0; background: transparent; color: var(--muted); padding: 7px 14px;
  border-radius: var(--radius-pill); font-size: 13px; font-weight: 500;
}
.seg button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.1); }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
  border-radius: var(--radius-pill); padding: 6px 13px; font-size: 13px;
}
.chip.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.pill {
  display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 11px; border-radius: var(--radius-pill);
}
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.neutral { background: var(--neutral-bg); color: var(--muted); }
.pill.dark { background: var(--accent); color: var(--accent-text); }
input[type="text"], input[type="search"], input[type="email"], input[type="number"], select, textarea {
  background: var(--card); border: 1px solid var(--line); border-radius: 11px;
  padding: 9px 13px; width: 100%; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--muted); }
.search-box { max-width: 320px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
label.field { display: block; font-size: 13px; font-weight: 600; margin-bottom: 12px; }
label.field input, label.field select, label.field textarea { margin-top: 5px; font-weight: 400; }
/* iOS-style toggle */
.toggle { position: relative; width: 46px; height: 26px; appearance: none; background: var(--neutral-bg); border-radius: 13px; border: 0; padding: 0; flex: none; transition: background .2s ease; }
.toggle::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s ease; }
.toggle:checked { background: var(--accent); }
.toggle:checked::after { transform: translateX(20px); }
.toggle-row { display: flex; justify-content: space-between; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); gap: 16px; }
.toggle-row:first-child { border-top: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: 12.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
tr.rowlink { cursor: pointer; } tr.rowlink:hover td { background: var(--card2); }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--card2); display: inline-grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.who { display: flex; align-items: center; gap: 10px; }
.who small { display: block; color: var(--muted); }
.stockbar { width: 90px; height: 7px; background: var(--neutral-bg); border-radius: 4px; overflow: hidden; display: inline-block; vertical-align: middle; }
.stockbar i { display: block; height: 100%; background: var(--accent); }
.stockbar i.low { background: var(--warn); } .stockbar i.out { background: var(--bad); }

/* ---------- Drawer / modal / toast ---------- */
.drawer-backdrop, .modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,17,20,.45); backdrop-filter: blur(3px); z-index: 80;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(460px, 94vw); z-index: 90;
  background: var(--card); box-shadow: -12px 0 40px rgba(0,0,0,.18); overflow-y: auto;
  padding: 26px; transform: translateX(105%); transition: transform .3s ease;
}
.drawer.open { transform: translateX(0); }
.drawer-close { position: absolute; top: 14px; right: 16px; border: 0; background: none; font-size: 26px; color: var(--muted); line-height: 1; }
.drawer h2 { font-size: 22px; padding-right: 30px; }
.stepper { display: flex; align-items: center; gap: 0; margin: 16px 0; }
.stepper .st { flex: 1; text-align: center; font-size: 11.5px; color: var(--muted); }
.stepper .st .dot2 { width: 22px; height: 22px; border-radius: 50%; background: var(--neutral-bg); color: var(--muted); display: grid; place-items: center; margin: 0 auto 4px; font-size: 11px; font-weight: 700; }
.stepper .st.done .dot2 { background: var(--ok); color: #fff; }
.stepper .st.now .dot2 { background: var(--accent); color: var(--accent-text); }
.stepper .bar { flex: 1; height: 2px; background: var(--neutral-bg); margin-bottom: 22px; }
.stepper .bar.done { background: var(--ok); }
.palette {
  position: fixed; left: 50%; top: 14vh; transform: translateX(-50%); z-index: 95;
  width: min(560px, 92vw); background: var(--card); border: 1px solid var(--line);
  border-radius: 20px; box-shadow: var(--shadow); padding: 14px;
}
.palette input { font-size: 16px; padding: 12px 16px; }
.palette-hint { color: var(--muted); font-size: 12px; margin: 10px 4px 0; }
.pal-group { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .06em; margin: 14px 4px 4px; }
.pal-item { width: 100%; text-align: left; border: 0; background: transparent; color: var(--text); padding: 10px 12px; border-radius: 10px; font-size: 14px; }
.pal-item:hover, .pal-item.sel { background: var(--card2); }
.pal-item small { color: var(--muted); display: block; }
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 120;
  background: var(--accent); color: var(--accent-text); padding: 11px 22px; border-radius: var(--radius-pill);
  font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
}

/* ---------- Charts ---------- */
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.bar-btn { border: 0; background: transparent; color: var(--muted); font-size: 12px; padding: 4px 2px; border-radius: 6px; }
.bar-btn.sel { color: var(--text); font-weight: 700; }
.month-row { display: flex; gap: 2px; margin-top: 8px; }
.month-row .bar-btn { flex: 1; }
.tip {
  position: absolute; pointer-events: none; background: #141518; color: #f2f2f0;
  font-size: 12.5px; padding: 8px 12px; border-radius: 10px; white-space: nowrap; z-index: 40;
  box-shadow: var(--shadow);
}
.chart-box { position: relative; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; margin-top: 10px; }
.legend button { border: 0; background: none; color: var(--text); font-size: 13px; padding: 2px 4px; }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; }
.heat { display: grid; grid-template-columns: 64px repeat(4, 1fr); gap: 6px; font-size: 12.5px; align-items: center; }
.heat .cell { height: 30px; border-radius: 8px; }
.heat .h0 { color: var(--muted); }
.funnel-row { display: flex; align-items: center; gap: 12px; margin: 10px 0; font-size: 13.5px; }
.funnel-row .flabel { width: 130px; flex: none; }
.funnel-row .fbar { height: 26px; border-radius: 8px; background: var(--accent); color: var(--accent-text); display: flex; align-items: center; padding: 0 10px; font-size: 12.5px; font-weight: 600; min-width: 52px; }
.funnel-row .fdrop { color: var(--bad); font-size: 12.5px; white-space: nowrap; }

/* ---------- Kanban / nodes / misc ---------- */
.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-items: start; }
.kan-col { background: var(--card2); border-radius: 18px; padding: 14px; }
.kan-col h3 { padding: 0 4px; }
.kan-card { background: var(--card); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.06); font-size: 13.5px; }
.kan-card small { color: var(--muted); display: block; margin-top: 4px; }
.node { display: flex; gap: 12px; }
.node-line { display: flex; flex-direction: column; align-items: center; }
.node-line .nd { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-text); display: grid; place-items: center; font-size: 13px; font-weight: 700; flex: none; }
.node-line .vl { width: 2px; flex: 1; min-height: 22px; background: var(--line); }
.node-body { flex: 1; background: var(--card2); border-radius: 14px; padding: 12px 14px; margin-bottom: 6px; }
.node-body strong { display: block; }
.node-body small { color: var(--muted); }
.faq-item { border-top: 1px solid var(--line); }
.faq-q { width: 100%; text-align: left; border: 0; background: none; color: var(--text); padding: 15px 4px; font-weight: 600; font-size: 14.5px; display: flex; justify-content: space-between; }
.faq-a { padding: 0 4px 16px; color: var(--muted); font-size: 14px; }
.swatch { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); padding: 0; }
.swatch.sel { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: 2px; }
.mono-sw { background: linear-gradient(135deg, #f1efe9 50%, #17191c 50%); }
.pastel-sw { background: linear-gradient(135deg, #e9d8f5, #cfe8d8); }
.ocean-sw { background: linear-gradient(135deg, #cfe6f5, #7fb3d5); }
.sage-sw { background: linear-gradient(135deg, #dfe8cf, #a8bf9a); }
.empty { color: var(--muted); font-size: 14px; padding: 24px 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .split-13, .split-23 { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: repeat(2, 1fr); }
  .page-wrap { padding: 16px 22px 110px 22px; }
  .dock {
    left: 0; right: 0; top: auto; bottom: 0; transform: none; flex-direction: row;
    justify-content: space-around; border-radius: 20px 20px 0 0; padding: 8px 6px;
  }
  .dock button { padding: 6px 10px; }
  .dock button span { display: none; }
  .dock .badge { top: 0; right: 6px; }
  .brand-text small { display: none; }
  .brand { min-width: 0; }
  .brand-text strong { display: none; }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; padding: 12px 14px; gap: 10px; }
  .navpill { order: 3; margin: 0; width: 100%; overflow-x: auto; scrollbar-width: none; }
  .navpill::-webkit-scrollbar { display: none; }
  .grid-4, .grid-2 { grid-template-columns: 1fr; }
  .kanban { grid-template-columns: 1fr; }
  .page-wrap { padding: 12px 14px 110px 14px; }
  h1 { font-size: 30px; }
  .avatar-stack { display: none; }
  .notif-panel { width: min(340px, 92vw); }
  .funnel-row .flabel { width: 96px; }
}
