/* =========================================================
   TECSUMOF — Panel de administración
   ========================================================= */
:root {
    --navy: #0b1530;
    --navy-2: #111f44;
    --cyan: #1fb6ff;
    --blue: #2a7dff;
    --bg: #f3f6fb;
    --card: #ffffff;
    --line: #e3e9f3;
    --text: #1a2540;
    --muted: #6b7a99;
    --ok: #13a765;
    --danger: #e5484d;
    --warn: #f5a524;
    --wa: #25d366;
    --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.55 'Inter', system-ui, sans-serif; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--blue); text-decoration: none; }
h1, h2 { font-family: 'Sora', sans-serif; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.d-block { display: block; }
hr { border: 0; border-top: 1px solid var(--line); margin: .4rem 0; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45em; padding: .62em 1.1em; border-radius: 10px; border: 1px solid transparent;
    font: 600 .9rem 'Inter', sans-serif; cursor: pointer; transition: .15s; white-space: nowrap; }
.btn-primary { background: linear-gradient(135deg, var(--cyan), var(--blue)); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); color: #fff; }
.btn-light { background: #fff; border-color: var(--line); color: var(--text); }
.btn-light:hover { border-color: var(--cyan); }
.btn-danger { background: #fff; border-color: #f5c2c4; color: var(--danger); }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-wa { background: var(--wa); color: #fff; }
.btn-sm { padding: .45em .8em; font-size: .82rem; }
.btn-block { width: 100%; margin-top: .6rem; }
.btn-icon { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 9px; border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; }
.btn-icon:hover { color: var(--blue); border-color: var(--cyan); }
.btn-icon.danger:hover { color: #fff; background: var(--danger); border-color: var(--danger); }

/* Layout */
.side { position: fixed; inset: 0 auto 0 0; width: 250px; background: var(--navy); color: #c7d3ee; display: flex; flex-direction: column; z-index: 40; transition: transform .25s; }
.side-brand { display: flex; align-items: center; gap: .7rem; padding: 1.2rem 1.1rem; color: #fff; border-bottom: 1px solid rgba(255,255,255,.07); }
.side-brand img { width: 42px; height: 42px; border-radius: 10px; object-fit: cover; }
.side-brand span { font: 700 1rem 'Sora', sans-serif; letter-spacing: .05em; display: flex; flex-direction: column; }
.side-brand small { font: 500 .7rem 'Inter', sans-serif; color: #8fa0c6; letter-spacing: 0; }
.side nav { padding: 1rem .7rem; display: grid; gap: .2rem; flex: 1; align-content: start; overflow-y: auto; }
.side nav a, .side-foot a { display: flex; align-items: center; gap: .7rem; padding: .62rem .8rem; border-radius: 10px; color: #c7d3ee; font-weight: 500; font-size: .92rem; }
.side nav a:hover, .side-foot a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side nav a.active { background: linear-gradient(90deg, rgba(31,182,255,.22), rgba(31,182,255,.05)); color: #fff; box-shadow: inset 3px 0 0 var(--cyan); }
.side nav a i { font-size: 1.05rem; color: var(--cyan); }
.pill { margin-left: auto; background: var(--cyan); color: var(--navy); font-size: .72rem; font-weight: 700; padding: .05em .55em; border-radius: 999px; }
.side-foot { padding: .7rem; border-top: 1px solid rgba(255,255,255,.07); display: grid; gap: .1rem; }
.main { margin-left: 250px; min-height: 100vh; }
.topnav { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 1rem; padding: 0 1.6rem; height: 64px; background: rgba(255,255,255,.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topnav h1 { font-size: 1.15rem; }
.who { margin-left: auto; color: var(--muted); font-size: .9rem; display: flex; gap: .4rem; align-items: center; }
.burger { display: none; border: 0; background: none; font-size: 1.6rem; cursor: pointer; color: var(--text); padding: 0; }
.content { padding: 1.6rem; max-width: 1280px; }
.side-backdrop { display: none; }
@media (max-width: 960px) {
    .side { transform: translateX(-100%); }
    .side.open { transform: none; box-shadow: 20px 0 40px rgba(0,0,0,.3); }
    .side-backdrop.open { display: block; position: fixed; inset: 0; background: rgba(10,20,40,.45); z-index: 35; }
    .main { margin-left: 0; }
    .burger { display: block; }
    .topnav { padding: 0 16px; }
    .content { padding: 1rem 16px; }
    .who { display: none; }
}

/* Alertas */
.alert { display: flex; gap: .6rem; align-items: flex-start; padding: .85rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: .92rem; }
.alert ul { margin: 0; padding-left: 1.1rem; }
.alert-success { background: #e8f8f0; color: #0b6b41; border: 1px solid #b5e8cf; }
.alert-error { background: #fdecec; color: #9b1c21; border: 1px solid #f5c2c4; }
.alert-warn { background: #fff6e5; color: #8a5300; border: 1px solid #fbd9a0; }

/* Tarjetas */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; margin-bottom: 1.2rem; box-shadow: 0 1px 2px rgba(20,40,80,.04); }
.card-flush { padding: 0; overflow: hidden; }
.card-title { font-size: 1rem; margin-bottom: 1rem; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .8rem; }
.card-head h2 { font-size: 1rem; }
.card-head a { font-size: .85rem; font-weight: 600; }
.narrow { max-width: 520px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1.2rem; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1.2rem; color: var(--text); display: grid; grid-template-columns: auto 1fr; column-gap: 1rem; align-items: center; transition: .15s; }
.kpi:hover { border-color: var(--cyan); transform: translateY(-2px); }
.kpi i { grid-row: span 2; width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; color: var(--blue); background: #e8f4ff; }
.kpi strong { font: 700 1.6rem/1.1 'Sora', sans-serif; }
.kpi span { color: var(--muted); font-size: .85rem; }
.quick { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
@media (max-width: 960px) { .grid-2 { grid-template-columns: 1fr; } }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: .8rem; padding: .7rem 0; border-top: 1px solid var(--line); }
.list li:first-child { border-top: 0; }
.list li a { color: var(--text); min-width: 0; display: flex; flex-direction: column; }
.list li a span { color: var(--muted); font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li.unread strong::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); margin-right: .45rem; vertical-align: middle; }
.list time { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.list-prod { flex-direction: row !important; align-items: center; gap: .7rem; }
.list-prod img, .thumb-ph { width: 40px; height: 40px; border-radius: 8px; object-fit: contain; background: #f4f7fb; border: 1px solid var(--line); flex: none; }
.thumb-ph { display: grid; place-items: center; color: #a8b5cf; }

.tag { display: inline-block; font-size: .72rem; font-weight: 600; padding: .2em .6em; border-radius: 6px; background: #eef2f8; color: var(--muted); }
.tag-ok { background: #e3f6ff; color: #0874b5; }

/* Toolbar / filtros */
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: .8rem; flex-wrap: wrap; margin-bottom: 1rem; }
.filters { display: flex; gap: .6rem; flex-wrap: wrap; flex: 1; }
.input-icon { position: relative; flex: 1; min-width: 200px; max-width: 380px; }
.input-icon i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.input-icon input { padding-left: 2.2rem !important; }
.tabs { display: flex; gap: .3rem; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: .25rem; }
.tabs a { padding: .45em .9em; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: .88rem; }
.tabs a.active { background: var(--navy); color: #fff; }

/* Inputs */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=url], select, textarea {
    width: 100%; font: inherit; font-weight: 400; font-size: .93rem; color: var(--text); background: #fff; border: 1px solid #d6deec; border-radius: 10px; padding: .6em .8em;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(31,182,255,.18); }
textarea { resize: vertical; }
select { width: auto; min-width: 200px; }
.fields select { width: 100%; }
input[type=file] { font-size: .85rem; margin: .6rem 0 .3rem; width: 100%; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.fields-1 { grid-template-columns: 1fr; }
.fields label { display: flex; flex-direction: column; gap: .35rem; font-size: .85rem; font-weight: 600; }
.fields label small { font-weight: 400; color: var(--muted); }
.span-2 { grid-column: span 2; }
.check { display: flex !important; flex-direction: row !important; align-items: center; gap: .5rem; font-weight: 500 !important; font-size: .9rem; margin: .5rem 0; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--blue); }
@media (max-width: 640px) { .fields { grid-template-columns: 1fr; } .span-2 { grid-column: auto; } }

/* Tablas */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .74rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: .8rem 1rem; background: #f8fafd; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: .75rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr:hover td { background: #fafcff; }
.table .c { text-align: center; }
.table .r { text-align: right; }
.row-off td { opacity: .55; }
.row-sel td { background: #eef8ff !important; }
.td-thumb { width: 64px; }
.td-thumb img, .td-thumb .thumb-ph { width: 48px; height: 48px; border-radius: 8px; object-fit: contain; background: #f4f7fb; border: 1px solid var(--line); }
.actions { white-space: nowrap; }
.actions form { display: inline; }
.table form { margin: 0; }
.ico { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: #e8f4ff; color: var(--blue); margin-right: .4rem; vertical-align: middle; }
.star { border: 0; background: none; font-size: 1.15rem; color: #c3cde0; cursor: pointer; }
.star.on { color: var(--warn); }
.switch { width: 42px; height: 24px; border-radius: 999px; border: 0; background: #d6deec; position: relative; cursor: pointer; transition: .2s; }
.switch span { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch.on { background: var(--ok); }
.switch.on span { left: 21px; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty > i { font-size: 2.6rem; color: #b9c6de; display: block; margin-bottom: .5rem; }

/* Formulario producto */
.back-link { display: inline-flex; gap: .4rem; align-items: center; margin-bottom: 1rem; font-weight: 600; font-size: .9rem; }
.form-layout { display: grid; grid-template-columns: 1fr 340px; gap: 1.2rem; align-items: start; }
.side-col { position: sticky; top: 80px; }
.img-drop { aspect-ratio: 1; border: 2px dashed #d6deec; border-radius: 12px; display: grid; place-items: center; background: #f8fafd; overflow: hidden; }
.img-drop img { display: none; width: 100%; height: 100%; object-fit: contain; }
.img-drop span { color: var(--muted); font-size: .9rem; }
.img-drop.has-img { border-style: solid; background: #fff; }
.img-drop.has-img img { display: block; }
.img-drop.has-img span { display: none; }
@media (max-width: 960px) { .form-layout { grid-template-columns: 1fr; } .side-col { position: static; } }

.grid-list-form { display: grid; grid-template-columns: 1fr 380px; gap: 1.2rem; align-items: start; }
@media (max-width: 1100px) { .grid-list-form { grid-template-columns: 1fr; } }
.icon-picker { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: .35rem; margin-top: -.6rem; }
.icon-picker label { display: block !important; cursor: pointer; }
.icon-picker input { position: absolute; opacity: 0; pointer-events: none; }
.icon-picker i { display: grid; place-items: center; height: 44px; border-radius: 10px; border: 1px solid var(--line); font-size: 1.2rem; color: var(--muted); transition: .15s; }
.icon-picker label:hover i { border-color: var(--cyan); color: var(--blue); }
.icon-picker input:checked + i { background: var(--navy); color: var(--cyan); border-color: var(--navy); }
.icon-picker input:focus-visible + i { box-shadow: 0 0 0 3px rgba(31,182,255,.35); }

/* Mensajes */
.inbox { list-style: none; margin: 0; padding: 0; }
.inbox li a { display: grid; grid-template-columns: 14px 1fr auto; gap: .8rem; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); color: var(--text); }
.inbox li:last-child a { border-bottom: 0; }
.inbox li a:hover { background: #fafcff; }
.inbox .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: .45rem; }
.inbox li.unread .dot { background: var(--cyan); }
.inbox li.unread strong { font-weight: 700; }
.inbox strong { font-weight: 500; margin-right: .4rem; }
.inbox p { margin: .2rem 0 0; color: var(--muted); font-size: .88rem; }
.inbox time { color: var(--muted); font-size: .8rem; white-space: nowrap; }
.msg-view { max-width: 820px; }
.msg-head { display: flex; justify-content: space-between; gap: 1rem; align-items: flex-start; }
.msg-head h2 { font-size: 1.3rem; }
.msg-head p { margin: .2rem 0 0; }
.msg-meta { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 1.2rem 0; font-size: .9rem; }
.msg-meta dt { color: var(--muted); }
.msg-meta dd { margin: 0; }
.msg-body { background: #f8fafd; border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1.2rem; white-space: normal; }
.msg-actions { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1.2rem; }
.msg-actions form { margin: 0; }

/* Ajustes */
.settings { max-width: 900px; }
.sticky-save { position: sticky; bottom: 0; padding: 1rem 0; background: linear-gradient(transparent, var(--bg) 35%); display: flex; justify-content: flex-end; }

/* Login */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 16px;
    background: radial-gradient(circle at 80% 10%, rgba(31,182,255,.35), transparent 45%), linear-gradient(160deg, #0b1530, #070d1f); }
.login-card { width: 100%; max-width: 400px; background: #fff; border-radius: 20px; padding: 2rem; box-shadow: 0 30px 60px -20px rgba(0,0,0,.6); display: grid; gap: .9rem; }
.login-card img { width: 84px; height: 84px; border-radius: 18px; object-fit: cover; justify-self: center; }
.login-card h1 { font-size: 1.25rem; text-align: center; }
.login-card p { margin: 0; color: var(--muted); text-align: center; font-size: .9rem; }
.login-card label { display: grid; gap: .35rem; font-size: .85rem; font-weight: 600; }
.login-card .alert { margin: 0; }
.login-card .back { text-align: center; font-size: .85rem; color: var(--muted); }
