/* ============================================================
   SUPER CESTA WEB — shell + componentes
   ============================================================ */
html, body { height: 100%; }
body { background: var(--bg); color: var(--text); overflow: hidden; }

.app {
  display: grid;
  grid-template-columns: 268px minmax(0, 1fr);
  height: 100vh;
}

/* ---------------- SIDEBAR ---------------- */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  min-height: 0;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  padding: 20px 20px 16px;
}
.brand .logo {
  width: 40px; height: 40px; border-radius: 13px; flex: none;
  background: #FFFFFF url('/web/assets/super-cesta-app-icon.png') center/100% 100% no-repeat;
  color: #2DB672;
  border: 1px solid var(--line);
  display: grid; place-items: center;
  box-shadow: 0 8px 18px -8px rgba(17, 17, 17, .28);
}
.brand .logo > svg { display: none; }
.brand .bn { font-size: 18px; font-weight: 800; letter-spacing: 0; line-height: 1; }
.brand .bs { font-size: 11.5px; font-weight: 700; color: var(--text3); margin-top: 3px; }

.profile {
  margin: 0 14px 12px; padding: 11px 12px; border-radius: 14px;
  background: var(--surface2); border: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
}
.profile .pn { font-size: 13px; font-weight: 800; }
.profile .pe { font-size: 11px; font-weight: 600; color: var(--text3); }

.nav { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 14px 14px; }
.nav::-webkit-scrollbar { width: 7px; }
.nav::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 99px; }
.nav-group { margin-top: 14px; }
.nav-label {
  font-size: 10.5px; font-weight: 800; color: var(--text3);
  text-transform: uppercase; letter-spacing: .6px;
  padding: 0 10px 7px;
}
.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  border: 0; background: transparent; cursor: pointer;
  padding: 10px 11px; border-radius: 12px; margin-bottom: 2px;
  font-family: var(--font); font-size: 13.5px; font-weight: 700;
  color: var(--text2); text-align: left;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.nav-item:hover { background: var(--surface2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary); }
.nav-item .ni-ic { width: 19px; height: 19px; flex: none; }
.nav-item .ni-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 99px; background: var(--tang); color: #fff;
  font-size: 11px; font-weight: 800; display: grid; place-items: center;
}

.sidebar-foot { padding: 12px 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.status-line { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--text2); padding: 2px 4px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.status-dot.off { background: var(--text3); box-shadow: none; }
.theme-switch {
  display: flex; gap: 4px; padding: 4px; border-radius: 12px;
  background: var(--surface2); border: 1px solid var(--line);
}
.theme-switch button {
  flex: 1; border: 0; background: transparent; cursor: pointer;
  height: 32px; border-radius: 9px; font-family: var(--font);
  font-size: 12px; font-weight: 800; color: var(--text2);
}
.theme-switch button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
[data-theme="dark"] .theme-switch button.on { background: var(--surface3); }
.ghost-btn {
  display: flex; align-items: center; gap: 9px; width: 100%;
  border: 1px solid var(--line); background: transparent; cursor: pointer;
  padding: 9px 11px; border-radius: 11px; color: var(--text2);
  font-family: var(--font); font-size: 12.5px; font-weight: 700;
}
.ghost-btn:hover { border-color: var(--line2); color: var(--text); }

/* ---------------- MAIN ---------------- */
.main { min-width: 0; overflow-y: auto; min-height: 0; }
.main::-webkit-scrollbar { width: 10px; }
.main::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 99px; }

.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 18px;
  padding: 18px 30px;
  background: color-mix(in oklab, var(--bg) 82%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .pt { font-size: 22px; font-weight: 800; letter-spacing: -.5px; }
.topbar .ps { font-size: 12.5px; font-weight: 700; color: var(--text2); margin-top: 2px; }
.searchbar {
  margin-left: auto; display: flex; align-items: center; gap: 9px;
  height: 42px; width: 300px; max-width: 34vw; padding: 0 14px;
  border-radius: 12px; background: var(--surface2); border: 1px solid var(--line);
  color: var(--text3);
}
.searchbar input { border: 0; background: transparent; outline: none; flex: 1; font-family: var(--font); font-size: 13.5px; font-weight: 600; color: var(--text); }
.content { padding: 24px 30px 60px; }

/* ---------------- BUTTONS ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: 12px; cursor: pointer;
  font-family: var(--font); font-size: 13px; font-weight: 800;
  border: 1px solid var(--line2); background: var(--surface); color: var(--text);
  transition: all .15s var(--ease); white-space: nowrap;
}
.btn:hover { border-color: var(--text3); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.tang { background: var(--tang); border-color: var(--tang); color: #fff; }
.btn.danger { color: var(--rose); border-color: color-mix(in oklab, var(--rose) 45%, transparent); background: transparent; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 12px; border-radius: 10px; }
.btn.ghost { background: transparent; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  border: 1px solid var(--line2); background: var(--surface); color: var(--text2); cursor: pointer;
}
.icon-btn:hover { color: var(--text); border-color: var(--text3); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 9px; }

/* ---------------- CARDS / PANELS ---------------- */
.card2 { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-sm); }
.panel2 { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: var(--shadow-sm); }
.panel2-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel2-head h2 { margin: 0; font-size: 15px; font-weight: 800; white-space: nowrap; flex: none; }
.panel2-head h3 { margin: 0; font-size: 13.5px; font-weight: 800; white-space: nowrap; flex: none; }
.panel2-body { padding: 18px; }

.grid { display: grid; gap: 16px; }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; }
.kpi2 { position: relative; padding: 18px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-sm); overflow: hidden; }
.kpi2 .k { font-size: 11.5px; font-weight: 800; color: var(--text3); text-transform: uppercase; letter-spacing: .4px; }
.kpi2 .v { font-size: 30px; font-weight: 800; letter-spacing: -1px; margin-top: 10px; }
.kpi2 .c { font-size: 12px; font-weight: 700; color: var(--text2); margin-top: 6px; display: flex; align-items: center; gap: 6px; }
.kpi2 .corner { position: absolute; top: 16px; right: 16px; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; }
.delta2 { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-size: 12px; padding: 2px 8px; border-radius: 99px; }
.delta2.up { color: var(--tang); background: var(--tang-soft); }
.delta2.down { color: var(--primary); background: var(--primary-soft); }

/* ---------------- TABLE ---------------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 11px; font-weight: 800; color: var(--text3); text-transform: uppercase; letter-spacing: .4px; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 13px 14px; border-bottom: 1px solid var(--line); font-size: 13px; font-weight: 600; vertical-align: middle; }
.tbl tbody tr { transition: background .12s var(--ease); }
.tbl tbody tr:hover { background: var(--surface2); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl td .sub { font-size: 11.5px; font-weight: 600; color: var(--text3); margin-top: 2px; }
.tbl td strong { font-weight: 800; white-space: nowrap; }

/* rows / list selectors */
.rowsel {
  display: block;
  width: 100%; text-align: left; border: 1px solid var(--line); background: var(--surface);
  border-radius: 14px; padding: 13px 14px; cursor: pointer; margin-bottom: 9px;
  transition: all .14s var(--ease);
}
.rowsel:hover { border-color: var(--line2); }
.rowsel.active { border-color: var(--primary); background: var(--primary-soft); }

/* chips / filters */
.chip2 { height: 36px; padding: 0 15px; border-radius: 11px; display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 700; background: var(--surface); color: var(--text2); border: 1px solid var(--line); cursor: pointer; white-space: nowrap; }
.chip2.on { background: var(--text); color: var(--bg); border-color: var(--text); }

/* misc */
.split2 { display: grid; grid-template-columns: minmax(300px, 360px) minmax(0,1fr); gap: 18px; align-items: start; }
.legend-dot { width: 11px; height: 11px; border-radius: 4px; flex: none; }
.mini-track { height: 7px; border-radius: 99px; background: var(--surface3); overflow: hidden; }
.mini-fill { height: 100%; border-radius: 99px; background: var(--primary); }
.barrow2 { display: flex; flex-direction: column; gap: 7px; }
.bartrack2 { height: 10px; border-radius: 99px; background: var(--surface3); overflow: hidden; }
.barfill2 { height: 100%; border-radius: 99px; }
.avatar2 { display: grid; place-items: center; flex: none; border-radius: 50%; color: #fff; font-weight: 800; }
.field { display: grid; gap: 6px; }
.field label { font-size: 11.5px; font-weight: 800; color: var(--text2); }
.field input, .field select, .field textarea {
  border: 1px solid var(--line2); background: var(--surface2); color: var(--text);
  border-radius: 11px; padding: 10px 12px; font-family: var(--font); font-size: 13px; font-weight: 600; outline: none;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); }
.empty2 { padding: 30px; text-align: center; color: var(--text3); font-weight: 700; font-size: 13px; border: 1px dashed var(--line2); border-radius: 16px; }
.checkbox { width: 24px; height: 24px; border-radius: 8px; border: 2px solid var(--line2); background: var(--surface2); display: grid; place-items: center; cursor: pointer; color: var(--on-accent); padding: 0; }
.checkbox.on { background: var(--primary); border-color: var(--primary); }

/* ---------------- MODAL ---------------- */
.modal-root { position: fixed; inset: 0; z-index: 200; display: none; }
.modal-root.open { display: grid; place-items: center; padding: 24px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); animation: mfade .18s ease; }
@keyframes mfade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  position: relative; width: min(460px, 94vw); max-height: 88vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow); padding: 24px;
  transform: translateY(10px) scale(.98); opacity: 0; transition: all .2s var(--ease);
}
.modal.up { transform: none; opacity: 1; }
.modal-title { font-size: 19px; font-weight: 800; letter-spacing: -.3px; margin-bottom: 18px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }
.web-toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 14px);
  z-index: 300; background: var(--text); color: var(--bg);
  border-radius: 13px; padding: 13px 20px; font-weight: 800; font-size: 13.5px;
  box-shadow: var(--shadow); opacity: 0; transition: all .25s var(--ease); white-space: nowrap;
}
.web-toast.show { opacity: 1; transform: translate(-50%, 0); }

.cols-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cols-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 12px; }
.cols-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }

@media (max-width: 1180px) {
  .kpis { grid-template-columns: repeat(2,1fr); }
  .split2 { grid-template-columns: 1fr; }
}
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
}
