/* ==========================================================================
   short.net.ar · hoja de estilos
   Tema claro por defecto, oscuro automático según el sistema.
   ========================================================================== */

:root {
  --bg:          #f6f7fb;
  --surface:     #ffffff;
  --surface-2:   #f2f4f9;
  --border:      #e3e7f0;
  --border-soft: #edf0f6;
  --text:        #131826;
  --text-2:      #5a6480;
  --text-3:      #8b94ad;

  --brand:       #4f46e5;
  --brand-2:     #6366f1;
  --brand-soft:  #eef0ff;
  --ok:          #0f9d58;
  --ok-soft:     #e6f6ed;
  --warn:        #b7791f;
  --warn-soft:   #fdf3e0;
  --danger:      #d92d20;
  --danger-soft: #fdecea;

  --c1: #4f46e5; --c2: #06b6d4; --c3: #f59e0b;
  --c4: #ec4899; --c5: #10b981; --c6: #8b5cf6;

  --radius:    14px;
  --radius-sm: 9px;
  --shadow:    0 1px 2px rgba(16,24,40,.05), 0 8px 24px -12px rgba(16,24,40,.14);
  --shadow-lg: 0 2px 4px rgba(16,24,40,.06), 0 18px 40px -16px rgba(16,24,40,.22);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #0b0f1c;
    --surface:     #131829;
    --surface-2:   #1a2036;
    --border:      #262d47;
    --border-soft: #1e2439;
    --text:        #e9ecf7;
    --text-2:      #a4adc8;
    --text-3:      #737d9b;
    --brand:       #6d68f0;
    --brand-2:     #8b87ff;
    --brand-soft:  #1e2144;
    --ok-soft:     #10281c;
    --warn-soft:   #2a2110;
    --danger-soft: #2c1518;
    --shadow:      0 1px 2px rgba(0,0,0,.4), 0 8px 24px -12px rgba(0,0,0,.6);
    --shadow-lg:   0 2px 4px rgba(0,0,0,.4), 0 18px 40px -16px rgba(0,0,0,.7);
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; letter-spacing: -.015em; font-weight: 650; }
h1 { font-size: 26px; }
h2 { font-size: 19px; }
h3 { font-size: 16px; }

code, .mono { font-family: var(--mono); font-size: .92em; }

/* --- Layout -------------------------------------------------------------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 22px;
  padding: 0 22px; height: 60px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 17px; color: var(--text);
  letter-spacing: -.03em; text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 28px; height: 28px; border-radius: 8px; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--c2));
  display: grid; place-items: center; color: #fff; font-size: 15px;
}

.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a {
  padding: 7px 13px; border-radius: var(--radius-sm);
  color: var(--text-2); font-weight: 550; font-size: 14.5px;
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.on { background: var(--brand-soft); color: var(--brand); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }

.badge-plan {
  padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 650;
  background: var(--brand-soft); color: var(--brand); text-transform: uppercase;
  letter-spacing: .04em;
}

.wrap { max-width: 1220px; margin: 0 auto; padding: 26px 22px 72px; }
.wrap-narrow { max-width: 760px; }

.page-head {
  display: flex; align-items: flex-start; gap: 18px;
  flex-wrap: wrap; margin-bottom: 22px;
}
.page-head .sub { color: var(--text-2); font-size: 14.5px; margin: 0; }
.page-head-actions { margin-left: auto; display: flex; gap: 9px; flex-wrap: wrap; }

/* --- Tarjetas ------------------------------------------------------------ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px; }
.card-head {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 20px; border-bottom: 1px solid var(--border-soft);
}
.card-head h2, .card-head h3 { margin: 0; }
.card-head .right { margin-left: auto; font-size: 13px; color: var(--text-3); }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0,1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0,1fr)); }
@media (max-width: 940px) { .grid-4 { grid-template-columns: repeat(2,minmax(0,1fr)); } .grid-3 { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

/* --- KPIs ---------------------------------------------------------------- */

.kpi { padding: 17px 19px; }
.kpi-label {
  font-size: 12.5px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: .05em; margin-bottom: 7px;
}
.kpi-value { font-size: 30px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.kpi-foot { margin-top: 6px; font-size: 13px; color: var(--text-3); }

.delta { display: inline-flex; align-items: center; gap: 3px; font-weight: 650; }
.delta.up   { color: var(--ok); }
.delta.down { color: var(--danger); }
.delta.flat { color: var(--text-3); }

/* --- Botones ------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-family: inherit; font-size: 14.5px; font-weight: 600; line-height: 1.2;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-2); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn-danger:hover { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 11px; font-size: 13.5px; }
.btn-block { width: 100%; }

/* --- Formularios --------------------------------------------------------- */

.field { margin-bottom: 15px; }
.field label {
  display: block; margin-bottom: 6px;
  font-size: 13.5px; font-weight: 600; color: var(--text-2);
}
.field .hint { margin-top: 5px; font-size: 12.5px; color: var(--text-3); }

input[type=text], input[type=url], input[type=email], input[type=password],
input[type=number], input[type=datetime-local], input[type=search], select, textarea {
  width: 100%; padding: 10px 13px;
  font-family: inherit; font-size: 15px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); outline: none;
  transition: border-color .12s, box-shadow .12s;
}
textarea { resize: vertical; min-height: 76px; }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }

.input-group { display: flex; align-items: stretch; }
.input-group .prefix {
  display: flex; align-items: center; padding: 0 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-right: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  font-family: var(--mono); font-size: 14px; color: var(--text-2); white-space: nowrap;
}
.input-group input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.row { display: flex; gap: 13px; flex-wrap: wrap; }
.row > * { flex: 1 1 200px; }

/* --- Tablas -------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
th {
  text-align: left; padding: 10px 16px; font-size: 12px; font-weight: 650;
  color: var(--text-3); text-transform: uppercase; letter-spacing: .05em;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 13px 16px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* --- Lista de links ------------------------------------------------------ */

.link-row { display: flex; align-items: center; gap: 13px; }
.link-fav {
  width: 32px; height: 32px; flex: none; border-radius: 8px;
  background: var(--surface-2); display: grid; place-items: center; overflow: hidden;
}
.link-fav img { width: 18px; height: 18px; }
.link-main { min-width: 0; }
.link-short {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 14.5px; font-weight: 600; color: var(--brand);
}
.link-dest {
  display: block; font-size: 13px; color: var(--text-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px;
}
.link-title { font-size: 13.5px; color: var(--text-2); }

.copy-btn {
  border: 0; background: none; cursor: pointer; padding: 2px 4px;
  color: var(--text-3); font-size: 13px; border-radius: 5px;
}
.copy-btn:hover { background: var(--surface-2); color: var(--brand); }

/* --- Píldoras ------------------------------------------------------------ */

.pill {
  display: inline-block; padding: 3px 9px; border-radius: 99px;
  font-size: 12px; font-weight: 620; white-space: nowrap;
}
.pill-ok     { background: var(--ok-soft);     color: var(--ok); }
.pill-warn   { background: var(--warn-soft);   color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-muted  { background: var(--surface-2);   color: var(--text-3); }
.pill-brand  { background: var(--brand-soft);  color: var(--brand); }

/* --- Barras de dimensión ------------------------------------------------- */

.bars { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; }
.bar-item {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 8px 16px; font-size: 14px;
}
.bar-item > * { position: relative; z-index: 1; }
/* Va DESPUÉS de la regla de arriba: misma especificidad, gana la última.
   Si se declara antes, el `position:relative` la saca del absoluto y la barra
   pasa a ocupar lugar en el flex, empujando la etiqueta fuera de la vista. */
.bar-fill {
  position: absolute; left: 0; top: 3px; bottom: 3px;
  background: var(--brand-soft); border-radius: 0 6px 6px 0;
  z-index: 0; transition: width .4s ease;
}
.bar-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-value { font-variant-numeric: tabular-nums; font-weight: 620; }
.bar-pct { color: var(--text-3); font-size: 12.5px; width: 46px; text-align: right; }

/* Código de país. No usamos emoji de bandera: Windows no los soporta y
   se ven como dos letras diminutas, que queda peor que no poner nada. */
.cc {
  display: inline-block; min-width: 27px; padding: 1px 5px; margin-right: 8px;
  border-radius: 5px; background: var(--surface-2); color: var(--text-2);
  font-family: var(--mono); font-size: 10.5px; font-weight: 700;
  letter-spacing: .05em; text-align: center; vertical-align: 1.5px;
}

/* --- Gráfico ------------------------------------------------------------- */

.chart { width: 100%; height: 260px; display: block; }
.chart-legend {
  display: flex; gap: 18px; padding: 0 20px 14px; font-size: 13px; color: var(--text-2);
}
.chart-legend i {
  display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  margin-right: 6px; vertical-align: -1px;
}

/* --- Mapa de calor por hora ---------------------------------------------- */

.heat { display: grid; grid-template-columns: repeat(24, 1fr); gap: 3px; padding: 4px 20px 8px; }
.heat-cell {
  aspect-ratio: 1; border-radius: 4px; background: var(--surface-2);
  position: relative; cursor: default;
}
.heat-scale { display: flex; gap: 10px; padding: 0 20px 16px; font-size: 12px; color: var(--text-3); }

/* --- Segmentos / filtros ------------------------------------------------- */

.segments {
  display: inline-flex; gap: 2px; padding: 3px;
  background: var(--surface-2); border-radius: var(--radius-sm); flex-wrap: wrap;
}
.segments a {
  padding: 5px 11px; border-radius: 7px; font-size: 13.5px;
  font-weight: 570; color: var(--text-2);
}
.segments a:hover { color: var(--text); text-decoration: none; }
.segments a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

/* --- Avisos -------------------------------------------------------------- */

.flash-stack { position: fixed; top: 72px; right: 20px; z-index: 90; display: grid; gap: 9px; max-width: 380px; }
.flash {
  padding: 12px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 550;
  box-shadow: var(--shadow-lg); animation: slidein .25s ease;
}
.flash-ok    { background: var(--ok-soft);     color: var(--ok); }
.flash-error { background: var(--danger-soft); color: var(--danger); }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } }

.notice {
  padding: 13px 16px; border-radius: var(--radius-sm); font-size: 14px;
  background: var(--warn-soft); color: var(--warn); border: 1px solid transparent;
}
.notice-info { background: var(--brand-soft); color: var(--brand); }

.empty { padding: 54px 24px; text-align: center; color: var(--text-3); }
.empty h3 { color: var(--text-2); }

/* --- Utilidades ---------------------------------------------------------- */

.muted   { color: var(--text-3); }
.small   { font-size: 13px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 8px; }  .mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; } .mb-0 { margin-bottom: 0; } .mb-2 { margin-bottom: 16px; }
.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; }
.wrap-anywhere { overflow-wrap: anywhere; }
.hide-sm { }
@media (max-width: 720px) { .hide-sm { display: none !important; } .nav a { padding: 7px 9px; } }

/* --- Página pública (login / home) --------------------------------------- */

.hero {
  min-height: 100vh; display: grid; place-items: center; padding: 40px 20px;
  background:
    radial-gradient(1000px 500px at 12% -8%, color-mix(in srgb, var(--brand) 16%, transparent), transparent),
    radial-gradient(800px 420px at 92% 8%, color-mix(in srgb, var(--c2) 13%, transparent), transparent),
    var(--bg);
}
.hero-card { width: 100%; max-width: 420px; }
.hero-logo {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-bottom: 24px; font-size: 21px; font-weight: 700; letter-spacing: -.03em;
}

.beta-tag {
  display: inline-block; padding: 3px 9px; border-radius: 99px;
  background: var(--brand-soft); color: var(--brand);
  font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase;
}

/* --- Planes -------------------------------------------------------------- */

.plan-card { padding: 26px 22px; display: flex; flex-direction: column; }
.plan-card.featured { border-color: var(--brand); box-shadow: var(--shadow-lg); }
.plan-name { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--brand); }
.plan-price { font-size: 34px; font-weight: 700; letter-spacing: -.03em; margin: 10px 0 2px; }
.plan-price small { font-size: 15px; font-weight: 500; color: var(--text-3); }
.plan-feats { list-style: none; margin: 18px 0 22px; padding: 0; display: grid; gap: 9px; font-size: 14px; }
.plan-feats li { display: flex; gap: 9px; align-items: flex-start; color: var(--text-2); }
.plan-feats li::before { content: "✓"; color: var(--ok); font-weight: 700; flex: none; }
.plan-feats li.off { color: var(--text-3); opacity: .65; }
.plan-feats li.off::before { content: "—"; color: var(--text-3); }
.plan-card .btn { margin-top: auto; }
