:root {
  --ink: #15231f;
  --muted: #6c7873;
  --paper: #f5f7f3;
  --card: #ffffff;
  --line: #dce3de;
  --green: #127a58;
  --green-dark: #0d6045;
  --mint: #dff5ea;
  --amber: #a96308;
  --amber-bg: #fff0d8;
  --red: #ac3c3c;
  --red-bg: #fde7e5;
  --shadow: 0 18px 50px rgba(32, 55, 46, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(176, 226, 202, .35), transparent 28rem),
    var(--paper);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  min-height: 100vh;
}

a { color: inherit; }
button, input { font: inherit; }

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 5vw, 72px);
  background: rgba(255, 255, 255, .84);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: -.02em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  color: white;
  background: var(--green);
  border-radius: 18px 18px 18px 5px;
  font-weight: 900;
  letter-spacing: -.06em;
}

.brand-mark-small {
  width: 36px;
  height: 36px;
  border-radius: 11px 11px 11px 4px;
  font-size: 13px;
}

.auth-shell,
.invalid-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card,
.invalid-card,
.form-card {
  width: min(100%, 480px);
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(220, 227, 222, .9);
  border-radius: 28px;
  padding: clamp(28px, 5vw, 48px);
  box-shadow: var(--shadow);
}

.auth-card .brand-mark { margin-bottom: 26px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(30px, 5vw, 44px); letter-spacing: -.05em; }
.muted { color: var(--muted); line-height: 1.7; }
.eyebrow {
  margin-bottom: 8px;
  color: var(--green);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .16em;
}

.form-stack { display: grid; gap: 22px; margin-top: 30px; }
label { display: grid; gap: 9px; font-size: 14px; font-weight: 700; }
label small { color: var(--muted); font-weight: 400; line-height: 1.5; }
input {
  min-width: 0;
  width: 100%;
  padding: 13px 15px;
  color: var(--ink);
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color .16s, box-shadow .16s;
}
input:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(18, 122, 88, .10); }

.input-prefix {
  display: flex;
  align-items: center;
  overflow: hidden;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.input-prefix:focus-within { border-color: var(--green); box-shadow: 0 0 0 4px rgba(18, 122, 88, .10); }
.input-prefix span { padding-left: 15px; color: var(--muted); }
.input-prefix input { border: 0; box-shadow: none; padding-left: 3px; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  transition: transform .12s, background .12s;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--green); }
.button-primary:hover { background: var(--green-dark); }
.button-secondary { color: var(--green); background: var(--mint); }
.button-ghost { color: var(--ink); background: transparent; border-color: var(--line); }
.button-full { width: 100%; }

.page-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 58px 0 80px; }
.page-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 32px;
}
.page-heading h1 { margin-bottom: 6px; }
.page-heading p { margin-bottom: 0; }

.flash { margin: 16px 0; padding: 13px 16px; border-radius: 12px; font-size: 14px; }
.flash-error { color: var(--red); background: var(--red-bg); }
.flash-success { color: var(--green-dark); background: var(--mint); }

.link-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.link-card {
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 10px 30px rgba(32, 55, 46, .045);
}
.card-topline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.status { padding: 5px 9px; border-radius: 99px; font-size: 12px; font-weight: 800; }
.status-active { color: var(--green-dark); background: var(--mint); }
.status-expired, .status-limited { color: var(--amber); background: var(--amber-bg); }
.status-disabled { color: var(--red); background: var(--red-bg); }
.code { color: var(--muted); font-family: Consolas, monospace; font-size: 13px; }
.short-url {
  display: block;
  overflow: hidden;
  margin: 22px 0 8px;
  color: var(--green);
  font-size: 20px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.target {
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); margin: 22px 0; background: var(--paper); border-radius: 14px; }
.metric-grid div { display: grid; gap: 3px; padding: 15px; border-right: 1px solid var(--line); }
.metric-grid div:last-child { border-right: 0; }
.metric-grid span { color: var(--muted); font-size: 12px; }
.metric-grid strong { font-size: 22px; }
.detail-list { display: grid; gap: 10px; margin: 0; font-size: 13px; }
.detail-list div { display: flex; justify-content: space-between; gap: 20px; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; font-weight: 700; text-align: right; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; padding-top: 20px; border-top: 1px solid var(--line); }

.empty-state { padding: 76px 24px; text-align: center; background: white; border: 1px dashed #bdcbc3; border-radius: 24px; }
.empty-icon { width: 56px; height: 56px; display: grid; place-items: center; margin: 0 auto 20px; color: var(--green); background: var(--mint); border-radius: 50%; font-size: 26px; }
.empty-state p { color: var(--muted); }

.narrow-shell { width: min(720px, calc(100% - 40px)); margin: 0 auto; padding: 48px 0 80px; }
.narrow-shell .form-card { width: 100%; margin-top: 22px; }
.back-link { color: var(--muted); text-decoration: none; font-size: 14px; }
.form-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form-actions { display: flex; gap: 10px; margin-top: 6px; }

.invalid-card { text-align: center; }
.invalid-symbol { width: 64px; height: 64px; display: grid; place-items: center; margin: 0 auto 24px; color: var(--amber); background: var(--amber-bg); border-radius: 50%; font-size: 30px; font-weight: 900; }
.invalid-card p:not(.eyebrow) { color: var(--muted); line-height: 1.7; }
.invalid-card small { color: #98a19d; }

@media (max-width: 760px) {
  .link-grid { grid-template-columns: 1fr; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .page-heading .button { align-self: flex-start; }
  .form-columns { grid-template-columns: 1fr; }
  .metric-grid div { padding: 12px; }
  .card-actions .button { min-height: 38px; padding: 8px 11px; font-size: 13px; }
}
