/* Dafor ERP · tema oscuro naranja/negro */
:root {
  --bg: #0b0c0e;
  --bg2: #111317;
  --card: #16181d;
  --card2: #1c1f26;
  --line: #262a33;
  --line2: #323743;
  --text: #ecedf0;
  --muted: #9aa0ab;
  --faint: #6b7280;
  --accent: #ff7a1a;
  --accent2: #ffa45c;
  --accent-soft: rgba(255, 122, 26, .14);
  --good: #34d399;
  --warn: #facc15;
  --bad: #f87171;
  --info: #38bdf8;
  --violet: #a78bfa;
  --pink: #f472b6;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex: none; background: var(--bg2); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 18px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.wordmark { font-family: "Exo 2", "Segoe UI Black", "Arial Black", system-ui, sans-serif; font-weight: 800; color: var(--accent); letter-spacing: .06em; line-height: 1; }
.brand svg { width: 44px; height: 44px; flex: none; }
.brand b { display: block; font-size: 23px; margin-bottom: 3px; }
.brand small { color: var(--muted); font-size: 11.5px; }
#nav { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
#nav a {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 11px;
  color: var(--muted); font-weight: 500; transition: background .15s, color .15s;
}
#nav a .ic { width: 22px; text-align: center; font-size: 17px; }
#nav a:hover { background: var(--card); color: var(--text); }
#nav a.on { background: var(--accent-soft); color: var(--accent2); }
#nav a .badge { margin-left: auto; background: var(--bad); color: #fff; font-size: 11px; border-radius: 99px; padding: 0 7px; font-weight: 700; }
.side-foot { margin-top: auto; font-size: 12px; color: var(--faint); display: flex; align-items: center; gap: 8px; padding: 10px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(52, 211, 153, .6); animation: pulse 2s infinite; flex: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }

.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 12px 24px; background: rgba(11, 12, 14, .85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line);
}
.menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 520px; display: flex; align-items: center; gap: 8px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; }
.search { min-width: 0; }
.search input { flex: 1; min-width: 0; width: 100%; background: none; border: 0; outline: 0; padding: 9px 0; }
.search:focus-within { border-color: var(--accent); }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--card2); border: 1px solid var(--line2); border-radius: 12px; box-shadow: var(--shadow); display: none; max-height: 60vh; overflow: auto; padding: 6px; }
.search-results.open { display: block; }
.search-results a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 9px; }
.search-results a:hover, .search-results a.sel { background: var(--accent-soft); }
.search-results small { color: var(--muted); margin-left: auto; font-size: 12px; }
.xl-btn { display: inline-flex; align-items: center; gap: 7px; background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 6px 11px; cursor: pointer; font-weight: 600; font-size: 13px; max-width: 230px; flex: none; margin-left: auto; }
.xl-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xl-btn i { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.xl-btn:hover { border-color: #21a366; }
.role-switch { display: flex; background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 3px; }
.role-switch button { border: 0; background: none; padding: 5px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 13px; font-weight: 600; }
.role-switch button.on { background: var(--accent); color: #111; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px; background: var(--accent); color: #111; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: 10.5px; }
.icon-btn { background: var(--card); border: 1px solid var(--line); border-radius: 10px; width: 38px; height: 38px; cursor: pointer; font-size: 18px; }

.view { padding: 26px 24px 60px; max-width: 1440px; width: 100%; margin: 0 auto; }
.view.enter { animation: fadeIn .35s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- page header ---------- */
.page-head { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: 27px; letter-spacing: -.01em; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.demo-pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--accent2); background: var(--accent-soft); border: 1px solid rgba(255,122,26,.3); padding: 3px 10px; border-radius: 99px; font-weight: 600; }

/* ---------- buttons, chips ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line2); background: var(--card2); padding: 8px 14px; border-radius: 11px; cursor: pointer; font-weight: 600; font-size: 14px; transition: transform .1s, background .15s, border-color .15s; white-space: nowrap; }
.btn:hover { border-color: var(--faint); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #111; }
.btn.primary:hover { background: var(--accent2); }
.btn.ghost { background: none; }
.btn.danger { color: var(--bad); border-color: rgba(248,113,113,.4); background: rgba(248,113,113,.08); }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 9px; }
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--card2); border: 1px solid var(--line2); color: var(--muted); white-space: nowrap; }
.chip.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 11px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 600; font-size: 13px; }
.seg button.on { background: var(--card2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); }

/* ---------- cards & grids ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.card h3 { font-size: 15px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card h3 .sub { margin-left: auto; font-weight: 500; color: var(--muted); font-size: 12.5px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-auto { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.span2 { grid-column: span 2; }
.mt { margin-top: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }

/* KPIs */
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 16px 12px; position: relative; overflow: hidden; }
.kpi .lbl { color: var(--muted); font-size: 13px; display: flex; align-items: center; gap: 6px; }
.kpi .val { font-size: 25px; font-weight: 700; margin: 4px 0 2px; letter-spacing: -.01em; }
.kpi .delta { font-size: 12.5px; font-weight: 600; }
.kpi .delta.up { color: var(--good); }
.kpi .delta.down { color: var(--bad); }
.kpi svg.spark { position: absolute; right: 10px; bottom: 10px; width: 84px; height: 30px; opacity: .9; }
.kpi.hero { background: linear-gradient(135deg, rgba(255,122,26,.22), rgba(255,122,26,.04)); border-color: rgba(255,122,26,.35); }

/* charts */
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; }
.chart text { fill: var(--faint); font-size: 11px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: fixed; z-index: 100; pointer-events: none; background: #050506; border: 1px solid var(--line2); border-radius: 10px; padding: 8px 10px; font-size: 12.5px; box-shadow: var(--shadow); opacity: 0; transition: opacity .1s; min-width: 120px; }
.tip.on { opacity: 1; }
.tip b { display: block; margin-bottom: 3px; }
.tip .r { display: flex; justify-content: space-between; gap: 14px; }
.hbars { display: flex; flex-direction: column; gap: 10px; }
.hbar .top { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; margin-bottom: 4px; }
.hbar .top span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track { height: 9px; background: var(--card2); border-radius: 99px; overflow: hidden; }
.track > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.stackbar { display: flex; height: 16px; border-radius: 99px; overflow: hidden; background: var(--card2); }
.stackbar i { height: 100%; transition: width .4s; }
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut-wrap svg { width: 170px; height: 170px; flex: none; }
.donut-legend { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 8px; font-size: 13.5px; }
.donut-legend div { display: flex; align-items: center; gap: 8px; }
.donut-legend b { margin-left: auto; }

/* lists */
.list { display: flex; flex-direction: column; }
.list > div { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.list > div:first-child { border-top: 0; }
.alert-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex: none; font-size: 16px; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--muted); font-weight: 600; font-size: 12.5px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--card2); }
td.r, th.r { text-align: right; }

/* printers */
.printer { position: relative; overflow: hidden; }
.printer .pic { width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; font-size: 34px; background: var(--card2); flex: none; position: relative; }
.printer .pic.busy::after { content: ""; position: absolute; inset: -3px; border-radius: 18px; border: 2px solid var(--accent); animation: spinRing 2.4s linear infinite; border-top-color: transparent; border-left-color: transparent; }
@keyframes spinRing { to { transform: rotate(360deg); } }
.progress { height: 10px; background: var(--card2); border-radius: 99px; overflow: hidden; position: relative; }
.progress > i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 99px; }
.progress.stripes > i { background-image: linear-gradient(45deg, rgba(255,255,255,.18) 25%, transparent 25%, transparent 50%, rgba(255,255,255,.18) 50%, rgba(255,255,255,.18) 75%, transparent 75%); background-size: 18px 18px; background-color: var(--accent); animation: stripes 1s linear infinite; }
@keyframes stripes { to { background-position: 18px 0; } }
.stat-mini { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.stat-mini div { background: var(--card2); border-radius: 11px; padding: 8px 10px; }
.stat-mini small { display: block; color: var(--muted); font-size: 11.5px; }
.stat-mini b { font-size: 15px; }

/* kanban */
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters input, .filters select, .fld input, .fld select, .fld textarea {
  background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; outline: 0; min-width: 0;
}
.filters input:focus, .filters select:focus, .fld input:focus, .fld select:focus, .fld textarea:focus { border-color: var(--accent); }
.filters input[type=search] { min-width: 200px; flex: 1; }
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 1fr); gap: 12px; overflow-x: auto; padding-bottom: 10px; align-items: start; }
.col { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; min-height: 160px; transition: background .15s, border-color .15s; }
.col.over { background: var(--accent-soft); border-color: var(--accent); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 4px 4px 10px; font-weight: 700; font-size: 14px; }
.col-head .count { background: var(--card2); border-radius: 99px; padding: 0 8px; font-size: 12px; color: var(--muted); }
.col-head .sum { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 500; }
.col-bar { height: 3px; border-radius: 3px; margin: -2px 4px 10px; }
.ocard { background: var(--card); border: 1px solid var(--line); border-radius: 13px; padding: 12px; margin-bottom: 9px; cursor: grab; transition: transform .15s, border-color .15s, box-shadow .15s; }
.ocard:hover { border-color: var(--line2); transform: translateY(-2px); box-shadow: var(--shadow); }
.ocard.dragging { opacity: .4; }
.ocard .code { font-size: 11.5px; color: var(--faint); font-weight: 600; letter-spacing: .03em; }
.ocard h4 { font-size: 14.5px; margin: 3px 0 8px; }
.ocard .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.ocard .foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 12.5px; color: var(--muted); }
.ocard .foot .avatar { margin-left: auto; }
.swatch { width: 11px; height: 11px; border-radius: 50%; display: inline-block; border: 1px solid rgba(255,255,255,.25); flex: none; }
.late { color: var(--bad) !important; font-weight: 600; }

/* clients */
.ccard { cursor: pointer; transition: transform .15s, border-color .15s; }
.ccard:hover { transform: translateY(-3px); border-color: var(--line2); }
.ccard .big-av { width: 50px; height: 50px; border-radius: 15px; display: grid; place-items: center; font-weight: 800; font-size: 17px; color: #111; flex: none; }

/* inventory */
.spool { width: 70px; height: 70px; flex: none; }
.mcard.low { border-color: rgba(248,113,113,.45); background: linear-gradient(180deg, rgba(248,113,113,.07), var(--card) 60%); }

/* gantt */
.gantt { position: relative; overflow-x: auto; }
.gantt-inner { min-width: 640px; position: relative; }
.g-row { display: grid; grid-template-columns: 210px 1fr; align-items: center; min-height: 46px; border-top: 1px solid var(--line); }
.g-row.head { border-top: 0; min-height: 26px; font-size: 12px; color: var(--faint); }
.g-name { font-size: 13.5px; font-weight: 600; padding-right: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-lane { position: relative; height: 100%; min-height: 46px; }
.g-bar { position: absolute; top: 11px; height: 24px; border-radius: 8px; overflow: hidden; font-size: 11.5px; font-weight: 700; color: #111; display: flex; align-items: center; padding: 0 8px; white-space: nowrap; }
.g-bar i { position: absolute; inset: 0 auto 0 0; background: rgba(0,0,0,.18); }
.g-bar span { position: relative; }
.g-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--bad); z-index: 2; }
.g-today.nolabel::before { content: none; }
.g-today::before { content: "Hoy"; position: absolute; top: -2px; left: 5px; font-size: 11px; color: var(--bad); font-weight: 700; }
.g-month { position: absolute; top: 4px; font-size: 11px; color: var(--faint); border-left: 1px dashed var(--line2); height: 1000px; padding-left: 4px; }
.task { display: flex; align-items: center; gap: 9px; padding: 5px 0; font-size: 14px; cursor: pointer; user-select: none; }
.task input { accent-color: var(--accent); width: 16px; height: 16px; }
.task.done span { color: var(--faint); text-decoration: line-through; }
.file { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; background: var(--card2); border: 1px solid var(--line); border-radius: 9px; padding: 4px 9px; margin: 0 6px 6px 0; }

/* ideas */
.idea-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; padding: 6px 4px; }
.postit { position: relative; border-radius: 4px 4px 18px 4px; padding: 18px 16px 14px; color: #1a1a1a; box-shadow: 0 14px 26px rgba(0,0,0,.45); transform: rotate(var(--rot)); transition: transform .2s; }
.postit:hover { transform: rotate(0) scale(1.02); z-index: 2; }
.postit::before { content: ""; position: absolute; top: -10px; left: 50%; width: 80px; height: 22px; margin-left: -40px; background: rgba(255,255,255,.35); transform: rotate(-3deg); border-radius: 2px; }
.postit h4 { font-size: 16.5px; margin: 6px 0; }
.postit p { font-size: 13.5px; margin: 0 0 10px; opacity: .85; }
.postit .em { font-size: 30px; }
.postit .tag { display: inline-block; font-size: 11.5px; font-weight: 700; background: rgba(0,0,0,.1); border-radius: 99px; padding: 1px 8px; margin: 0 4px 4px 0; }
.postit .pfoot { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.postit .vote { border: 0; background: rgba(0,0,0,.12); border-radius: 99px; padding: 4px 11px; cursor: pointer; font-weight: 700; font-size: 13px; color: #1a1a1a; transition: transform .1s; }
.postit .vote.on { background: #1a1a1a; color: #fff; }
.postit .vote:active { transform: scale(.9); }
.postit select { background: rgba(0,0,0,.1); border: 0; border-radius: 8px; padding: 3px 6px; color: #1a1a1a; font-size: 12.5px; font-weight: 600; }
.postit .comments { font-size: 12.5px; margin-top: 8px; border-top: 1px dashed rgba(0,0,0,.2); padding-top: 8px; }
.postit .comments div { margin-bottom: 4px; }
.postit .avatar { border: 2px solid rgba(0,0,0,.15); }

/* gamification */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 12px; padding-top: 10px; }
.podium .p { text-align: center; flex: 1; max-width: 110px; }
.podium .p .avatar { margin: 0 auto 6px; width: 44px; height: 44px; }
.podium .p .block { border-radius: 12px 12px 4px 4px; display: grid; place-items: center; font-size: 22px; font-weight: 800; color: #111; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.badge-card { background: var(--card2); border: 1px solid var(--line); border-radius: 13px; padding: 12px; text-align: center; }
.badge-card .e { font-size: 30px; display: block; }
.badge-card.locked .e { filter: grayscale(1); opacity: .35; }
.badge-card b { display: block; font-size: 13px; margin-top: 4px; }
.badge-card small { color: var(--muted); font-size: 11.5px; }
.badge-card .track { height: 5px; margin-top: 6px; }
.feature { display: flex; gap: 14px; align-items: center; }
.feature .e { font-size: 38px; width: 64px; height: 64px; border-radius: 18px; background: var(--card2); display: grid; place-items: center; flex: none; }

/* modal & forms */
.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(3px); z-index: 50; display: none; align-items: flex-start; justify-content: center; padding: 6vh 16px; overflow-y: auto; }
.modal-back.open { display: flex; animation: fadeIn .2s; }
.modal { background: var(--card); border: 1px solid var(--line2); border-radius: 20px; width: 100%; max-width: 640px; box-shadow: var(--shadow); padding: 22px; }
.modal.wide { max-width: 860px; }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.modal-head h2 { font-size: 20px; }
.modal-head .x { margin-left: auto; }
.form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.fld { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 600; min-width: 0; }
.fld.full { grid-column: 1 / -1; }
.fld input, .fld select, .fld textarea { color: var(--text); font-weight: 400; font-size: 14.5px; width: 100%; }
.fld textarea { min-height: 80px; resize: vertical; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.range-row { display: flex; align-items: center; gap: 12px; }
.range-row input[type=range] { flex: 1; accent-color: var(--accent); }
.range-row input[type=number] { width: 110px; }

/* calculator */
.calc-total { font-size: 38px; font-weight: 800; letter-spacing: -.02em; }
.calc-line { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--line); font-size: 14px; }
.calc-line span:first-child { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.price-box { border-radius: 14px; padding: 14px; background: var(--card2); border: 1px solid var(--line2); }
.verdict { border-radius: 12px; padding: 10px 12px; font-weight: 600; font-size: 14px; margin-top: 12px; }

/* toasts, confetti */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 80; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--card2); border: 1px solid var(--line2); border-left: 4px solid var(--accent); border-radius: 12px; padding: 11px 14px; box-shadow: var(--shadow); max-width: 340px; font-size: 14px; animation: toastIn .3s cubic-bezier(.2,.9,.3,1.2); }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } }
.confetti { position: fixed; top: -12px; width: 9px; height: 14px; z-index: 90; pointer-events: none; animation: fall linear forwards; }
@keyframes fall { to { transform: translate3d(var(--dx), 110vh, 0) rotate(var(--rot)); } }
.empty { text-align: center; padding: 34px 10px; color: var(--muted); }
.empty .e { font-size: 40px; display: block; margin-bottom: 6px; }

#printArea { display: none; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow); }
  .sidebar.open { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 35; display: none; }
  .scrim.open { display: block; }
  .menu-btn { display: block; flex: none; }
  .topbar { padding: 10px 16px; gap: 8px; }
  .view { padding: 18px 16px 50px; }
  .g2, .g3 { grid-template-columns: minmax(0, 1fr); }
  .span2 { grid-column: auto; }
  .page-head h1 { font-size: 23px; }
  .page-head .actions { margin-left: 0; }
  .form { grid-template-columns: minmax(0, 1fr); }
  .kanban { grid-auto-columns: 82%; }
  .g-row { grid-template-columns: 130px 1fr; }
  .gantt-inner { min-width: 560px; }
}
@media (max-width: 560px) {
  .avatar#me { display: none; }
  .role-switch { flex: none; }
  .role-switch button { padding: 5px 7px; font-size: 12px; }
  .search > span { display: none; }
  .xl-btn { padding: 6px 9px; }
  .xl-btn span { display: none; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .kpi .val { font-size: 20px; }
  .kpi svg.spark { display: none; }
  .filters input[type=search] { min-width: 100%; }
  .filters select, .filters input[type=date] { flex: 1 1 45%; }
  .calc-total { font-size: 30px; }
}

/* ---------- metas del mes ---------- */
.goal-sum { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.goal-sum div { background: var(--card2); border-radius: 12px; padding: 9px 11px; }
.goal-sum small { display: block; color: var(--muted); font-size: 12px; }
.goal-sum b { font-size: 19px; }
.goals { display: flex; flex-direction: column; gap: 12px; }
.goal .row { font-size: 14px; margin-bottom: 5px; gap: 8px; }
.goal .gname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gbar { display: flex; height: 12px; background: var(--card2); border-radius: 99px; overflow: hidden; }
.gbar i { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.gbar i.pend { background: repeating-linear-gradient(45deg, rgba(255,122,26,.55) 0 6px, rgba(255,122,26,.2) 6px 12px); }
.goal.ok .gbar i:first-child { background: var(--good); }
.goal-tip { margin-top: 14px; font-size: 13.5px; background: var(--accent-soft); border-radius: 11px; padding: 9px 11px; }
.goal-tip.ok { background: rgba(52,211,153,.14); color: var(--good); font-weight: 600; }
.tv-goals h3 { font-size: 24px; }
.tv-goals .goal .row { font-size: 20px; }
.tv-goals .gbar { height: 20px; }
.tv-goals .goal-sum b { font-size: 30px; }
.tv-goals .goal-sum small, .tv-goals .goal-tip { font-size: 17px; }

/* ---------- agenda ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(130px, 1fr)); gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.day { background: var(--bg2); border: 1px solid var(--line); border-radius: 13px; padding: 8px; min-height: 140px; }
.day.today { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.day.past { opacity: .6; }
.day-head { display: flex; align-items: baseline; justify-content: space-between; padding: 2px 4px 8px; color: var(--muted); font-size: 12.5px; text-transform: capitalize; }
.day-head b { font-size: 20px; color: var(--text); }
.day.today .day-head b { color: var(--accent2); }
.day-empty { text-align: center; padding: 18px 0; opacity: .5; }
.dchip { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; padding: 8px 9px; margin-bottom: 7px; cursor: pointer; font-size: 13px; transition: transform .15s; }
.dchip:hover { transform: translateY(-2px); }
.dchip .dtitle { font-weight: 600; margin: 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dchip.big { font-size: 16px; padding: 12px 14px; }

/* ---------- pantalla de acceso ---------- */
#gate { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px; background: radial-gradient(circle at 30% 20%, rgba(255,122,26,.18), transparent 50%), var(--bg); }
.gate-card { width: 100%; max-width: 380px; background: var(--card); border: 1px solid var(--line2); border-radius: 22px; padding: 28px 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 12px; text-align: center; animation: fadeIn .3s; }
.gate-card svg { margin: 0 auto; }
.gate-card h1 { font-size: 34px; }
.gate-card h1 small { font-size: 13px; color: var(--muted); letter-spacing: .1em; }
.gate-card p { margin: 0; color: var(--muted); font-size: 14px; }
.gate-card .fld { text-align: left; }
.gate-card .btn { justify-content: center; padding: 11px; font-size: 15px; }
.gate-msg { color: var(--bad); font-size: 13.5px; min-height: 18px; }

/* ---------- modo TV ---------- */
body.tv-mode .sidebar, body.tv-mode .topbar, body.tv-mode .scrim { display: none !important; }
body.tv-mode .view { max-width: none; padding: 22px 30px; min-height: 100vh; }
.tv { display: flex; flex-direction: column; min-height: calc(100vh - 44px); }
.tv-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.tv-brand { font-size: 34px; margin-left: 6px; }
.tv-title { font-size: 26px; font-weight: 700; color: var(--accent2); margin-left: 18px; }
.tv-clock { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; margin: 0 6px; }
.tv-dots { display: flex; gap: 8px; }
.tv-dots button { width: 12px; height: 12px; border-radius: 50%; border: 0; background: var(--line2); cursor: pointer; padding: 0; }
.tv-dots button.on { background: var(--accent); width: 34px; border-radius: 99px; }
.tv-ctl { opacity: .35; transition: opacity .2s; }
.tv-top:hover .tv-ctl { opacity: 1; }
.tv-body { flex: 1; animation: fadeIn .5s; }
.tv-progress { height: 4px; background: var(--card2); border-radius: 99px; overflow: hidden; margin-top: 18px; }
.tv-progress i { display: block; height: 100%; background: var(--accent); width: 0; animation: tvbar linear forwards; }
@keyframes tvbar { to { width: 100%; } }
.tv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 20px; }
.tv-card { background: var(--card); border: 2px solid var(--line); border-radius: 22px; padding: 26px; }
.tv-name { font-size: 26px; font-weight: 800; }
.tv-status { font-size: 20px; font-weight: 700; }
.tv-job { font-size: 22px; margin: 22px 0 12px; font-weight: 600; }
.tv-prog { height: 22px; }
.tv-eta { font-size: 18px; color: var(--muted); margin-top: 10px; }
.tv-next { font-size: 17px; color: var(--muted); margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.tv-cols { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.tv-col { background: var(--bg2); border: 1px solid var(--line); border-radius: 20px; padding: 16px; }
.tv-col-h { font-size: 22px; font-weight: 800; margin-bottom: 14px; display: flex; justify-content: space-between; }
.tv-col-h span { background: var(--card2); color: var(--text); border-radius: 99px; padding: 0 12px; font-size: 18px; }
.tv-empty { text-align: center; font-size: 28px; color: var(--faint); padding: 30px 0; }
.tv-loads { display: flex; flex-direction: column; gap: 18px; }
.tv-load { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 24px 26px; }
.tv-big { font-size: 34px; font-weight: 800; }
.tv-big small { font-size: 16px; color: var(--muted); font-weight: 500; }
.tv-track { height: 18px; margin: 14px 0 10px; }
.tv-sub { font-size: 18px; color: var(--muted); }
.tv-jobs { margin-top: 14px; display: flex; gap: 8px; flex-wrap: wrap; }
.tv-jobs .chip { font-size: 15px; padding: 4px 12px; }
.tv-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.tv-kpi { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 22px; display: flex; flex-direction: column; gap: 4px; }
.tv-kpi span { font-size: 30px; }
.tv-kpi b { font-size: 52px; line-height: 1.1; }
.tv-kpi small { font-size: 18px; color: var(--muted); }
.tv-team { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.tv-panel { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 22px; }
.tv-panel .podium .p { max-width: 160px; }
.tv-panel .podium .p .avatar { width: 60px; height: 60px; font-size: 18px; }
.tv-panel .podium .block { font-size: 32px; }
.tv-idea { display: flex; gap: 20px; align-items: center; font-size: 18px; }
.tv-idea > span { font-size: 70px; }
.tv-idea small { display: block; color: var(--muted); font-size: 16px; }
.tv-idea b { display: block; font-size: 28px; margin: 4px 0 6px; }
@media (max-width: 900px) {
  .tv-cols, .tv-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tv-team { grid-template-columns: minmax(0, 1fr); }
  .tv-grid { grid-template-columns: minmax(0, 1fr); }
  .tv-title { margin-left: 8px; font-size: 20px; }
  body.tv-mode .view { padding: 16px; }
}

/* ---------- impresión (cotización PDF) ---------- */
@media print {
  body { background: #fff; color: #111; }
  .app, .modal-back, .toasts, .tip { display: none !important; }
  #printArea { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #printArea { display: block; padding: 10mm; font: 12pt/1.5 "Segoe UI", Arial, sans-serif; }
  #printArea table { font-size: 11pt; }
  #printArea th { color: #555; border-bottom: 2px solid #111; }
  #printArea td { border-bottom: 1px solid #ddd; }
  .q-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 4px solid #ff7a1a; padding-bottom: 12px; margin-bottom: 18px; }
  .q-tot { margin-left: auto; width: 280px; margin-top: 14px; }
  .q-tot div { display: flex; justify-content: space-between; padding: 4px 0; }
  .q-tot .g { font-size: 15pt; font-weight: 800; border-top: 2px solid #111; padding-top: 8px; }
}
