:root {
  /* Identidad visual Windup */
  --navy: #00001f;
  --yellow: #fac713;
  --yellow-dark: #e0b000;
  --coral: #ff7b75;
  --blue: #323eff;
  --ink: #00001f;
  --muted: rgba(0, 0, 31, 0.6);
  --line: rgba(0, 0, 31, 0.16);
  --bg: #f5f5f7;
  --card: #fff;
  --ok: #1a7f4b;
  --err: #d6453e;
  --radius: 16px;
  font-family: "Work Sans", "Segoe UI", Arial, sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
a { color: var(--blue); }
button, input { font: inherit; }

/* Cabecera */
.topbar {
  background: var(--navy);
  color: #fff;
  padding: 18px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { display: inline-flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; font-weight: 600; }
.logo img { height: 34px; width: auto; display: block; }
.logo span { border-left: 1px solid rgba(255, 255, 255, 0.3); padding-left: 12px; font-size: 14px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--yellow); }
.topbar nav a:hover { color: var(--yellow); }
.topbar nav a { color: #fff; text-decoration: none; font-weight: 600; margin-left: 20px; }

/* Hero */
.hero { background: var(--navy); color: #fff; padding: 48px 16px 96px; text-align: center; }
.hero h1 { font-weight: 800; letter-spacing: -0.02em; font-size: clamp(30px, 5vw, 52px); margin: 0 auto 16px; max-width: 820px; line-height: 1.1; }
.hero h1 em { font-style: normal; color: var(--yellow); }
.hero p { color: rgba(255, 255, 255, 0.72); margin: 0 auto; max-width: 620px; font-size: 18px; line-height: 1.5; }

/* Tarjeta del acortador */
.shortener { max-width: 860px; margin: -64px auto 0; padding: 0 16px; position: relative; }
.tabs { display: flex; gap: 8px; padding-left: 24px; }
.tab {
  background: var(--card);
  color: var(--navy);
  border-radius: 12px 12px 0 0;
  padding: 12px 20px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 32px;
  box-shadow: 0 10px 30px rgba(3, 31, 57, 0.12);
}
.card h2 { margin: 0 0 4px; font-size: 26px; }
.card .sub { margin: 0 0 24px; color: var(--muted); }

label { display: block; font-weight: 700; margin-bottom: 8px; }
.field { margin-bottom: 18px; }
input[type="text"], input[type="url"], input[type="password"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  font-size: 16px;
  background: #fff;
}
input:focus { outline: 2px solid var(--navy); outline-offset: 1px; border-color: transparent; }

.row { display: grid; grid-template-columns: 180px 1fr; gap: 12px; align-items: start; }
.domain {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  background: var(--bg);
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.linkbtn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--navy);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.utm { display: none; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 14px 0 6px; }
.utm.open { display: grid; }
.utm label { font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.utm input { padding: 10px 12px; font-size: 14px; }

.actions { display: flex; align-items: center; gap: 16px; margin-top: 22px; flex-wrap: wrap; }
.primary {
  background: var(--yellow);
  color: var(--navy);
  border: 0;
  border-radius: 8px;
  padding: 14px 22px;
  font-weight: 700;
  font-size: 17px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.primary:hover { background: var(--yellow-dark); }
.primary:disabled { opacity: 0.6; cursor: wait; }
.hint { color: var(--muted); font-size: 14px; }

.error { color: var(--err); font-weight: 600; margin-top: 12px; min-height: 1.2em; }

/* Resultado */
.result {
  display: none;
  margin-top: 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px 20px;
  border-left: 4px solid var(--yellow);
  background: #fffcf0;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.result.show { display: flex; }
.result .short { font-size: 20px; font-weight: 800; color: var(--navy); text-decoration: none; word-break: break-all; }
.result .long { color: var(--muted); font-size: 14px; word-break: break-all; margin-top: 4px; }
.result .grow { flex: 1; min-width: 220px; }

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 9px 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}
.ghost:hover { border-color: var(--navy); background: var(--navy); color: #fff; }
.ghost.copied { border-color: var(--ok); color: var(--ok); }
.ghost.danger:hover { border-color: var(--coral); background: var(--coral); color: var(--navy); }

/* Lista de enlaces */
.links { max-width: 860px; margin: 40px auto 64px; padding: 0 16px; }
.links h3 { font-size: 22px; margin: 0 0 16px; display: flex; justify-content: space-between; align-items: baseline; }
.links h3 small { font-size: 14px; color: var(--muted); font-weight: 500; }
.item {
  background: var(--card);
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 12px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  box-shadow: 0 1px 3px rgba(3, 31, 57, 0.06);
}
.item .grow { flex: 1; min-width: 220px; }
.item .title { font-weight: 700; margin-bottom: 4px; }
.item .short { color: var(--blue); font-weight: 700; text-decoration: none; }
.item .long { color: var(--muted); font-size: 14px; word-break: break-all; margin-top: 4px; }
.item .meta { color: var(--muted); font-size: 13px; margin-top: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; white-space: nowrap; }
.item .btns { display: flex; gap: 8px; flex-wrap: wrap; }
.empty { color: var(--muted); text-align: center; padding: 32px; background: var(--card); border-radius: 12px; }

.badge { background: var(--yellow); color: var(--navy); border-radius: 999px; padding: 2px 8px; font-weight: 700; font-size: 12px; }

/* Estadísticas */
.stats { max-width: 860px; margin: -64px auto 64px; padding: 0 16px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 20px 0; }
.kpi { background: var(--bg); border-radius: 12px; padding: 16px; }
.kpi b { display: block; font-size: 30px; font-weight: 800; }
.kpi span { color: var(--muted); font-size: 14px; }
.chart { display: flex; align-items: flex-end; gap: 3px; height: 160px; border-bottom: 1px solid var(--line); margin: 12px 0 6px; }
.chart div { flex: 1; background: var(--navy); border-radius: 3px 3px 0 0; min-height: 2px; position: relative; }
.chart div:hover { background: var(--yellow); }
.axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.bars { list-style: none; padding: 0; margin: 0; }
.bars li { display: grid; grid-template-columns: 160px 1fr 40px; gap: 10px; align-items: center; margin: 8px 0; font-size: 14px; }
.bars .bar { height: 10px; background: var(--bg); border-radius: 5px; overflow: hidden; }
.bars .bar i { display: block; height: 100%; background: var(--yellow); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 24px; margin-top: 24px; }
.section-title { font-size: 16px; margin: 24px 0 4px; }

footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px; }

@media (max-width: 560px) {
  .card { padding: 22px; }
  .row { grid-template-columns: 1fr; }
  .bars li { grid-template-columns: 100px 1fr 32px; }
  .logo img { height: 26px; }
}

/* Terminación aleatoria, avisos y acceso */
.alias-row { display: flex; gap: 8px; }
.alias-row input { flex: 1; min-width: 0; }
.alias-row .ghost { white-space: nowrap; padding: 0 14px; }
#aliasHint { margin-top: 6px; font-size: 13px; }
.notice { font-size: 13px; font-weight: 600; color: var(--navy); margin-bottom: 4px; }
.notice:empty { display: none; }
.narrow { max-width: 520px; }

/* Navegación por rol, usuarios y cuenta */
.topbar nav { display: flex; align-items: center; gap: 4px 20px; flex-wrap: wrap; justify-content: flex-end; }
.topbar nav a { margin-left: 0; }
.topbar nav a.active { color: var(--yellow); }
.topbar nav .who { color: rgba(255, 255, 255, 0.6); font-size: 14px; border-left: 1px solid rgba(255, 255, 255, 0.3); padding-left: 20px; }
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
  font: inherit;
  font-size: 16px;
  background: #fff;
  color: var(--ink);
}
select:focus { outline: 2px solid var(--navy); outline-offset: 1px; }
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0 16px; }
.roles { margin: 0; line-height: 1.5; }
.ok { color: var(--ok); font-weight: 600; min-height: 1.2em; }
.ok:empty, .error:empty { min-height: 0; }
.badge.muted { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.you { color: var(--muted); font-weight: 500; }
.spaced { margin-top: 20px; }
.dialog {
  border: 0;
  border-radius: var(--radius);
  padding: 28px;
  width: min(520px, calc(100vw - 32px));
  box-shadow: 0 20px 60px rgba(0, 0, 31, 0.35);
  color: var(--ink);
}
.dialog::backdrop { background: rgba(0, 0, 31, 0.55); }
.dialog h2 { margin: 0 0 4px; }
@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; gap: 10px; }
  .topbar nav { display: flex; justify-content: flex-start; font-size: 14px; }
  .topbar nav .who { display: none; }
}
@media (max-width: 900px) {
  .topbar { flex-wrap: wrap; gap: 12px; }
  .topbar nav { width: 100%; justify-content: flex-start; font-size: 15px; }
}
