/*
 * routea: wayfinding.
 * A short link is a signpost, so the visual language borrows from Australian
 * guide signs: sign green, sign white, an inset white border, Overpass (derived
 * from the highway sign alphabet). Yellow and red are reserved for meaning only:
 * yellow = caution / check / review, red = blocked or destructive.
 */

/* Overpass in three subsets; the browser only downloads the ones a page uses. */
@font-face {
  font-family: "Overpass";
  src: url("/static/fonts/overpass.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Overpass";
  src: url("/static/fonts/overpass-latin-ext.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Overpass";
  src: url("/static/fonts/overpass-vietnamese.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}
@font-face {
  font-family: "Overpass Mono";
  src: url("/static/fonts/overpass-mono.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;
}
@font-face {
  font-family: "Overpass Mono";
  src: url("/static/fonts/overpass-mono-latin-ext.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;
}
@font-face {
  font-family: "Overpass Mono";
  src: url("/static/fonts/overpass-mono-vietnamese.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
  unicode-range: U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;
}

:root {
  --green: #00694a;        /* guide sign green */
  --green-deep: #00523a;
  --green-tint: #e2efe9;
  --ink: #13261f;          /* text */
  --ink-2: #44574f;
  --ink-3: #6c7d76;
  --paper: #eef2ef;        /* page */
  --white: #ffffff;
  --line: #d3ddd8;
  --yellow: #f2c200;       /* caution, review */
  --yellow-tint: #fdf3cc;
  --red: #b3261e;          /* blocked, destructive */
  --red-tint: #f9e3e1;

  /* Chinese has no Overpass glyphs, so it falls through to the device's own Simplified Chinese font. */
  --cjk: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", "Noto Sans CJK SC", "Source Han Sans SC";
  --sans: "Overpass", var(--cjk), ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Overpass Mono", ui-monospace, Menlo, Consolas, var(--cjk), monospace;

  /* Type scale: 1.25 ratio from a 17px base */
  --t-sm: 14px;
  --t-base: 17px;
  --t-md: 21px;
  --t-lg: 26.5px;
  --t-xl: 33px;
  --t-2xl: clamp(33px, 5vw, 46px);

  --r-sign: 12px;
  --r: 6px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--t-base)/1.5 var(--sans);
  min-height: 100vh; display: flex; flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; padding-block: 36px 72px; }
.wrap { width: 100%; max-width: 960px; margin-inline: auto; padding-inline: 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--green-deep); text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; }

h1, h2, h3 { font-weight: 700; line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 .5em; }
h1 { font-size: var(--t-xl); }
h2 { font-size: var(--t-md); }
h3 { font-size: var(--t-base); }
p { margin: 0 0 1em; }
code { font-family: var(--mono); font-size: .92em; }

/* ---- Header: a strip of sign green ---------------------------------------- */
.top { background: var(--green); color: var(--white); }
.top-inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; gap: 16px; }
.brand { color: var(--white); text-decoration: none; font-weight: 800; font-size: 24px; letter-spacing: -0.02em; display: inline-flex; align-items: center; gap: 10px; }
.brand:hover { color: var(--white); }
.brand-mark { width: 26px; height: 26px; border: 2px solid var(--white); border-radius: 6px; display: inline-grid; place-items: center; }
.brand-mark svg { width: 14px; height: 14px; }
.top-right { display: flex; align-items: center; gap: 18px; min-width: 0; }
.nav { display: flex; align-items: center; gap: 22px; font-weight: 500; }

/* Language menu: quiet text in the header, opens a short list of language names */
.lang { position: relative; }
.lang summary {
  list-style: none; cursor: pointer; color: #d9ebe3; font-size: 15px; font-weight: 500;
  padding: 6px 2px 4px; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary::after { content: ""; width: 7px; height: 7px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); }
.lang summary:hover, .lang[open] summary { color: var(--white); }
.lang-list {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; min-width: 200px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: 0 8px 24px rgba(19, 38, 31, .14); padding: 6px; display: grid;
}
.lang-list button {
  font: 400 16px/1.3 var(--sans); color: var(--ink); background: none; border: 0; border-radius: 4px;
  text-align: left; padding: 9px 12px 7px; cursor: pointer;
}
.lang-list button:hover { background: var(--green-tint); color: var(--green-deep); }
.lang-list button[aria-current] { font-weight: 700; color: var(--green); }
.lang-list button[aria-current]::after { content: " ✓"; }
.nav a, .nav .linkish { color: var(--white); text-decoration: none; font: inherit; }
.nav a:hover, .nav .linkish:hover { text-decoration: underline; color: var(--white); }
.nav form { margin: 0; }
.nav .btn { background: var(--white); color: var(--green); border-color: var(--white); }
.nav .btn:hover { background: var(--green-tint); color: var(--green-deep); text-decoration: none; }

.foot { color: var(--ink-3); font-size: var(--t-sm); border-top: 1px solid var(--line); }
.foot-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px; padding-block: 22px; }
.foot nav { display: flex; gap: 20px; flex-wrap: wrap; }
.foot a { color: var(--ink-2); }

/* ---- Buttons: sign-plate rectangles, not pills ----------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 700 16px/1 var(--sans); color: var(--white); background: var(--green);
  border: 2px solid var(--green); border-radius: var(--r);
  padding: 13px 20px 11px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--green-deep); border-color: var(--green-deep); color: var(--white); text-decoration: none; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-small { padding: 9px 14px 7px; font-size: 15px; }
.btn-tiny { padding: 5px 10px 3px; font-size: 14px; font-weight: 600; }
.btn-ghost { background: var(--white); color: var(--green); border-color: var(--line); }
.btn-ghost:hover { background: var(--green-tint); border-color: var(--green); color: var(--green-deep); }
.btn.copied { background: var(--green-tint); border-color: var(--green); color: var(--green-deep); }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: var(--green); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.linkish.danger, .danger { color: var(--red); }
form.inline { display: inline; margin: 0; }

/* ---- The sign: the one bold device ------------------------------------------ */
.sign { background: var(--green); color: var(--white); border-radius: var(--r-sign); padding: 6px; }
.sign-inner { border: 3px solid var(--white); border-radius: calc(var(--r-sign) - 4px); padding: 28px 30px; }
.sign a { color: var(--white); }
.sign .btn { background: var(--white); color: var(--green); border-color: var(--white); }
.sign .btn:hover { background: var(--green-tint); color: var(--green-deep); }
.sign .btn-ghost { background: transparent; color: var(--white); border-color: rgba(255,255,255,.6); }
.sign .btn-ghost:hover { background: rgba(255,255,255,.12); color: var(--white); border-color: var(--white); }
.sign .btn.copied { background: var(--yellow); border-color: var(--yellow); color: var(--ink); }

/* Home hero */
.hero-sign { margin-bottom: 48px; }
.hero-sign .sign-inner { padding: 44px 40px 36px; position: relative; }
.hero-arrow { position: absolute; top: 40px; right: 44px; width: 150px; height: 150px; color: var(--white); }
@media (max-width: 860px) { .hero-arrow { display: none; } }
.hero-sign h1 { font-size: var(--t-2xl); font-weight: 800; letter-spacing: -0.02em; max-width: 16ch; margin-bottom: 12px; }
.hero-sign .lede { font-size: var(--t-md); line-height: 1.4; max-width: 34ch; color: #d9ebe3; margin-bottom: 28px; }
.shorten { display: flex; gap: 8px; max-width: 680px; }
.shorten input {
  flex: 1; min-width: 0; font: 400 18px var(--sans); color: var(--ink);
  background: var(--white); border: 2px solid var(--white); border-radius: var(--r); padding: 13px 14px 11px;
}
.shorten input:focus { outline: 3px solid var(--yellow); outline-offset: 0; }
.hero-note { font-size: var(--t-sm); color: #cfe4da; margin: 12px 0 0; }

/* The one motion: a long URL folds into its short link */
.demo { margin-top: 30px; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.28); display: flex; align-items: baseline; min-height: 58px; overflow: hidden; }
.demo-long, .demo-short { font-family: var(--mono); white-space: nowrap; }
.demo-long { color: #a9cfbf; font-size: 15px; margin-right: 0; overflow: hidden; text-overflow: clip; max-width: 100%; animation: fold 900ms cubic-bezier(.7,0,.3,1) 1400ms forwards; }
.demo { position: relative; }
.demo-short { position: absolute; left: 0; font-size: 22px; color: var(--white); opacity: 0; transform: translateX(-8px); animation: arrive 500ms ease-out 2100ms forwards; }
@keyframes fold { to { max-width: 0; margin-right: 0; opacity: 0; } }
@keyframes arrive { to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .demo-long { display: none; animation: none; }
  .demo-short { position: static; opacity: 1; transform: none; animation: none; }
}

/* "Ready" sign after creating a link */
.ready { margin-bottom: 24px; }
.ready .sign-inner { padding: 20px 24px; display: grid; gap: 10px; }
.ready-title { font-weight: 600; color: #d9ebe3; }

/* ---- Home: what you get (a plain list, not cards) ------------------------- */
.facts-list { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; gap: 0; margin: 0 0 48px; max-width: 820px; }
.facts-list dt, .facts-list dd { padding: 16px 0; border-top: 1px solid var(--line); margin: 0; }
.facts-list dt { font-weight: 700; }
.facts-list dt { padding-right: 24px; }
.facts-list dd { color: var(--ink-2); padding-left: 16px; }
.section-title { font-size: var(--t-lg); margin-bottom: 18px; }

.check-demo { background: var(--yellow-tint); border-left: 6px solid var(--yellow); border-radius: var(--r); padding: 22px 24px; max-width: 820px; }
.check-demo p:last-child { margin-bottom: 0; }
.check-demo code { background: var(--white); padding: 2px 6px; border-radius: 4px; }

/* ---- Forms ----------------------------------------------------------------- */
.narrow { max-width: 520px; }
.center { margin-inline: auto; text-align: center; padding-top: 32px; }
.stack { display: grid; gap: 18px; margin-top: 22px; }
label { display: block; font-weight: 600; font-size: 15px; }
label > input, label > select, label > textarea { display: block; margin-top: 6px; }
label > .prefix { margin-top: 6px; }
label.check { display: flex; align-items: center; gap: 10px; font-weight: 400; font-size: 16px; }
.opt { font-weight: 400; color: var(--ink-3); }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; font: 400 16px var(--sans); color: var(--ink); background: var(--white);
  border: 1.5px solid var(--line); border-radius: var(--r); padding: 11px 12px 9px;
}
input:focus, select:focus, textarea:focus { outline: 3px solid var(--yellow); outline-offset: 0; border-color: var(--ink); }
input:disabled { background: #e6ebe8; }
input[type=radio], input[type=checkbox] { accent-color: var(--green); width: 17px; height: 17px; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.fine { color: var(--ink-3); font-size: var(--t-sm); }

/* ---- Alerts ---------------------------------------------------------------- */
.alert { border-radius: var(--r); padding: 12px 16px 10px; margin: 0 0 18px; font-size: 16px; border-left: 5px solid; }
.alert-error { background: var(--red-tint); color: #7d1913; border-color: var(--red); }
.alert-ok { background: var(--green-tint); color: var(--green-deep); border-color: var(--green); }
.alert-info { background: var(--yellow-tint); color: #5c4800; border-color: var(--yellow); }
.dev { background: var(--white); border: 1px dashed var(--ink-3); padding: 10px 14px; border-radius: var(--r); font-size: 14px; }

/* ---- Panels (dashboard, account, admin) ------------------------------------ */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; margin-bottom: 20px; }
.crumb { margin: 0 0 14px; font-size: 15px; }
.create { display: grid; gap: 16px; }
.create > .btn { justify-self: start; }
.create .row { display: flex; flex-wrap: wrap; gap: 16px; align-items: end; }
.create .row > label { flex: 1 1 220px; }
.create .grow { flex: 2 1 320px; }
.create fieldset.row { display: grid; gap: 8px; }
.create details { border-top: 1px solid var(--line); padding-top: 14px; }
.create summary { cursor: pointer; font-weight: 600; color: var(--green); margin-bottom: 14px; }
.create details > .row, .create details > fieldset { margin-bottom: 16px; }
.prefix { display: flex; align-items: stretch; border: 1.5px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--white); }
.prefix:focus-within { outline: 3px solid var(--yellow); border-color: var(--ink); }
.prefix span { display: flex; align-items: center; padding: 0 2px 0 12px; color: var(--ink-3); font: 500 15px var(--mono); background: #f3f6f4; }
.prefix input { border: 0; border-radius: 0; }
.prefix input:focus { outline: none; }

/* ---- Link list --------------------------------------------------------------- */
.copyrow { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.short { font: 500 17px var(--mono); color: var(--ink); text-decoration: none; word-break: break-all; }
a.short:hover { color: var(--green); text-decoration: underline; }
.short.big { font-size: clamp(19px, 3vw, 26px); }
.sign .short { color: var(--white); }
h1.short { margin: 0; }
.listhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 6px; }
.listhead h2 { margin: 0; }
.search { display: flex; gap: 8px; }
.search input { width: 240px; padding: 8px 12px 6px; }
.links { list-style: none; margin: 0; padding: 0; }
.link { display: flex; gap: 20px; justify-content: space-between; padding: 18px 0; border-top: 1px solid var(--line); }
.link-main { min-width: 0; flex: 1; }
.label { font-weight: 600; margin-top: 4px; }
.dest { color: var(--ink-2); font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 4px; }
.meta { color: var(--ink-3); font-size: 14px; margin-top: 4px; }
.link-side { display: flex; flex-direction: column; align-items: flex-end; justify-content: space-between; gap: 10px; }
.clicks { text-align: right; line-height: 1.1; }
.clicks strong { display: block; font-size: var(--t-lg); font-weight: 700; font-variant-numeric: tabular-nums; }
.clicks span { color: var(--ink-3); font-size: 14px; }
.actions { display: flex; gap: 14px; font-size: 15px; flex-wrap: wrap; justify-content: flex-end; }
.empty { color: var(--ink-3); padding: 20px 0 4px; }
.pager { display: flex; justify-content: space-between; margin-top: 12px; }

.badge { display: inline-block; font-size: 13px; font-weight: 600; border-radius: 4px; padding: 3px 8px 1px; border: 1px solid; }
.badge-ok { color: var(--green); border-color: #9cc8b6; background: var(--green-tint); }
.badge-muted { color: var(--ink-2); border-color: var(--line); background: #f3f6f4; }
.badge-warn { color: #5c4800; border-color: var(--yellow); background: var(--yellow-tint); }
.badge-bad { color: var(--white); border-color: var(--red); background: var(--red); }

.restricted { margin-top: 8px; font-size: 15px; background: var(--yellow-tint); border-left: 4px solid var(--yellow); color: #4f3e00; border-radius: 4px; padding: 8px 12px 6px; display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* ---- Facts / preview / QR ---------------------------------------------------- */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 10px 22px; margin: 16px 0 24px; }
.facts dt { color: var(--ink-3); font-size: 15px; }
.facts dd { margin: 0; word-break: break-word; }

.preview { max-width: 620px; }
.preview-panel { background: var(--yellow-tint); border: 1px solid var(--yellow); border-left: 6px solid var(--yellow); border-radius: var(--r); padding: 24px; }
.preview .host { font-size: var(--t-md); }
.preview-panel .facts { margin-top: 0; }
.preview-panel + .fine { margin-top: 14px; }
.dest-full { color: var(--ink-2); font: 500 14px var(--mono); word-break: break-all; }

.qr { width: min(320px, 100%); margin: 20px 0; background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 12px; }
.qr svg { display: block; width: 100%; height: auto; }

/* ---- Prose --------------------------------------------------------------------- */
.prose { max-width: 66ch; }
.prose li { margin-bottom: 10px; }
.promises { padding-left: 24px; }
.promises li::marker { font-weight: 800; color: var(--green); }

/* ---- Admin --------------------------------------------------------------------- */
.mono { font: 500 14px var(--mono); word-break: break-all; }
.narrow-panel { max-width: 640px; }
.queue { list-style: none; margin: 0; padding: 0; }
.queue > li { border-top: 1px solid var(--line); padding: 14px 0; display: grid; gap: 6px; }
.link-summary { display: grid; gap: 3px; }
.dest-text { color: var(--ink-2); }
.appeal-msg { margin: 4px 0; background: #f3f6f4; border-radius: var(--r); padding: 8px 12px; font-size: 15px; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
.admin-reason { display: inline-flex; gap: 6px; align-items: center; }
.admin-reason input { width: 260px; padding: 5px 9px 3px; font-size: 14px; }
.danger-btn { color: var(--red); border-color: #e3aaa5; }
.danger-btn:hover { background: var(--red); border-color: var(--red); color: var(--white); }
.log { width: 100%; border-collapse: collapse; font-size: 14px; }
.log td { border-top: 1px solid var(--line); padding: 7px 10px 5px 0; vertical-align: top; }

/* ---- Small screens -------------------------------------------------------------- */
@media (max-width: 640px) {
  .hero-sign .sign-inner { padding: 30px 22px 26px; }
  .shorten { flex-direction: column; }
  .shorten .btn { width: 100%; }
  .facts-list { grid-template-columns: 1fr; }
  .facts-list dd { border-top: 0; padding-top: 0; padding-left: 0; }
  .link { flex-direction: column; }
  .link-side { flex-direction: row; align-items: center; }
  .clicks { text-align: left; }
  .search, .search input { width: 100%; }
  .nav { gap: 14px; font-size: 15px; }
  .top-inner { flex-wrap: wrap; row-gap: 0; padding-block: 8px; }
  .top-right { gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
  .nav .btn-small { padding: 7px 10px 5px; font-size: 14px; }
  .lang summary { font-size: 14px; }
  .sign-inner { padding: 22px 18px; }
}

/* ---- Link stats ------------------------------------------------------------------ */
a.clicks { color: var(--ink); text-decoration: none; }
a.clicks:hover strong { color: var(--green); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.stats-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px 24px; flex-wrap: wrap; }
.stats-head > div { min-width: 0; flex: 1 1 320px; }
.ranges { display: inline-flex; border: 1.5px solid var(--line); border-radius: var(--r); overflow: hidden; flex-wrap: wrap; }
.range { padding: 7px 12px 5px; font-size: 14px; font-weight: 600; color: var(--ink-2); text-decoration: none; border-left: 1px solid var(--line); white-space: nowrap; }
.range:first-child { border-left: 0; }
a.range:hover { background: var(--green-tint); color: var(--green-deep); text-decoration: none; }
.range.on { background: var(--green); color: var(--white); }

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 24px 0 22px; border-top: 1px solid var(--line); }
.kpis > div { padding: 14px 16px 0 0; }
.kpis dt { color: var(--ink-3); font-size: 14px; }
.kpis dd { margin: 4px 0 0; font-size: var(--t-xl); font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpis dd.kpi-text { font-size: var(--t-md); overflow-wrap: anywhere; }

.chart { margin: 0; }
.chart-plot { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px; height: 180px; }
.chart-plot > * { min-height: 0; }
.chart-y { display: flex; flex-direction: column; justify-content: space-between; text-align: right; color: var(--ink-3); font-size: 12px; font-variant-numeric: tabular-nums; line-height: 1; padding-block: 0; }
.chart svg { width: 100%; height: 180px; display: block; overflow: visible; }
.chart .bar { fill: var(--green); }
.chart g:hover .bar { fill: var(--green-deep); }
.chart .hit { fill: transparent; }
.chart g:hover .hit { fill: var(--green-tint); }
.chart .grid { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.chart .base { stroke: var(--ink-3); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart-x { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-3); font-size: 13px; margin-top: 6px; padding-left: 34px; }
.chart-table { margin-top: 14px; font-size: 15px; }
.chart-table summary { cursor: pointer; color: var(--green); font-weight: 600; }
.chart-table table { max-width: 320px; margin-top: 8px; }
.log th { text-align: left; font-size: 13px; color: var(--ink-3); font-weight: 600; padding: 0 10px 4px 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }

.breakdowns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.breakdown { background: var(--white); border: 1px solid var(--line); border-radius: var(--r); padding: 20px 24px; }
.breakdown .empty { padding: 4px 0 0; margin: 0; }
.share { width: 100%; border-collapse: collapse; font-size: 15px; }
.share th, .share td { border-top: 1px solid var(--line); padding: 8px 0 6px; }
.share th { text-align: left; font-weight: 500; padding-right: 10px; overflow-wrap: anywhere; }
.share td.num { padding-left: 10px; white-space: nowrap; }
.share td.pct { color: var(--ink-3); width: 4.5em; }
.sharebar { width: 28%; padding-left: 12px !important; }
.sharebar svg { display: block; width: 100%; height: 6px; }
.sharebar .track { fill: #f0f3f1; }
.sharebar .fill { fill: var(--green); }
.stats-notes { margin-top: 20px; max-width: 80ch; }

@media (max-width: 760px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .breakdowns { grid-template-columns: 1fr; }
  .chart-plot, .chart svg { height: 150px; }
  .kpis dd.kpi-text { font-size: var(--t-base); }
  .sharebar { display: none; }
}

/* ---- Smart routing ------------------------------------------------------------- */
/* Rules read as a numbered list of signposts: the number is the order they're checked in. */
.rules { list-style: none; margin: 16px 0 20px; padding: 0; counter-reset: rule; }
.rule { counter-increment: rule; display: flex; gap: 14px; align-items: center; justify-content: space-between; padding: 12px 0; border-top: 1px solid var(--line); }
.rule:last-child { border-bottom: 1px solid var(--line); }
.rule::before {
  content: counter(rule); flex: none; width: 28px; height: 28px; display: grid; place-items: center;
  background: var(--green); color: var(--white); border-radius: 5px; font-weight: 700; font-size: 14px; padding-top: 2px;
}
.rule-main { min-width: 0; flex: 1; display: grid; gap: 2px; }
.rule-who { font-weight: 600; }
.rule .dest { margin-top: 0; font-family: var(--mono); font-size: 14px; }
.rule .actions { flex: none; }
.rule-forms { display: grid; gap: 14px; margin: 4px 0 16px; }
.rule-add { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; padding: 14px; background: #f5f8f6; border: 1px solid var(--line); border-radius: var(--r); }
.rule-add > label { flex: 1 1 200px; }
.rule-add > .grow { flex: 2 1 300px; }
.route-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.route-list li { display: grid; gap: 1px; }
.route-who { font-weight: 600; font-size: 15px; }

@media (max-width: 640px) {
  .rule { flex-wrap: wrap; }
  .rule .actions { width: 100%; justify-content: flex-start; padding-left: 42px; }
  .rule-add .btn { width: 100%; }
  /* Preview: stack label above value so long addresses get the full width. */
  .preview-panel .facts { grid-template-columns: 1fr; gap: 2px; }
  .preview-panel .facts dd { margin-bottom: 12px; }
  .preview-panel .facts dd:last-child { margin-bottom: 0; }
}

/* Chinese text: full-width glyphs need more room per "ch" and a little more line height */
:lang(zh-Hans) .hero-sign h1 { max-width: 12em; letter-spacing: 0; }
:lang(zh-Hans) .hero-sign .lede { max-width: 22em; }
:lang(zh-Hans) body { line-height: 1.65; }
:lang(zh-Hans) h1, :lang(zh-Hans) h2, :lang(zh-Hans) h3 { letter-spacing: 0; }

/* ---- My links: view switch, filters, list view ---------------------------------- */
.links-panel { min-width: 0; }
.view-switch { display: inline-flex; border: 1.5px solid var(--line); border-radius: var(--r); overflow: hidden; }
.view-switch button { font: 600 14px/1 var(--sans); background: var(--white); color: var(--ink-2); border: 0; padding: 8px 14px 6px; cursor: pointer; }
.view-switch button + button { border-left: 1.5px solid var(--line); }
.view-switch button[aria-pressed="true"] { background: var(--green); color: var(--white); }
.view-switch button:not([aria-pressed="true"]):hover { background: var(--green-tint); color: var(--green-deep); }

.filters { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 14px 0 6px; }
.filters input[type=search] { flex: 1 1 220px; width: auto; padding: 8px 12px 6px; }
.inline-label { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; color: var(--ink-2); white-space: nowrap; }
.inline-label select { display: inline-block; width: auto; margin: 0; padding: 7px 10px 5px; font-size: 15px; }

.list-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 10px 0 12px; }
.list-tools .page-size { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.js .nojs-only { display: none; }

.table-wrap { position: relative; width: 100%; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--r); }
.ltable { width: 100%; min-width: 820px; border-collapse: collapse; font-size: 15px; }
.ltable th, .ltable td { text-align: left; padding: 10px 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ltable thead th { background: #f3f6f4; font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.ltable thead th a { color: inherit; text-decoration: none; }
.ltable thead th a:hover { color: var(--green); text-decoration: underline; }
.ltable thead th[aria-sort] a { color: var(--ink); }
.sort-mark { font-size: 10px; margin-left: 4px; color: var(--green); }
.ltable .c-num { text-align: right; font-variant-numeric: tabular-nums; }
.ltable .c-health { width: 1%; }
.ltable .c-date { white-space: nowrap; color: var(--ink-2); }
.ltable .c-title { min-width: 120px; max-width: 220px; overflow-wrap: anywhere; }
.ltable .c-dest { max-width: 210px; }
.dest-cell { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); font-size: 14px; }
.short-cell { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; white-space: nowrap; }
.short-cell .short { font-size: 15px; max-width: 210px; overflow: hidden; text-overflow: ellipsis; }
.short-cell .sc-main { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.short-cell .btn { flex: none; }
.ltable .c-act { width: 1%; text-align: right; }

.hdot { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; cursor: help; }
.hdot svg { width: 14px; height: 14px; }
.hdot-ok { background: var(--green); color: var(--white); }
.hdot-bad { background: var(--red); color: var(--white); }
.hdot-grey { background: #e1e6e3; color: var(--ink-2); }
.c-health .badge { cursor: help; white-space: nowrap; }

.act-toggle { display: none; width: 34px; height: 34px; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--white); color: var(--ink-2); cursor: pointer; place-items: center; }
.js .act-toggle { display: inline-grid; }
.act-toggle:hover { border-color: var(--green); color: var(--green); }
.act-toggle svg { width: 16px; height: 16px; transition: transform .15s ease; }
.act-toggle[aria-expanded="true"] { border-color: var(--green); color: var(--green); background: var(--green-tint); }
.act-toggle[aria-expanded="true"] svg { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .act-toggle svg { transition: none; } }
.js .act-row:not(.open) { display: none; }
.act-row td { background: #f7f9f8; }
.act-btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.act-btns .restricted { flex-basis: 100%; margin: 0 0 4px; }

.pages { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-top: 16px; }
.pages-count { margin: 0; color: var(--ink-2); font-size: 14px; }
.pages ul { list-style: none; display: flex; flex-wrap: wrap; gap: 4px; margin: 0; padding: 0; }
.pages .pnum, .pages .pstep { display: inline-block; min-width: 36px; text-align: center; padding: 7px 10px 5px; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--white); text-decoration: none; color: var(--ink); font-size: 14px; font-weight: 600; }
.pages a.pnum:hover, .pages a.pstep:hover { border-color: var(--green); color: var(--green); }
.pages .pnum[aria-current] { background: var(--green); border-color: var(--green); color: var(--white); }
.pages .pstep[aria-disabled] { color: var(--ink-3); background: transparent; }
.pages .gap { padding: 7px 4px; color: var(--ink-3); }

.tip { position: fixed; z-index: 50; max-width: min(320px, calc(100vw - 16px)); background: var(--ink); color: var(--white); font-size: 13px; line-height: 1.4; padding: 7px 10px 5px; border-radius: 5px; pointer-events: none; box-shadow: 0 4px 14px rgba(19,38,31,.2); }

@media (max-width: 640px) {
  .listhead { align-items: flex-start; }
  .list-tools .page-size { margin-left: 0; }
  .pages { flex-direction: column; align-items: flex-start; }
}

/* Link health: "Check links" and what each plan gets */
.health-bar { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 12px 0 6px; padding: 10px 14px 8px; background: var(--yellow-tint); border-left: 5px solid var(--yellow); border-radius: var(--r); }
.health-bar form { margin: 0; flex: none; }
.health-note { margin: 0; flex: 1 1 280px; font-size: 15px; color: var(--ink-2); }
.health-bar button[aria-busy="true"] { opacity: .75; cursor: progress; }

/* Plans page */
.prose.wide { max-width: 860px; }
.plans { width: 100%; min-width: 520px; border-collapse: collapse; font-size: 16px; }
.plans th, .plans td { text-align: left; padding: 12px 14px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.plans thead th { background: #f3f6f4; font-size: 17px; }
.plans thead .badge { margin-left: 6px; vertical-align: 2px; }
.plans tbody th { font-weight: 600; width: 34%; }
.plans tbody tr:last-child > * { border-bottom: 0; }
.plans .yes { color: var(--green); font-weight: 700; }
.plans .no { color: var(--ink-3); }

/* ---- Hosted files (PDFs and photos) ---- */
.hosted { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; background: var(--green-tint); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: 14px; }
.hosted-label { font-weight: 700; font-size: var(--t-sm); color: var(--green-deep); text-transform: uppercase; letter-spacing: .04em; }
.create input[type="file"] { padding: 10px; background: var(--white); border: 1px dashed var(--ink-3); border-radius: var(--r); width: 100%; font: inherit; }

/* Viewer page on the files host */
.fileview-main { max-width: 760px; margin-inline: auto; padding-block: 24px 8px; }
.fileview-main h1 { font-size: var(--t-lg); line-height: 1.2; margin: 0 0 6px; overflow-wrap: anywhere; }
.fileview-main .copyrow { margin: 14px 0 18px; }
.pdf-embed { display: block; width: 100%; height: 80vh; min-height: 480px; border: 1px solid var(--line); border-radius: var(--r); background: var(--white); }
.photos { display: grid; gap: 14px; margin-top: 14px; }
.photos figure { margin: 0; }
.photos img { display: block; width: 100%; height: auto; border-radius: var(--r); background: var(--white); border: 1px solid var(--line); image-orientation: from-image; }
.fileview-foot { margin-top: 22px; text-align: center; }
/* Phones open PDFs in their own viewer (the Open PDF button); an embedded one is too small to read. */
@media (max-width: 700px) { .pdf-embed { display: none; } }

/* Short domain menu before the custom ending */
.prefix select.domain-pick { flex: 0 0 auto; width: auto; field-sizing: content; border: 0; border-radius: 0; background: #f3f6f4; color: var(--ink-2); font: 500 15px var(--mono); padding: 0 4px 0 12px; max-width: 46%; cursor: pointer; }
.prefix select.domain-pick:focus { outline: none; }
.prefix select.domain-pick + span { padding: 0 2px 0 0; }
