/* LinkTransit responsive UI */
*,
*::before,
*::after { box-sizing: border-box; }

:root {
  --bg: #f3f6fb;
  --surface: #fff;
  --text: #172033;
  --muted: #68758a;
  --line: #e3e8f0;
  --primary: #2457a6;
  --primary-dark: #1c4383;
  --radius: 16px;
  --shadow: 0 8px 26px rgba(20,35,65,.045);
}

html {
  min-width: 320px;
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  overflow-wrap: anywhere;
}

img, svg, video, canvas { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, .button { touch-action: manipulation; }

h1 {
  font-size: clamp(1.65rem, 4vw, 2.25rem);
  line-height: 1.15;
  letter-spacing: -.03em;
  margin: 7px 0 10px;
  overflow-wrap: anywhere;
}
h2 { font-size: clamp(1.05rem, 2.5vw, 1.2rem); margin: 0 0 8px; }
p { margin: 8px 0 14px; }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.muted { color: var(--muted); }
.break { overflow-wrap: anywhere; word-break: break-word; }
.eyebrow { font-size: 11px; font-weight: 850; letter-spacing: .14em; color: var(--primary); }

.footer {
  text-align: center;
  color: #8994a6;
  font-size: 11px;
  padding: 24px max(14px, env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
}

.app-shell {
  width: min(1180px, calc(100% - 40px));
  margin: clamp(18px, 3vw, 32px) auto;
}
.auth-wrap {
  width: min(100% - 32px, 540px);
  margin: clamp(18px, 5vh, 42px) auto;
}
.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(16px, 2.5vw, 26px);
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.auth-panel { padding: clamp(20px, 5vw, 36px); }

.form { display: grid; gap: 15px; min-width: 0; }
label {
  display: grid;
  gap: 7px;
  min-width: 0;
  font-size: 13px;
  font-weight: 700;
  color: #344054;
}
input, select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  border: 1px solid #cfd7e3;
  border-radius: 9px;
  padding: 10px 12px;
  background: #fff;
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: 3px solid #2457a61c;
  border-color: var(--primary);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 43px;
  border: 0;
  border-radius: 9px;
  padding: 10px 15px;
  background: var(--primary);
  color: #fff;
  font-weight: 750;
  font-size: 13px;
  line-height: 1.25;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
}
.button:hover { background: var(--primary-dark); text-decoration: none; }
.button:disabled { opacity: .5; cursor: not-allowed; }
.button.secondary { background: #edf2fa; color: #23416f; }
.button.secondary:hover { background: #e0e9f6; }

.notice {
  border-radius: 10px;
  padding: 12px 14px;
  margin: 0 0 16px;
  font-size: 13px;
  overflow-wrap: anywhere;
}
.notice.error { background: #fff0ef; color: #9d3028; border: 1px solid #ffd4d0; }
.notice.success { background: #eaf7ef; color: #17623a; border: 1px solid #ccebd7; }
.notice.info { background: #eef4ff; color: #244b86; border: 1px solid #d6e3fb; }

.topbar, .top-actions, .section-head, .pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}
.topbar { margin-bottom: 20px; }
.topbar h1 { margin-bottom: 0; }
.top-actions { flex-wrap: wrap; }
.top-actions > * { max-width: 100%; }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}
.stat {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: clamp(12px, 1.8vw, 18px);
}
.stat span { display: block; color: var(--muted); font-size: 12px; }
.stat strong {
  display: block;
  font-size: clamp(21px, 3vw, 29px);
  line-height: 1.3;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.create-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr) minmax(0, 1fr);
  align-items: end;
}
.form-end { display: flex; align-items: end; min-width: 0; }

.section-head { margin-bottom: 16px; flex-wrap: wrap; }
.section-head p { margin-bottom: 0; }

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
  border-radius: 8px;
}
table {
  width: 100%;
  min-width: 650px;
  border-collapse: collapse;
  font-size: 12px;
}
th, td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}
td a { overflow-wrap: anywhere; word-break: break-word; }
.num { font-variant-numeric: tabular-nums; font-weight: 700; }
.pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 30px;
  font-size: 10px;
  font-weight: 750;
}
.pill.active { background: #eaf7ef; color: #17623a; }
.pill.inactive { background: #f0f2f5; color: #687080; }
.actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.actions form { margin: 0; }
.tiny-button { min-height: 31px; padding: 6px 9px; font-size: 11px; }
.empty { text-align: center; color: var(--muted); padding: 25px; }

.destination {
  padding: 12px 14px;
  border-radius: 10px;
  background: #eef4ff;
  color: #244b86;
  font-weight: 800;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.privacy-box {
  border: 1px solid #dbe5f3;
  background: #f6f9fe;
  border-radius: 12px;
  padding: 14px;
  margin: 16px 0;
}
.privacy-box strong { font-size: 13px; }
.privacy-box p { font-size: 12px; color: #53647c; line-height: 1.65; margin: 7px 0; }
.privacy-list { padding-left: 20px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.pagination { margin-top: 16px; flex-wrap: wrap; }

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .create-grid { grid-template-columns: minmax(0, 1fr); }
  .topbar { align-items: flex-start; }
}
@media (max-width: 640px) {
  .app-shell { width: min(100% - 24px, 1180px); margin: 16px auto; }
  .auth-wrap { width: min(100% - 24px, 540px); margin: 16px auto; }
  .panel { border-radius: 13px; margin-bottom: 13px; }
  .topbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .top-actions { width: 100%; justify-content: flex-start; }
  .top-actions .button { flex: 1 1 auto; }
  .section-head { align-items: flex-start; }
  .form-end, .form-end .button { width: 100%; }
  .pagination { align-items: flex-start; }
}
@media (max-width: 420px) {
  .app-shell, .auth-wrap { width: calc(100% - 20px); }
  .stats-grid { gap: 8px; }
  .stat { padding: 11px; }
  .stat span { font-size: 11px; }
  .stat strong { font-size: 21px; }
  .auth-panel { padding: 19px 16px; }
  .top-actions { flex-direction: column; align-items: stretch; }
  .top-actions .button { width: 100%; }
  .button { min-height: 44px; }
  th, td { padding: 10px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
