/* TWIY: monochrome, black background */
:root {
  --bg: #000;
  --surface: #0a0a0a;
  --hover: #111;
  --border: #1c1c1c;
  --border-strong: #3a3a3a;
  --text: #f5f5f5;
  --muted: #7c7c7c;
  --faint: #4a4a4a;
  --error: #ff6b6b;
  --radius: 12px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 Manrope, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--text); text-decoration: none; }
h1 { font-size: 32px; font-weight: 500; letter-spacing: -.8px; margin: 0 0 4px; }
h2 { font-size: 17px; font-weight: 500; margin: 0 0 6px; }
.muted { color: var(--muted); margin: 0; }
.icon { width: 20px; height: 20px; flex-shrink: 0; }
::selection { background: #fff; color: #000; }

/* ---------- Layout ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px;
  border-right: 1px solid var(--border);
  padding: 28px 14px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--bg);
}
.brand { font-weight: 600; font-size: 15px; letter-spacing: 6px; padding: 0 12px 32px; }
.sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 8px; color: var(--muted);
  transition: color .15s, background .15s;
}
.sidebar nav a:hover { color: var(--text); }
.sidebar nav a.active { color: var(--text); background: var(--hover); }
.logout {
  display: flex; align-items: center; justify-content: space-between;
  border-top: 1px solid var(--border); padding: 16px 12px 0;
}
.who { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  background: none; border: 0; color: var(--muted); cursor: pointer;
  padding: 6px; border-radius: 8px; display: flex;
}
.icon-btn:hover { color: var(--text); background: var(--hover); }
.content { flex: 1; min-width: 0; padding: 72px 64px; max-width: 1180px; }

/* ---------- Dashboard ---------- */
.eyebrow { color: var(--muted); font-size: 13px; margin: 0 0 12px; min-height: 1.5em; }
.hero { font-size: 56px; font-weight: 300; letter-spacing: -1.2px; line-height: 1.05; margin: 0; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 56px;
}
.tile, .card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--bg);
}
.tile {
  display: flex; flex-direction: column; gap: 4px;
  transition: border-color .2s, background .2s;
}
.tile:hover { border-color: var(--border-strong); background: var(--surface); }
.tile-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; }
.arrow { color: var(--muted); opacity: 0; transform: translateX(-6px); transition: opacity .2s, transform .2s; }
.tile:hover .arrow { opacity: 1; transform: none; }
.badge {
  align-self: flex-start; margin-top: 18px;
  font-size: 12px; color: var(--faint);
}
.tile-icon { color: var(--text); margin-bottom: 20px; }
.empty { margin-top: 40px; display: flex; flex-direction: column; align-items: center; padding: 64px; color: var(--muted); }
.empty .tile-icon { margin-bottom: 12px; }

/* ---------- Forms ---------- */
.form-card { margin-top: 40px; max-width: 440px; display: flex; flex-direction: column; gap: 16px; }
label { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--muted); }
input {
  font: inherit; color: var(--text); background: transparent;
  border: 1px solid var(--border); border-radius: 8px; padding: 11px 13px;
  transition: border-color .15s;
}
input:hover { border-color: var(--border-strong); }
input:focus { outline: none; border-color: var(--text); }
/* Chrome/Safari paint autofilled fields blue; delay that change indefinitely
   so the field stays transparent. */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  transition: background-color 99999s ease-in-out 0s;
}
.btn {
  font: inherit; font-weight: 500; cursor: pointer;
  background: var(--text); color: #000; border: 0; border-radius: 8px; padding: 11px 16px;
  transition: opacity .15s;
}
.btn:hover { opacity: .85; }
.alert { padding: 10px 13px; border-radius: 8px; font-size: 14px; border: 1px solid var(--border); }
.alert.error { color: var(--error); border-color: rgba(255, 107, 107, .3); }
.alert.success { color: var(--text); border-color: var(--border-strong); }

/* ---------- Login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 16px; position: relative; overflow: hidden; }
.auth-form { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 16px; position: relative; z-index: 1; }
.watermark {
  position: absolute; inset: 0; display: grid; place-items: center;
  font-weight: 800; font-size: min(36vw, 460px); letter-spacing: -.04em; line-height: 1;
  color: #0d0d0d; user-select: none; pointer-events: none;
}
.greeting {
  margin: 8px 0 20px; text-align: center;
  font-size: 32px; font-weight: 300; letter-spacing: -1px;
}

/* ---------- Mobile ---------- */
@media (max-width: 760px) {
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; height: auto; position: sticky; z-index: 1;
    flex-direction: row; align-items: center; padding: 12px 12px;
    border-right: 0; border-bottom: 1px solid var(--border);
  }
  .brand { padding: 0 12px 0 4px; letter-spacing: 4px; }
  .sidebar nav { flex-direction: row; gap: 0; overflow-x: auto; }
  .sidebar nav a { padding: 9px 10px; }
  .sidebar nav a span { display: none; }
  .logout { border: 0; padding: 0; }
  .who { display: none; }
  .content { padding: 40px 16px; }
  .hero { font-size: 40px; letter-spacing: -1.5px; }
  .grid { margin-top: 36px; }
}

/* ---------- Short links ---------- */
.badge.ready { color: var(--text); }
.badge.ready::before { content: "●"; margin-right: 6px; font-size: 9px; vertical-align: 2px; }
.cleaner { margin-top: 32px; padding: 24px; }
.cleaner input { width: 100%; font-size: 16px; padding: 14px 16px; }
.clean-result { margin-top: 16px; }
.clean-line { display: flex; align-items: center; gap: 12px; }
.clean-output {
  flex: 1; min-width: 0; font-size: 16px; padding: 13px 16px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border); word-break: break-all;
}
.clean-output.error-text { color: var(--error); }
.clean-info { font-size: 13px; margin-top: 10px; }
.list-title { font-size: 14px; font-weight: 500; margin: 48px 0 0; }
.link-list { margin-top: 12px; border-top: 1px solid var(--border); }
.link-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 4px; border-bottom: 1px solid var(--border); transition: background .15s;
}
.link-row:hover { background: var(--surface); }
.link-main { min-width: 0; }
.link-short { font-weight: 500; font-size: 16px; }
.link-target { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-count { text-align: right; flex-shrink: 0; }
.link-count b { display: block; font-weight: 500; font-size: 20px; }
.link-count span { font-size: 12px; }

.back { font-size: 14px; display: inline-block; margin-bottom: 24px; }
.back:hover { color: var(--text); }
.link-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.link-head h1 { font-weight: 300; font-size: 44px; letter-spacing: -1px; margin: 0; }
.link-target-full { margin-top: 6px; word-break: break-all; }
.ghost-btn {
  font: inherit; font-size: 13px; cursor: pointer; background: none;
  color: var(--text); border: 1px solid var(--border-strong); border-radius: 8px; padding: 7px 14px;
}
.ghost-btn:hover { border-color: var(--text); }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 40px; }
.stat { border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; }
.stat b { display: block; font-weight: 300; font-size: 40px; letter-spacing: -1px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 13px; }

.panel-block { border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 24px; margin-top: 16px; }
.panel-block h2 { font-size: 14px; font-weight: 500; margin: 0 0 18px; }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 140px; }
.bar { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.bar i { display: block; width: 100%; min-height: 2px; background: var(--text); border-radius: 2px 2px 0 0; opacity: .9; }
.bar:hover i { opacity: 1; background: #fff; }
.chart-axis { display: flex; justify-content: space-between; font-size: 12px; margin-top: 8px; }

.bd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0 16px; }
.bd-row { margin-bottom: 12px; }
.bd-label { display: flex; justify-content: space-between; font-size: 14px; margin-bottom: 5px; }
.bd-bar { height: 3px; background: var(--border); border-radius: 2px; }
.bd-bar i { display: block; height: 100%; background: var(--text); border-radius: 2px; }

.table-wrap { overflow-x: auto; }
.recent { width: 100%; border-collapse: collapse; font-size: 14px; }
.recent td { padding: 9px 12px 9px 0; border-top: 1px solid var(--border); white-space: nowrap; }
.recent tr:first-child td { border-top: 0; }

.edit-link { display: flex; flex-direction: column; gap: 14px; max-width: 520px; }
.attribution { font-size: 12px; margin-top: 24px; }
.attribution a { color: var(--muted); text-decoration: underline; }

@media (max-width: 760px) {
  .clean-line { flex-direction: column; align-items: stretch; }
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .link-head h1 { font-size: 30px; }
  .chart { gap: 2px; }
}
.empty-links { padding: 18px 4px; margin: 0; }

/* ---------- Ad blocker ---------- */
.switch-card {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; margin-top: 32px;
}
.switch-state { font-size: 20px; font-weight: 500; margin-bottom: 4px; }
.switch {
  flex-shrink: 0; width: 56px; height: 32px; border-radius: 999px; cursor: pointer; padding: 0;
  background: var(--border); border: 1px solid var(--border-strong); position: relative; transition: background .2s;
}
.switch i {
  position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--muted); transition: transform .2s, background .2s;
}
.switch.on { background: var(--text); border-color: var(--text); }
.switch.on i { transform: translateX(24px); background: #000; }
.stat-row-3 { grid-template-columns: repeat(3, 1fr); }
.setup .panel-block { padding: 0; }
.setup summary { cursor: pointer; padding: 18px 24px; font-weight: 500; list-style: none; display: flex; justify-content: space-between; }
.setup summary::-webkit-details-marker { display: none; }
.setup summary::after { content: "+"; color: var(--muted); }
.setup details[open] summary::after { content: "−"; }
.setup ol { margin: 0; padding: 0 24px 4px 44px; color: var(--muted); line-height: 1.7; }
.setup ol b { color: var(--text); font-weight: 500; }
.btn-inline { display: inline-block; margin: 12px 24px 22px; }
@media (max-width: 760px) {
  .stat-row-3 { grid-template-columns: 1fr 1fr; }
}
