/* ═══════════ DASHBOARD ═══════════ */

body.dash { background: var(--paper); }

.wrap { width: min(1180px, 100%); margin: 0 auto; padding: 0 20px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* extra button sizes / colours */
.btn-md   { font-size: 18px; padding: 12px 22px; }
.btn-lime { background: var(--lime); }
.btn:disabled { opacity: .55; cursor: progress; transform: none; box-shadow: var(--shadow); }
.linklike { background: none; border: 0; font: 700 14px var(--mono); color: var(--ink); text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 3px; text-decoration-color: var(--pink); cursor: pointer; }
.linklike:hover { background: var(--yellow); }

/* ───────── header ───────── */
.dash-hero {
  position: relative;
  padding: 140px 0 70px;
  background: var(--blue);
  border-bottom: var(--bw) solid var(--ink);
  overflow: hidden;
}
.dash-hero-inner { position: relative; z-index: 2; display: flex; flex-direction: column; align-items: flex-start; gap: 18px; }
.dash-title {
  font-family: var(--display); font-weight: 400; text-transform: uppercase;
  font-size: clamp(54px, 12vw, 128px); line-height: .92; letter-spacing: -3px;
}
.d-shape-1 { top: 22%; right: 20%; width: 120px; height: 120px; left: auto; }
.d-shape-2 { top: 14%; right: 6%; left: auto; width: 110px; height: 110px; }
.d-shape-3 { top: auto; bottom: 10%; right: 10%; left: auto; width: 80px; height: 80px; }

.conn {
  display: inline-flex; align-items: center; gap: 10px;
  font: 700 14px var(--mono); text-transform: uppercase;
  background: #fff; border: 3px solid var(--ink); box-shadow: 4px 4px 0 var(--ink);
  padding: 6px 14px;
}
.conn .dot { width: 14px; height: 14px; border: 3px solid var(--ink); background: var(--yellow); border-radius: 50%; }
.conn.is-online .dot  { background: var(--lime); }
.conn.is-offline .dot { background: var(--pink); }

.dash-body { padding-top: 56px; padding-bottom: 100px; display: flex; flex-direction: column; gap: 44px; }

/* ───────── stats ───────── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; }
.stat { padding: 20px 22px; display: flex; flex-direction: column; gap: 6px; min-width: 0; box-shadow: var(--shadow); }
.stat-yellow { background: var(--yellow); } .stat-pink { background: var(--pink); }
.stat-blue { background: var(--blue); }     .stat-lime { background: var(--lime); }
.stat-label { font: 700 13px var(--mono); text-transform: uppercase; }
.stat-num { font-family: var(--display); font-weight: 400; font-size: clamp(40px, 5vw, 60px); line-height: 1; letter-spacing: -2px; }
.stat-top { font: 700 22px var(--mono); line-height: 1.3; overflow-wrap: anywhere; }
.stat-top small { display: block; font-size: 14px; font-weight: 400; }

/* ───────── layout ───────── */
.grid-2 { display: grid; grid-template-columns: 1.05fr 1fr; gap: 32px; align-items: start; }
.charts { display: flex; flex-direction: column; gap: 32px; }
.panel { padding: 24px; box-shadow: var(--shadow); }
.panel-title { font-family: var(--display); font-weight: 400; text-transform: uppercase; font-size: 22px; letter-spacing: -.5px; margin-bottom: 16px; }
.count { display: inline-block; font: 700 15px var(--mono); background: var(--ink); color: #fff; padding: 0 8px; vertical-align: middle; margin-left: 6px; }

/* ───────── forms ───────── */
.tabs { display: flex; margin: -24px -24px 22px; border-bottom: var(--bw) solid var(--ink); }
.tab {
  flex: 1; padding: 14px; cursor: pointer;
  font: 400 18px var(--display); text-transform: uppercase; color: var(--ink);
  background: var(--paper); border: 0; border-right: var(--bw) solid var(--ink);
}
.tab:last-child { border-right: 0; }
.tab.is-on { background: var(--yellow); }
.tab:not(.is-on):hover { background: #fff; }

.pane { display: flex; flex-direction: column; gap: 16px; }
.pane[hidden] { display: none; }
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font: 700 13px var(--mono); text-transform: uppercase; }
.label i { font-style: normal; opacity: .6; }

.inp {
  width: 100%; font: 500 16px var(--mono); color: var(--ink);
  background: var(--paper); padding: 12px 14px;
  border: var(--bw) solid var(--ink); border-radius: 0; outline: none;
  transition: box-shadow .12s, transform .12s, background .12s;
}
textarea.inp { resize: vertical; min-height: 140px; line-height: 1.5; }
.inp::placeholder { color: #00000055; }
.inp:focus { background: #fff; box-shadow: 5px 5px 0 var(--pink); transform: translate(-2px, -2px); }
select.inp { cursor: pointer; padding-right: 10px; }

.alias-row { display: flex; }
.alias-prefix { display: grid; place-items: center; padding: 0 10px; background: var(--lime); border: var(--bw) solid var(--ink); border-right: 0; font: 700 14px var(--mono); white-space: nowrap; }

.bulk-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.hint { font: 700 13px var(--mono); }
.bar { height: 22px; border: 3px solid var(--ink); background: #fff; }
.bar i { display: block; height: 100%; width: 0; background: var(--lime); border-right: 3px solid var(--ink); transition: width .25s ease; }
.bar[hidden], .form-msg[hidden], .errs[hidden] { display: none; }
.form-msg { margin-top: 16px; font: 700 14px var(--mono); padding: 10px 14px; background: var(--pink); border: 3px solid var(--ink); }
.pane .form-msg { margin-top: 0; }
.form-msg.ok { background: var(--lime); }
.errs { font: 400 13px var(--mono); border: 3px solid var(--ink); background: #fff; padding: 8px 12px; }
.errs summary { cursor: pointer; font-weight: 700; }
.errs ul { margin: 8px 0 0 18px; max-height: 160px; overflow: auto; }

/* ───────── charts ───────── */
.chart { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 24px; border-bottom: var(--bw) solid var(--ink); }
.col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.col .bar-fill {
  width: 100%; background: var(--pink); border: 3px solid var(--ink); border-bottom: 0;
  height: 0; min-height: 0;
  transition: height .8s cubic-bezier(.2, 1.2, .3, 1);
}
.col:nth-child(3n+2) .bar-fill { background: var(--blue); }
.col:nth-child(3n) .bar-fill { background: var(--lime); }
.col .val { font: 700 11px var(--mono); margin-bottom: 3px; }
.axis { display: flex; gap: 6px; margin-top: 6px; }
.axis span { flex: 1; text-align: center; font: 700 11px var(--mono); }

.toplist { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.toplist li { display: grid; grid-template-columns: 24px 1fr; gap: 10px; align-items: center; }
.toplist .rank { font: 400 20px var(--display); }
.toplist .meta { display: flex; justify-content: space-between; gap: 10px; font: 700 13px var(--mono); margin-bottom: 4px; }
.toplist .meta span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.toplist .track { height: 18px; border: 3px solid var(--ink); background: var(--paper); }
.toplist .fill { height: 100%; width: 0; background: var(--yellow); border-right: 3px solid var(--ink); transition: width .9s cubic-bezier(.2, 1, .3, 1); }
.toplist li:nth-child(2) .fill { background: var(--pink); }
.toplist li:nth-child(3) .fill { background: var(--blue); }
.toplist li:nth-child(4) .fill { background: var(--lime); }
.toplist li:nth-child(5) .fill { background: var(--violet); }
.toplist .none { font: 500 14px var(--mono); display: block; }

/* ───────── list ───────── */
.list-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.list-head .panel-title { margin: 0; }
.toolbar { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.search { width: 260px; max-width: 100%; }
.sort { width: 210px; }
.toolbar .inp { padding: 8px 12px; font-size: 15px; }

.selbar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 14px;
  background: var(--yellow); border: var(--bw) solid var(--ink);
  font: 700 14px var(--mono);
}
.selbar[hidden] { display: none; }

.row {
  display: grid;
  grid-template-columns: 34px minmax(170px, 1.1fr) minmax(0, 2fr) 84px 70px 132px;
  align-items: center; gap: 14px;
  padding: 12px 8px;
  border-bottom: 3px solid var(--ink);
  font-size: 15px;
}
.row.head { font: 700 12px var(--mono); text-transform: uppercase; background: var(--ink); color: #fff; border-bottom: 0; padding-block: 8px; }
.row:not(.head):hover { background: #fffbe9; }
.row.is-sel { background: #ffeaf2; }
.row.is-new { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: var(--lime); } }

.row .meta { display: contents; }
.r-short { font: 700 15px var(--mono); min-width: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.r-short a { color: var(--ink); text-decoration-thickness: 3px; text-underline-offset: 3px; text-decoration-color: var(--pink); overflow-wrap: anywhere; }
.r-url { font: 400 13px var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; color: #333; }
.r-url a { color: inherit; }
.r-date { font: 400 13px var(--mono); }
.r-clicks { font: 400 20px var(--display); }
.r-actions { display: flex; gap: 8px; justify-content: flex-end; }
.badge { font: 700 10px var(--mono); background: var(--violet); border: 2px solid var(--ink); padding: 0 5px; }

.ibtn {
  width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer;
  font: 700 16px var(--mono); line-height: 1; color: var(--ink); text-decoration: none;
  background: #fff; border: 3px solid var(--ink); box-shadow: 3px 3px 0 var(--ink);
  transition: transform .1s, box-shadow .1s, background .1s;
}
.ibtn:hover { background: var(--yellow); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.ibtn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.ibtn.del:hover { background: var(--pink); }

/* custom checkbox */
.check { position: relative; width: 24px; height: 24px; display: block; cursor: pointer; }
.check input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; }
.check i { position: absolute; inset: 0; background: #fff; border: 3px solid var(--ink); }
.head .check i { border-color: #fff; background: transparent; }
.check input:checked + i { background: var(--lime); }
.check input:checked + i::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; font: 700 16px var(--mono); color: var(--ink); }
.check input:focus-visible + i { outline: 4px solid var(--violet); outline-offset: 2px; }
.head .check input:checked + i { background: var(--lime); border-color: var(--lime); }

.empty { text-align: center; padding: 48px 16px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty[hidden], .more[hidden], .demo-note[hidden] { display: none; }
.empty-title { font: 400 28px var(--display); text-transform: uppercase; }
.more { display: flex; gap: 20px; align-items: center; justify-content: center; margin-top: 26px; flex-wrap: wrap; }
.demo-note { margin-top: 22px; padding: 10px 14px; background: var(--violet); border: 3px solid var(--ink); font: 700 14px var(--mono); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 80;
  translate: -50% 260%;
  opacity: 0; visibility: hidden;
  background: var(--ink); color: #fff;
  font: 700 15px var(--mono);
  padding: 12px 20px; border: 3px solid var(--ink); box-shadow: 5px 5px 0 var(--pink);
  transition: translate .4s cubic-bezier(.2, 1.2, .3, 1), opacity .25s, visibility 0s .4s;
  max-width: calc(100% - 28px);
}
.toast.show { translate: -50% 0; opacity: 1; visibility: visible; transition-delay: 0s; }

/* ───────── responsive ───────── */
@media (max-width: 980px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
  .d-shape-1 { display: none; }
}
@media (max-width: 760px) {
  .row.head { display: none; }
  .row {
    grid-template-columns: 30px 1fr auto;
    grid-template-areas: "ck short act" ". url url" ". meta meta";
    gap: 6px 10px; padding: 14px 6px;
  }
  .row .check { grid-area: ck; }
  .row .r-short { grid-area: short; }
  .row .r-url { grid-area: url; }
  .row .r-actions { grid-area: act; }
  .row .meta { grid-area: meta; display: flex; gap: 14px; align-items: baseline; }
  .row .meta .r-clicks { font-size: 17px; }
  .search, .sort { width: 100%; }
  .toolbar { width: 100%; }
  .toolbar .btn { width: 100%; }
  .dash-hero { padding-top: 120px; }
  .panel { padding: 18px; }
  .tabs { margin: -18px -18px 20px; }
  .d-shape-2 { width: 70px; height: 70px; top: 12%; right: -12px; }
  .d-shape-3 { display: none; }
}
@media (max-width: 480px) {
  .stats { gap: 18px; }
  .stat { padding: 14px; }
  .stat-top { font-size: 17px; }
  .chart { gap: 3px; }
  .axis { gap: 3px; }
  .axis span:nth-child(even) { visibility: hidden; }
}

/* create panel follows the scroll beside the taller charts column */
.grid-2 > .panel:first-child { position: sticky; top: 104px; }
@media (max-width: 980px) { .grid-2 > .panel:first-child { position: static; } }
.d-shape-1 { background: var(--yellow); }
