:root {
  --ink: #1a1446;
  --ink-2: #3b3770;
  --muted: #6b6a92;
  --violet: #6d3df5;
  --violet-2: #8b5cf6;
  --violet-soft: #ede8ff;
  --blue: #2563eb;
  --blue-soft: #e5edff;
  --teal: #0fb5a3;
  --teal-soft: #dcf7f2;
  --red: #e5484d;
  --red-soft: #ffe6e7;
  --green-soft: #dcf8ea;
  --green: #12935c;
  --glass: rgba(255, 255, 255, .72);
  --glass-line: rgba(255, 255, 255, .9);
  --shadow: 0 10px 30px rgba(76, 56, 170, .10);
  --radius: 20px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Plus Jakarta Sans", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, #e9e4ff 0%, #dfe9ff 45%, #f1e6ff 100%);
  min-height: 100vh;
}
a { color: var(--violet); text-decoration: none; }
h1 { font-size: 2.4rem; font-weight: 800; margin: 0; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; margin: 0 0 1rem; display: flex; align-items: center; gap: .5rem; }
.muted { color: var(--muted); }

/* fondo con esferas */
.bg-orbs { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.bg-orbs span { position: absolute; border-radius: 50%; filter: blur(2px); opacity: .55;
  background: radial-gradient(circle at 30% 30%, #fff, #c7b8ff 60%, transparent 70%); }
.bg-orbs span:nth-child(1) { width: 340px; height: 340px; top: -120px; left: -80px; }
.bg-orbs span:nth-child(2) { width: 260px; height: 260px; bottom: -90px; right: 8%; background: radial-gradient(circle at 30% 30%, #fff, #b9d3ff 60%, transparent 70%); }
.bg-orbs span:nth-child(3) { width: 180px; height: 180px; top: 40%; left: 14%; }

.glass { background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px); box-shadow: var(--shadow); }

/* layout */
.shell { position: relative; z-index: 1; display: grid; grid-template-columns: 280px 1fr; gap: 28px;
  max-width: 1440px; margin: 0 auto; padding: 28px; min-height: 100vh; }
.sidebar { border-radius: 26px; padding: 26px 18px; display: flex; flex-direction: column; position: sticky; top: 28px;
  height: calc(100vh - 56px); }
.brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 1.55rem; color: var(--violet); padding: 0 10px 26px; }
.sidebar nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: 16px; padding: 15px 18px; border-radius: 16px; color: var(--ink-2);
  font-weight: 600; font-size: 1.05rem; transition: background .15s; }
.sidebar nav a svg { color: #7b6fc4; }
.sidebar nav a:hover { background: rgba(109, 61, 245, .08); }
.sidebar nav a.active { background: linear-gradient(135deg, var(--violet-2), var(--violet)); color: #fff;
  box-shadow: 0 8px 20px rgba(109, 61, 245, .35); }
.sidebar nav a.active svg { color: #fff; }
.profile { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 18px; background: rgba(255,255,255,.6); }
.profile .who { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.profile small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  color: #fff; background: linear-gradient(135deg, #4f46e5, #3730a3); flex: none; }
.avatar.sm { width: 40px; height: 40px; font-size: .9rem; }

.main { min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.topbar { display: flex; align-items: center; gap: 18px; }
.search { display: flex; align-items: center; gap: 12px; padding: 0 18px; height: 54px; border-radius: 16px; color: var(--muted); flex: 1; max-width: 640px; }
.search input { border: 0; background: none; outline: none; font: inherit; font-size: 1rem; flex: 1; color: var(--ink); }
.user-chip { margin-left: auto; display: flex; align-items: center; gap: 12px; padding: 6px 18px 6px 6px; border-radius: 30px; font-weight: 700; }
.icon-btn { border: 0; background: none; color: var(--ink-2); cursor: pointer; display: grid; place-items: center; padding: 6px; border-radius: 10px; }
.icon-btn:hover { background: rgba(109, 61, 245, .1); }
.menu-btn { display: none; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.page-head p { margin: .35rem 0 0; font-size: 1.15rem; }

/* botones */
.btn { display: inline-flex; align-items: center; gap: 10px; border: 0; cursor: pointer; font: inherit; font-weight: 700;
  font-size: 1.05rem; padding: 14px 26px; border-radius: 16px; transition: transform .1s, box-shadow .15s; }
.btn:active { transform: translateY(1px); }
.btn.primary { color: #fff; background: linear-gradient(135deg, var(--violet-2), var(--violet)); box-shadow: 0 10px 24px rgba(109, 61, 245, .35); }
.btn.primary:hover { box-shadow: 0 12px 28px rgba(109, 61, 245, .45); }
.btn.ghost { background: rgba(255,255,255,.8); color: var(--ink-2); border: 1px solid #e3defa; }
.btn.danger { background: var(--red-soft); color: var(--red); }
.btn.block { width: 100%; justify-content: center; }

/* tarjetas de estadística */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.stat { border-radius: var(--radius); padding: 24px; display: flex; gap: 20px; align-items: center; }
.stat span { color: var(--ink-2); font-weight: 500; }
.stat strong { display: block; font-size: 2.3rem; font-weight: 800; margin: 4px 0; letter-spacing: -.02em; }
.stat small { color: var(--muted); }
.stat-ic { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; flex: none; }
.stat-ic.blue { background: var(--blue-soft); color: var(--blue); }
.stat-ic.teal { background: var(--teal-soft); color: var(--teal); }
.stat-ic.violet { background: var(--violet-soft); color: var(--violet); }

/* toolbar */
.toolbar { display: flex; gap: 16px; }
.toolbar .search { max-width: none; }
.grow { flex: 1; }
.select { display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 54px; border-radius: 16px; color: var(--ink-2); min-width: 220px; }
.select select { border: 0; background: none; font: inherit; font-weight: 600; font-size: 1rem; color: var(--ink); flex: 1; outline: none; cursor: pointer; }

/* tarjetas y tablas */
.card { border-radius: var(--radius); padding: 24px; }
.card.flush { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-weight: 700; padding: 18px 24px; background: rgba(240, 236, 255, .6); color: var(--ink); white-space: nowrap; }
.table td { padding: 14px 24px; border-top: 1px solid rgba(220, 214, 250, .7); vertical-align: middle; }
.card:not(.flush) .table th, .card:not(.flush) .table td { padding: 12px 10px; }
.table .num { text-align: right; }
.table .center { text-align: center; }
.table .empty { text-align: center; color: var(--muted); padding: 40px; }
.products td { font-size: 1.05rem; }
.prod { display: flex; align-items: center; gap: 22px; font-weight: 600; }
.prod img, .ph { width: 92px; height: 66px; border-radius: 12px; object-fit: cover; background: #fff; flex: none; }
.ph { display: grid; place-items: center; color: #b4aedb; background: rgba(255,255,255,.8); border: 1px dashed #d8d1f7; }
.ph.big { width: 120px; height: 120px; }
.ph.huge { width: 100%; height: 320px; }
.pill { display: inline-block; min-width: 76px; text-align: center; padding: 8px 14px; border-radius: 12px; font-weight: 700;
  background: var(--green-soft); color: var(--green); }
.pill.low { background: var(--red-soft); color: var(--red); }
.pill.tiny { min-width: 0; padding: 2px 8px; font-size: .75rem; background: var(--violet-soft); color: var(--violet); }
.inline-form { display: flex; gap: 8px; align-items: center; margin: 0; }
.inline-form input { font: inherit; padding: 10px 12px; border: 1px solid #ddd6fb; border-radius: 12px; min-width: 0; width: 150px; }
.actions { display: inline-flex; gap: 12px; align-items: center; }
.actions form { margin: 0; }
.act { width: 58px; height: 52px; border-radius: 14px; border: 0; cursor: pointer; display: grid; place-items: center; transition: filter .15s; }
.act:hover { filter: brightness(.95); }
.act.view { background: var(--blue-soft); color: var(--blue); }
.act.edit { background: #ecebff; color: #3b44d9; }
.act.del { background: var(--red-soft); color: var(--red); }

/* paginación */
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.pages { display: flex; gap: 10px; }
.pg { min-width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; background: rgba(255,255,255,.8);
  border: 1px solid #e3defa; color: var(--ink-2); font-weight: 700; }
.pg.on { background: var(--violet); color: #fff; border-color: var(--violet); }
.pg.disabled { opacity: .4; pointer-events: none; }

/* formularios */
.form label { display: flex; flex-direction: column; gap: 8px; font-weight: 600; color: var(--ink-2); margin-bottom: 14px; }
.form input:not([type=checkbox]):not([type=file]), .form select, .form textarea, .login-card input {
  font: inherit; padding: 13px 15px; border: 1px solid #ddd6fb; border-radius: 12px; background: #fff; color: var(--ink); outline: none; }
.form input:focus, .form select:focus, .form textarea:focus, .login-card input:focus { border-color: var(--violet-2); box-shadow: 0 0 0 4px rgba(139, 92, 246, .15); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.span2 { grid-column: span 2; }
.img-field { display: flex; gap: 20px; align-items: center; margin-bottom: 14px; }
.img-field img { width: 120px; height: 120px; object-fit: cover; border-radius: 14px; }
.form label.check { flex-direction: row; align-items: center; font-weight: 500; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 6px; }
.form-actions.left { justify-content: flex-start; }
.form-actions form { margin: 0; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.grid-side { display: grid; grid-template-columns: 320px 1fr; gap: 22px; align-items: start; }
.grid-side > div { display: flex; flex-direction: column; gap: 16px; }

.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; }
.list li { display: flex; justify-content: space-between; align-items: center; }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 22px; }
.mini-stats div { background: rgba(240, 236, 255, .7); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; }
.mini-stats strong { font-size: 1.8rem; }

.detail { display: grid; grid-template-columns: 1fr 1.2fr; gap: 32px; align-items: start; }
.detail img { width: 100%; max-height: 380px; object-fit: contain; border-radius: 16px; background: #fff; }
.detail dl, .info { display: grid; grid-template-columns: max-content 1fr; gap: 12px 24px; margin: 0 0 24px; }
.detail dt, .info dt { color: var(--muted); font-weight: 600; }
.detail dd, .info dd { margin: 0; font-weight: 600; word-break: break-word; }
.arch { background: #1a1446; color: #e5e0ff; padding: 20px; border-radius: 14px; overflow-x: auto; font-size: .9rem; line-height: 1.5; margin: 0; }

.bar-row { margin-bottom: 18px; }
.bar-label { display: flex; justify-content: space-between; margin-bottom: 6px; }
.bar { height: 12px; background: #ece8ff; border-radius: 8px; overflow: hidden; margin-bottom: 4px; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--violet-2), var(--violet)); border-radius: 8px; }

.flash { padding: 14px 18px; border-radius: 14px; font-weight: 600; }
.flash.ok { background: var(--green-soft); color: var(--green); }
.flash.error { background: var(--red-soft); color: var(--red); }

.center-box { text-align: center; padding: 60px; }
.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 10px 0 0; }

/* login */
.login-body { display: grid; place-items: center; padding: 20px; }
.login-card { position: relative; z-index: 1; width: 100%; max-width: 420px; border-radius: 26px; padding: 40px 34px;
  display: flex; flex-direction: column; gap: 14px; text-align: center; align-items: center; }
.login-card h1 { color: var(--violet); font-size: 2rem; }
.login-card p { margin: -6px 0 6px; }
.login-card label { width: 100%; display: flex; flex-direction: column; gap: 6px; text-align: left; font-weight: 600; color: var(--ink-2); }
.login-card .flash { width: 100%; }

/* responsive */
@media (max-width: 1100px) {
  .stats { grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
  .stat { flex-direction: column; align-items: flex-start; gap: 12px; padding: 18px; }
  .stat-ic { width: 56px; height: 56px; }
  .stat strong { font-size: 1.7rem; }
  .grid-2, .grid-side, .detail { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
  .sidebar { position: fixed; left: 16px; top: 16px; bottom: 16px; height: auto; width: 270px; z-index: 50;
    transform: translateX(-120%); transition: transform .2s; }
  .sidebar.open { transform: none; }
  .menu-btn { display: grid; }
  .user-chip span { display: none; }
  .user-chip { padding: 4px; }
  h1 { font-size: 1.8rem; }
  .stats { grid-template-columns: 1fr; }
  .stat { flex-direction: row; align-items: center; }
  .toolbar { flex-direction: column; }
  .toolbar .search, .toolbar .select { flex: none; }
  .prod { gap: 12px; }
  .prod img, .ph { width: 60px; height: 46px; }
  .act { width: 42px; height: 40px; }
  .table th, .table td { padding: 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
}
.nowrap { white-space: nowrap; }
