/* ---------------------------------------------------------------------------
   Short link admin.

   Visual direction: a two-colour print job. Navy ink as the base plate, one
   fluorescent magenta spot colour used only where a number needs to be read
   across the room, on a newsprint grey ground. Trim-sharp 2px corners rather
   than soft cards. Short codes are set in mono because they are strings people
   copy off a page and type by hand, not decoration.
   --------------------------------------------------------------------------- */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;600&display=swap');

:root {
  --ink:        #141F33;
  --ink-2:      #4A5A73;
  --ink-3:      #8894A6;
  --paper:      #F1F0EC;
  --sheet:      #FFFFFF;
  --rule:       #D6D9D2;
  --rule-soft:  #E8E7E2;
  --spot:       #E5006D;
  --spot-soft:  #FBE3EE;
  --good:       #0B7A5A;
  --warn:       #A85B00;
  --bad:        #B3261E;

  --sans: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --rail: 15rem;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 15px/1.55 var(--sans);
}

a { color: var(--ink); text-decoration-color: var(--rule); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--spot); }

:focus-visible {
  outline: 2px solid var(--spot);
  outline-offset: 2px;
}

/* --- Shell ---------------------------------------------------------------- */

.shell { display: flex; min-height: 100vh; }

.rail {
  width: var(--rail);
  flex: 0 0 var(--rail);
  background: var(--ink);
  color: #C9D2DF;
  padding: 1.6rem 0;
  display: flex;
  flex-direction: column;
}

.rail__mark {
  padding: 0 1.4rem 1.5rem;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -.02em;
  color: #fff;
}
.rail__mark span { color: var(--spot); }

.rail nav { display: flex; flex-direction: column; }

.rail a {
  padding: .55rem 1.4rem;
  color: #C9D2DF;
  text-decoration: none;
  font-size: .93rem;
  border-left: 3px solid transparent;
}
.rail a:hover { color: #fff; background: rgba(255,255,255,.05); }
.rail a[aria-current="page"] {
  color: #fff;
  border-left-color: var(--spot);
  background: rgba(255,255,255,.06);
}

.rail__group {
  margin-top: 1.4rem;
  padding: 0 1.4rem .4rem;
  font-size: .78rem;
  color: #6E7F96;
}

.rail__foot {
  margin-top: auto;
  padding: 1.2rem 1.4rem 0;
  font-size: .8rem;
  color: #6E7F96;
  border-top: 1px solid rgba(255,255,255,.09);
}
.rail__foot a { color: #C9D2DF; display: block; margin-top: .4rem; }

.main { flex: 1; min-width: 0; padding: 2.2rem 2.4rem 4rem; }
.wrap { max-width: 68rem; }

/* --- Page headings -------------------------------------------------------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1.6rem;
}
h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; margin: 0 0 .25rem; }
h2 { font-size: 1.05rem; font-weight: 600; letter-spacing: -.01em; margin: 2.2rem 0 .8rem; }
h3 { font-size: .95rem; font-weight: 600; margin: 0 0 .5rem; }
.sub { color: var(--ink-2); margin: 0; font-size: .93rem; }

/* --- Figures: the month's headline numbers -------------------------------- */

.figures {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  border: 1px solid var(--rule);
  background: var(--sheet);
}
.figure { padding: 1.1rem 1.2rem; border-right: 1px solid var(--rule-soft); }
.figure:last-child { border-right: 0; }
.figure__n {
  font-size: 1.9rem;
  font-weight: 600;
  letter-spacing: -.03em;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.figure__l { font-size: .84rem; color: var(--ink-2); margin-top: .2rem; }
.figure__d { font-size: .8rem; margin-top: .35rem; font-variant-numeric: tabular-nums; }
.up   { color: var(--good); }
.down { color: var(--bad); }
.flat { color: var(--ink-3); }

/* --- Tables --------------------------------------------------------------- */

.panel { background: var(--sheet); border: 1px solid var(--rule); }
.panel__head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  padding: .9rem 1.1rem; border-bottom: 1px solid var(--rule);
}
.panel__head h2 { margin: 0; }
.panel__body { padding: 1.1rem; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th {
  text-align: left;
  font-weight: 600;
  font-size: .82rem;
  color: var(--ink-2);
  padding: .55rem 1.1rem;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
td { padding: .7rem 1.1rem; border-bottom: 1px solid var(--rule-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.code {
  font-family: var(--mono);
  font-size: .88rem;
  font-weight: 600;
  letter-spacing: .01em;
}
.muted { color: var(--ink-2); }
.small { font-size: .84rem; }
.trunc { display: block; max-width: 30rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* The ranked table doubles as the chart: each row's click count is drawn
   behind the number, so the shape of the month is legible without a separate
   graphic. This is the one place colour is spent. */
.rank { width: 2rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.rank--1 { color: var(--spot); font-weight: 600; }

.bar { position: relative; min-width: 7rem; }
.bar__fill {
  position: absolute; inset: 0 auto 0 0;
  background: var(--spot-soft);
  border-right: 2px solid var(--spot);
}
.bar__n { position: relative; padding: .1rem .5rem; font-variant-numeric: tabular-nums; font-weight: 600; }

/* --- Daily chart ---------------------------------------------------------- */

.chart { width: 100%; height: 9rem; display: block; }
.chart rect { fill: var(--ink); }
.chart rect.peak { fill: var(--spot); }
.chart .base { stroke: var(--rule); stroke-width: 1; }
.chart text { font: 400 10px var(--sans); fill: var(--ink-3); }

/* --- Forms ---------------------------------------------------------------- */

.field { margin-bottom: 1.05rem; }
label { display: block; font-size: .88rem; font-weight: 500; margin-bottom: .3rem; }
.hint { font-size: .82rem; color: var(--ink-2); margin-top: .3rem; }

input[type=text], input[type=email], input[type=password], input[type=url],
input[type=date], input[type=search], select, textarea {
  width: 100%;
  padding: .55rem .65rem;
  font: 400 .95rem var(--sans);
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 2px;
}
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 2px var(--spot-soft); }
input.mono { font-family: var(--mono); }

.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > * { flex: 1 1 14rem; }

.check { display: flex; gap: .55rem; align-items: flex-start; font-size: .9rem; }
.check input { margin-top: .25rem; }

.btn {
  display: inline-block;
  padding: .55rem 1.05rem;
  font: 500 .93rem var(--sans);
  border: 1px solid var(--ink);
  border-radius: 2px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: #1E2C46; }
.btn--ghost { background: transparent; color: var(--ink); }
.btn--ghost:hover { background: var(--rule-soft); }
.btn--spot { background: var(--spot); border-color: var(--spot); }
.btn--spot:hover { background: #C70060; }
.btn--danger { background: transparent; color: var(--bad); border-color: var(--rule); }
.btn--danger:hover { background: #FBEAE9; }
.btn--sm { padding: .3rem .6rem; font-size: .85rem; }

.actions { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin-top: 1.4rem; }

/* --- Notices -------------------------------------------------------------- */

.notice { padding: .75rem 1rem; border: 1px solid var(--rule); border-left-width: 3px; background: var(--sheet); margin-bottom: 1.2rem; font-size: .92rem; }
.notice--ok    { border-left-color: var(--good); }
.notice--error { border-left-color: var(--bad); }
.notice--info  { border-left-color: var(--spot); }

.tag {
  display: inline-block; padding: .1rem .45rem; font-size: .78rem;
  border: 1px solid var(--rule); border-radius: 2px; color: var(--ink-2); background: var(--sheet);
}
.tag--live      { color: var(--good); border-color: #B6DBCC; background: #EEF7F3; }
.tag--off       { color: var(--ink-2); }
.tag--pending   { color: var(--warn); border-color: #EBD3AE; background: #FCF5E9; }
.tag--suspended { color: var(--bad); border-color: #EFC9C6; background: #FBEAE9; }

.empty { padding: 2.4rem 1.1rem; text-align: center; color: var(--ink-2); }
.empty p { margin: 0 0 1rem; }

/* --- Auth screens --------------------------------------------------------- */

.auth { min-height: 100vh; display: grid; place-items: center; padding: 2rem 1rem; }
.auth__card { width: 100%; max-width: 25rem; background: var(--sheet); border: 1px solid var(--rule); padding: 2rem; }
.auth__card--wide { max-width: 40rem; }
.auth__mark { font-weight: 700; letter-spacing: -.02em; margin-bottom: 1.4rem; }
.auth__mark span { color: var(--spot); }
.auth__foot { margin-top: 1.4rem; font-size: .88rem; color: var(--ink-2); }

/* --- Plan chooser --------------------------------------------------------- */

.plans { display: grid; gap: 0; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); border: 1px solid var(--rule); }
.plan { padding: 1.2rem; background: var(--sheet); border-right: 1px solid var(--rule-soft); }
.plan:last-child { border-right: 0; }
.plan--current { background: var(--spot-soft); }
.plan__price { font-size: 1.25rem; font-weight: 600; letter-spacing: -.02em; margin: .2rem 0 .5rem; }
.plan__blurb { font-size: .88rem; color: var(--ink-2); margin: 0 0 1.1rem; }

/* --- Toolbar -------------------------------------------------------------- */

.toolbar { display: flex; gap: .6rem; align-items: flex-end; flex-wrap: wrap; margin-bottom: 1.4rem; }
.toolbar .field { margin: 0; }
.toolbar select, .toolbar input { min-width: 11rem; }

/* --- Copy-to-clipboard cue ------------------------------------------------ */

.copy { border: 0; background: none; padding: .1rem .3rem; cursor: pointer; color: var(--ink-3); font-size: .8rem; }
.copy:hover { color: var(--spot); }

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 860px) {
  .shell { flex-direction: column; }
  .rail { width: 100%; flex: none; padding: 1rem 0; }
  .rail nav { flex-direction: row; flex-wrap: wrap; }
  .rail a { border-left: 0; border-bottom: 3px solid transparent; padding: .45rem .9rem; }
  .rail a[aria-current="page"] { border-left: 0; border-bottom-color: var(--spot); }
  .rail__group, .rail__foot { display: none; }
  .main { padding: 1.4rem 1.1rem 3rem; }
  .figure { border-right: 0; border-bottom: 1px solid var(--rule-soft); }
  .table-scroll { overflow-x: auto; }
  .trunc { max-width: 14rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

@media print {
  .rail, .toolbar, .actions, .btn { display: none; }
  body { background: #fff; }
  .panel, .figures { border-color: #999; }
}
