:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #eef4ff;
  --text: #102033;
  --muted: #66758a;
  --line: #dbe4f0;
  --primary: #1d4ed8;
  --primary-dark: #153a9f;
  --danger: #b42318;
  --ok-bg: #e8f8ef;
  --ok-text: #166534;
  --error-bg: #fff1f1;
  --error-text: #b42318;
  --shadow: 0 24px 80px rgba(15, 35, 75, .10);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(29, 78, 216, .16), transparent 32rem),
    linear-gradient(180deg, #f7faff 0%, var(--bg) 48%, #eef3fb 100%);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  padding: .15rem .35rem;
  border-radius: .45rem;
  background: #edf2ff;
  color: #173476;
}

.page {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 34px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px;
  margin-bottom: 22px;
  background: rgba(255, 255, 255, .78);
  border: 1px solid rgba(219, 228, 240, .82);
  border-radius: 24px;
  box-shadow: 0 12px 40px rgba(30, 55, 95, .08);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: white;
  background: linear-gradient(135deg, var(--primary), #0f2d74);
  font-weight: 800;
  letter-spacing: -.04em;
}


.brand-icon {
  width: 44px;
  height: 44px;
  display: block;
  object-fit: contain;
  flex: 0 0 auto;
  border-radius: 12px;
}

.brand strong { display: block; font-size: 1rem; line-height: 1.1; }
.brand small { display: block; color: var(--muted); font-size: .82rem; }

.topnav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.topnav a {
  padding: 10px 12px;
  color: #243750;
  border-radius: 12px;
  font-weight: 650;
}
.topnav a:hover { background: var(--surface-2); text-decoration: none; }

main { display: grid; gap: 18px; }
.hero,
.card,
.login-card {
  background: rgba(255, 255, 255, .88);
  border: 1px solid rgba(219, 228, 240, .92);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 26px;
  align-items: center;
  padding: clamp(24px, 5vw, 48px);
  overflow: hidden;
  position: relative;
}
.hero::after {
  content: "";
  position: absolute;
  inset: auto -12% -42% auto;
  width: 360px;
  height: 360px;
  background: radial-gradient(circle, rgba(29, 78, 216, .16), transparent 68%);
  pointer-events: none;
}
.hero.small { grid-template-columns: 1fr; }
.hero h1,
.login-card h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4.5vw, 3.35rem);
  line-height: 1.03;
  letter-spacing: -.055em;
}
.hero p,
.login-card p { color: var(--muted); max-width: 760px; }
.eyebrow {
  margin: 0 0 10px;
  color: var(--primary);
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-size: .76rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  min-width: 230px;
}
.stat {
  padding: 20px;
  border-radius: 18px;
  background: linear-gradient(180deg, #f8fbff, #edf4ff);
  border: 1px solid var(--line);
}
.stat strong { display: block; font-size: 2rem; line-height: 1; }
.stat span { color: var(--muted); font-size: .9rem; }

.card { padding: clamp(18px, 3vw, 28px); }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 18px;
}
.section-head h2 { margin: 0; font-size: clamp(1.35rem, 3vw, 2rem); letter-spacing: -.035em; }

.form label { display: grid; gap: 7px; }
.form label > span,
.search span {
  color: #31435b;
  font-weight: 700;
  font-size: .92rem;
}
input,
textarea {
  width: 100%;
  border: 1px solid #cdd8e6;
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  padding: 13px 14px;
  font: inherit;
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
input:focus,
textarea:focus {
  border-color: rgba(29, 78, 216, .65);
  box-shadow: 0 0 0 4px rgba(29, 78, 216, .12);
}
textarea { resize: vertical; }
.stack { display: grid; gap: 14px; }
.grid-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.span-2 { grid-column: 1 / -1; }
.form-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.hint,
.muted { color: var(--muted); font-size: .92rem; }

.btn,
.copy,
.ghost {
  appearance: none;
  border: 0;
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  transition: transform .15s, box-shadow .15s, background .15s;
}
.btn {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  padding: 13px 20px;
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 12px 24px rgba(29, 78, 216, .24);
}
.btn:hover { transform: translateY(-1px); text-decoration: none; }
.btn.wide { width: 100%; }
.copy,
.ghost {
  padding: 8px 10px;
  background: #eef4ff;
  color: #173476;
  font-size: .84rem;
}
.copy:hover,
.ghost:hover { background: #dfeaff; text-decoration: none; }
.copy.copied { background: #dcfce7; color: #166534; }
.ghost.danger { background: #fff1f1; color: var(--danger); }
.ghost.danger:hover { background: #ffe1e1; }

.login-shell {
  min-height: min(620px, calc(100vh - 170px));
  display: grid;
  place-items: center;
}
.login-card {
  width: min(520px, 100%);
  padding: clamp(24px, 5vw, 42px);
}

.flash {
  padding: 13px 16px;
  border-radius: 16px;
  font-weight: 700;
}
.flash.ok { background: var(--ok-bg); color: var(--ok-text); border: 1px solid #bbebca; }
.flash.error { background: var(--error-bg); color: var(--error-text); border: 1px solid #ffd0d0; }

.search {
  display: grid;
  gap: 7px;
  min-width: min(320px, 100%);
}
.table-wrap { overflow-x: auto; }
.links-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}
.links-table th,
.links-table td {
  padding: 15px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.links-table th {
  color: #52657e;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .07em;
}
.short-cell,
.url-cell {
  display: grid;
  gap: 8px;
}
.short-cell a { font-weight: 800; white-space: nowrap; }
.url-cell a {
  max-width: 520px;
  display: inline-block;
  overflow-wrap: anywhere;
  color: #19304f;
}
.url-cell small { color: var(--muted); }
.actions form { display: inline; }
.empty {
  padding: 26px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed #cbd7e6;
  border-radius: 18px;
  background: #f8fbff;
}
.result-box {
  margin-top: 18px;
  padding: 18px;
  border-radius: 18px;
  background: #f8fbff;
  border: 1px solid var(--line);
}
.result-box textarea { margin: 8px 0 10px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

.footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 24px 4px 0;
  color: var(--muted);
  font-size: .9rem;
}

@media (max-width: 820px) {
  .page { width: min(100% - 18px, 1180px); padding-top: 9px; }
  .topbar { align-items: flex-start; flex-direction: column; border-radius: 20px; }
  .topnav { width: 100%; justify-content: flex-start; }
  .hero { grid-template-columns: 1fr; padding: 24px; }
  .stats-grid { width: 100%; min-width: 0; }
  .grid-form { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; }
  .links-table { min-width: 0; }
  .links-table thead { display: none; }
  .links-table,
  .links-table tbody,
  .links-table tr,
  .links-table td { display: block; width: 100%; }
  .links-table tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  .links-table td {
    border: 0;
    padding: 8px 0;
  }
  .links-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 4px;
    color: #60728a;
    font-size: .74rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
  }
  .short-cell a { white-space: normal; overflow-wrap: anywhere; }
  .url-cell a { max-width: 100%; }
}

@media (max-width: 640px) {
  .brand { gap: 10px; }
  
}

@media (max-width: 640px) {
  .brand-icon { width: 40px; height: 40px; }
}
