/* WordHoard - neobrutalist sky theme
   Palette and shapes follow neobrutalism.dev's sky styling and dashboard
   block: sky background, white panels, 2px ink borders, 4px hard shadows. */

:root {
  --bg: hsl(207, 89%, 93%);
  --panel: #ffffff;
  --panel-2: #eaf5ff;
  --ink: #000000;
  --muted: #3f5b73;
  --main: hsl(204, 100%, 50%);
  --main-soft: #bfe9ff;
  --yellow: #facc00;
  --pink: #ff4d50;
  --green: #05e17a;
  --violet: #7a83ff;
  --border: #000000;
  --shadow: 4px 4px 0 0 var(--border);
  --shadow-sm: 2px 2px 0 0 var(--border);
  --shadow-lg: 6px 6px 0 0 var(--border);
  --radius: 5px;
  --dot: rgba(0, 0, 0, 0.11);
  --font: "Public Sans", "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-theme="sepia"] {
  --bg: #efe4cf;
  --panel: #fbf4e4;
  --panel-2: #f2e7d1;
  --ink: #3b2e25;
  --muted: #6c5a49;
  --main: #d99a4e;
  --main-soft: #efdbc0;
  --yellow: #e4b84a;
  --pink: #c97a67;
  --green: #91a66d;
  --violet: #a392b5;
  --border: #4b3a2c;
  --dot: rgba(75, 58, 44, 0.12);
  --shadow: 4px 4px 0 0 var(--border);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0;
}

p { margin: 0; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }

svg {
  width: 18px;
  height: 18px;
  flex: none;
}

::selection {
  background: var(--yellow);
  color: #000;
}

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

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-weight: 700;
  text-decoration: none;
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

/* ---------- layout ---------- */

.app {
  display: grid;
  grid-template-columns: 276px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 20px 16px;
  background: var(--panel);
  border-right: 2px solid var(--border);
  overflow: hidden;
}

.sidebar-scroll {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 20px;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  padding-right: 2px;
}

.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -0.045em;
  line-height: 1;
}

.brand em {
  font-style: normal;
  color: var(--main);
  text-shadow: 1px 1px 0 var(--border);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: var(--main);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: #00131f;
}

.brand-mark svg {
  width: 20px;
  height: 20px;
  stroke-width: 2.6;
  fill: #00131f;
}

.sidebar-close {
  display: none;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-label {
  margin: 0 0 6px 4px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease), background 0.12s;
}

.nav-item svg {
  width: 17px;
  height: 17px;
}

.nav-item:hover {
  background: var(--bg);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  transform: translate(-1px, -1px);
}

.nav-item.is-active {
  background: var(--main);
  border-color: var(--border);
  box-shadow: 3px 3px 0 0 var(--border);
  color: #00131f;
}

.nav-item.is-active .pill {
  background: #fff;
  color: #000;
}

.nav-item .pill {
  margin-left: auto;
  min-width: 24px;
  padding: 0 6px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  line-height: 18px;
}

.as-button {
  border: 2px solid transparent;
  background: none;
  font-family: inherit;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.nav-parent {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.nav-parent:hover .nav-caret { opacity: 0.9; }

.nav-caret { transition: transform 0.15s var(--ease); }

.nav-group.is-collapsed .nav-caret { transform: rotate(-90deg); }
.nav-group.is-collapsed .subnav { display: none; }

.nav-parent svg {
  width: 17px;
  height: 17px;
}

.nav-caret {
  display: inline-flex;
  margin-left: auto;
  opacity: 0.45;
}

.nav-caret svg { width: 14px; height: 14px; }

.nav-parent .pill {
  margin-left: 0;
  min-width: 24px;
  padding: 0 6px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
  line-height: 18px;
}

.subnav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0 0 4px 16px;
  padding-left: 12px;
  border-left: 2px solid var(--border);
}

.nav-subitem {
  display: flex;
  align-items: center;
  padding: 5px 9px;
  border: 1.5px solid transparent;
  border-radius: 4px;
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.1s var(--ease), box-shadow 0.1s var(--ease), background 0.1s;
}

.nav-subitem:hover {
  color: var(--ink);
  background: var(--bg);
  border-color: var(--border);
  box-shadow: 1.5px 1.5px 0 0 var(--border);
  transform: translate(-1px, -1px);
}

.nav-subitem.is-active {
  background: var(--main);
  border-color: var(--border);
  box-shadow: 2px 2px 0 0 var(--border);
  color: #00131f;
}

form { margin: 0; }

.tag-block {
  min-height: 0;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 190px;
  overflow-y: auto;
  padding: 2px;
  scrollbar-width: thin;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  box-shadow: 1.5px 1.5px 0 0 var(--border);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  line-height: 1.5;
  transition: transform 0.1s var(--ease), box-shadow 0.1s var(--ease);
}

.tag:hover {
  transform: translate(-1px, -1px);
  box-shadow: 2.5px 2.5px 0 0 var(--border);
}

.tag.is-active {
  background: var(--main);
  color: #00131f;
}

.tag-count {
  font-size: 10px;
  opacity: 0.65;
}

.tag-sm {
  font-size: 11px;
  padding: 1px 7px;
}

.sidebar-foot {
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 4px;
  padding-top: 12px;
  border-top: 1.5px solid var(--border);
}

.queue-card {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-bottom: 10px;
  padding: 10px 12px;
  background: var(--yellow);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  color: #000;
}

.queue-card.is-empty {
  background: hsl(204, 100%, 50%);
  color: #00131f;
}

.queue-card .eyebrow {
  font-size: 9.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 800;
  opacity: 0.7;
}

.queue-card strong {
  font-size: 16px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.queue-card span:last-child {
  font-size: 11.5px;
  font-weight: 600;
  opacity: 0.8;
}

.eyebrow {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- top bar ---------- */

.main-col {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 68px;
  padding: 0 26px;
  background: var(--panel);
  border-bottom: 2px solid var(--border);
}

.page-title {
  font-size: 23px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.035em;
  flex: 0 1 auto;
}

.menu-btn {
  display: none;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1 1 260px;
  max-width: 460px;
  margin-left: auto;
  height: 42px;
  padding: 0 12px;
  background: var(--panel-2);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 2px 2px 0 0 var(--border);
  transition: box-shadow 0.12s;
}

.search:focus-within {
  box-shadow: 2px 2px 0 0 var(--border), 0 0 0 3px var(--yellow);
}

.search-icon {
  display: flex;
  color: var(--muted);
}

.search input[type="search"] {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
}

.search input::placeholder {
  color: var(--muted);
  opacity: 0.75;
}

.search input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: var(--panel);
  color: var(--ink);
}

.search-clear svg {
  width: 12px;
  height: 12px;
}

.theme-btn {
  margin-left: 0;
}

.topbar-nosearch .theme-btn {
  margin-left: auto;
}

.theme-btn .theme-icon-normal,
.theme-btn .theme-icon-reading {
  display: none;
}

.theme-btn .theme-icon-normal {
  display: inline-flex;
}

[data-theme="sepia"] .theme-btn .theme-icon-normal {
  display: none;
}

[data-theme="sepia"] .theme-btn .theme-icon-reading {
  display: inline-flex;
}

.content {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 26px 80px;
}

/* ---------- controls ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: transform 0.12s var(--ease), box-shadow 0.12s var(--ease);
}

.btn svg { width: 17px; height: 17px; }

.btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 5px 5px 0 0 var(--border);
}

.btn:active {
  transform: translate(3px, 3px);
  box-shadow: 1px 1px 0 0 var(--border);
}

.btn-primary {
  background: var(--main);
  color: #00131f;
  font-weight: 800;
}

.btn-yellow {
  background: var(--yellow);
  color: #000;
}

.btn-green {
  background: var(--green);
  color: #00170b;
}

.btn-danger {
  background: var(--pink);
  color: #230000;
}

.btn-sm {
  padding: 7px 10px;
  font-size: 13px;
  box-shadow: 3px 3px 0 0 var(--border);
}

.btn-sm:hover { box-shadow: 4px 4px 0 0 var(--border); }
.btn-sm:active { box-shadow: 1px 1px 0 0 var(--border); }

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  box-shadow: 2px 2px 0 0 var(--border);
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.1s var(--ease), box-shadow 0.1s var(--ease), background 0.1s;
}

.icon-btn svg { width: 17px; height: 17px; }

.icon-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 0 var(--border);
}

.icon-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 0 var(--border);
}

.icon-btn.is-on {
  background: var(--main);
  color: #00131f;
}

.icon-off { display: inline-flex; }
.icon-on { display: none; }
.is-on .icon-off { display: none; }
.is-on .icon-on { display: inline-flex; }

.star-btn.is-on {
  background: var(--yellow);
  color: #000;
}

.star-btn.is-on svg {
  fill: #000;
}

.icon-btn.menu-btn,
.icon-btn.sidebar-close {
  display: none;
}

.icon-btn.sm {
  width: 30px;
  height: 30px;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 2px 2px 0 0 var(--border);
}

.icon-btn.sm svg { width: 14px; height: 14px; }

.input,
.select {
  width: 100%;
  height: 42px;
  padding: 9px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 3px 3px 0 0 var(--border);
  outline: none;
  transition: box-shadow 0.12s;
}

.input:focus,
.select:focus {
  box-shadow: 3px 3px 0 0 var(--border), 0 0 0 3px var(--yellow);
}

.input::placeholder { color: var(--muted); opacity: 0.7; }

.select {
  appearance: none;
  -webkit-appearance: none;
  width: auto;
  min-width: 150px;
  padding-right: 34px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 14px;
  cursor: pointer;
}

[data-theme="sepia"] .select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234b3a2c' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

.mono,
.code-block,
pre,
code {
  font-family: var(--mono);
}

.micro {
  margin-top: 10px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}

.micro code,
.lead code {
  padding: 1px 4px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--panel-2);
  font-size: 0.92em;
}

/* ---------- cards / add form ---------- */

.card {
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.add-card {
  position: relative;
  padding: 18px 20px 16px;
  margin-bottom: 24px;
  overflow: hidden;
}

.add-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 7px;
  background: var(--main);
  border-right: 2px solid var(--border);
}

.add-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.add-title {
  margin-top: 2px;
  font-size: 21px;
  letter-spacing: -0.035em;
}

.add-badge {
  padding: 3px 9px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--yellow);
  box-shadow: 2px 2px 0 0 var(--border);
  color: #000;
  font-size: 11px;
  font-weight: 800;
}

.add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 230px) auto;
  gap: 10px;
  margin-top: 14px;
}

.add-form.two {
  grid-template-columns: minmax(0, 1fr) auto;
}

.add-url,
.add-tags {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  display: flex;
  color: var(--muted);
  pointer-events: none;
}

.input-icon svg { width: 16px; height: 16px; }

.add-form input[type="url"],
.add-form input[type="text"] {
  width: 100%;
  height: 46px;
  padding: 10px 12px 10px 38px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  box-shadow: 3px 3px 0 0 var(--border);
  outline: none;
  transition: box-shadow 0.12s, background 0.12s;
}

.add-form input:focus {
  background: var(--panel);
  box-shadow: 3px 3px 0 0 var(--border), 0 0 0 3px var(--yellow);
}

.add-submit {
  height: 46px;
}

.add-submit.is-loading {
  background: var(--violet);
  pointer-events: none;
}

.add-submit.is-loading svg {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.add-hint {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

/* ---------- toolbar ---------- */

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tab {
  padding: 7px 13px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 2px 2px 0 0 var(--border);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.1s var(--ease), box-shadow 0.1s var(--ease);
}

.tab:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 0 var(--border);
}

.tab.is-active {
  background: var(--main);
  color: #00131f;
  box-shadow: 3px 3px 0 0 var(--border);
}

.sort-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

.toolbar-actions form {
  display: inline-flex;
}

.toolbar-note {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.toolbar-note svg { width: 15px; height: 15px; }

.tab-count {
  margin-left: 5px;
  font-size: 10px;
  font-weight: 800;
  opacity: 0.65;
}

.badge-rss {
  background: var(--main-soft);
}

[data-theme="sepia"] .badge-rss {
  background: var(--main-soft);
  color: var(--ink);
}

.article-kicker .badge {
  padding: 1px 5px;
  font-size: 9px;
}

.subs-page {
  margin: 0 0 24px;
  overflow: hidden;
}

.subs-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border-bottom: 2px solid var(--border);
}

.subs-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 20px;
}

.subs-heading svg { width: 18px; height: 18px; }

.subs-lead {
  margin-top: 4px;
  font-size: 12.5px;
  color: var(--muted);
}

.subs-lead a { font-weight: 700; text-underline-offset: 2px; }

.subs-head-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.subs-page .subs-body {
  padding: 6px 20px 16px;
  border-top: 0;
}

.subs-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 42px 24px 48px;
  text-align: center;
}

.subs-empty h2 { font-size: 21px; }

.subs-empty p {
  max-width: 46ch;
  font-size: 13px;
  color: var(--muted);
}

.subs-empty p a { font-weight: 700; text-underline-offset: 2px; }

.subs {
  margin-bottom: 24px;
  overflow: hidden;
}

.subs summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  list-style: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.subs summary::-webkit-details-marker { display: none; }

.subs-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.subs-title svg { width: 16px; height: 16px; }

.subs-hint {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.subs-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 16px 14px;
  border-top: 2px solid var(--border);
}

.subs-actions {
  display: flex;
  justify-content: flex-end;
}

.sub-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1.5px dashed var(--border);
}

.sub-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.sub-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.sub-title {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub-title:hover { text-decoration: underline; text-underline-offset: 2px; }

.sub-meta {
  overflow: hidden;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub-error { color: var(--pink); font-weight: 700; }

.sub-actions {
  display: flex;
  gap: 5px;
}

.sub-actions form { display: inline-flex; }

.notify-btn.is-on {
  background: var(--green);
  color: #00170b;
}

.filter-note {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--main-soft);
}

.filter-note span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
}

.filter-note a {
  font-size: 12px;
  font-weight: 800;
  text-underline-offset: 2px;
}

.result-count {
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--muted);
}

/* ---------- article list ---------- */

.article-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.article-card {
  position: relative;
  display: flex;
  gap: 16px;
  padding: 16px 18px 16px 20px;
  overflow: hidden;
  transition: transform 0.13s var(--ease), box-shadow 0.13s var(--ease), opacity 0.2s;
}

.article-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  background: var(--main);
  border-right: 2px solid var(--border);
  opacity: 0;
  transition: opacity 0.13s;
}

.article-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-lg);
}

.article-card:hover::before { opacity: 1; }

.article-card.is-read { background: var(--panel-2); }
.article-card.is-read .article-title a { opacity: 0.82; }
.article-card.is-read .dot-marker { background: var(--green); }

.article-card.is-removing {
  opacity: 0;
  transform: translateX(30px);
}

.article-main {
  flex: 1;
  min-width: 0;
}

.article-kicker {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.dot-marker {
  width: 8px;
  height: 8px;
  border: 1.5px solid var(--border);
  border-radius: 50%;
  background: var(--main);
}

.article-kicker .domain {
  color: var(--ink);
  letter-spacing: 0.02em;
}

.sep { opacity: 0.45; }

.read-time {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.read-time svg { width: 12px; height: 12px; }

.article-title {
  margin: 6px 0 5px;
  font-size: clamp(17px, 1.8vw, 21px);
  line-height: 1.22;
  letter-spacing: -0.025em;
}

.article-title a {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--yellow), var(--yellow));
  background-repeat: no-repeat;
  background-size: 0 40%;
  background-position: 0 88%;
  transition: background-size 0.18s var(--ease);
}

.article-title a:hover {
  background-size: 100% 40%;
}

.article-excerpt {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.article-thumb {
  width: 92px;
  height: 74px;
  flex: none;
  object-fit: cover;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--panel-2);
  box-shadow: 2px 2px 0 0 var(--border);
}

.article-actions {
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
  align-self: center;
  flex: none;
}

.article-actions form { display: inline-flex; }

.article-actions .icon-btn {
  width: 32px;
  height: 32px;
}

.article-actions .icon-btn svg { width: 15px; height: 15px; }


/* ---------- empty state ---------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px 24px;
  text-align: center;
  border-style: dashed;
  box-shadow: none;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  margin-bottom: 4px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--main);
  box-shadow: var(--shadow-sm);
  color: #00131f;
}

.empty-icon svg { width: 26px; height: 26px; }

.empty h2 {
  font-size: 22px;
  letter-spacing: -0.03em;
}

.empty p {
  max-width: 44ch;
  font-size: 13.5px;
  color: var(--muted);
}

.empty a { font-weight: 700; text-underline-offset: 2px; }

/* ---------- pager ---------- */

.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.link-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: transform 0.13s var(--ease), box-shadow 0.13s var(--ease);
}

.link-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-lg);
}

.link-thumb {
  position: relative;
  display: grid;
  place-items: center;
  height: 150px;
  overflow: hidden;
  border-bottom: 2px solid var(--border);
  background: var(--panel-2);
}

.link-thumb-fallback {
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background-image: radial-gradient(var(--dot) 1.5px, transparent 1.6px);
  background-size: 12px 12px;
  color: #00131f;
  font-size: 44px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.link-thumb-empty .link-thumb-fallback,
.link-thumb.is-missing .link-thumb-fallback {
  display: flex;
}

.link-thumb.is-missing img {
  display: none;
}

.link-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.link-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 7px;
  padding: 14px 16px;
}

.link-kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.link-kicker .domain {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.link-kicker .badge {
  padding: 1px 6px;
  font-size: 9px;
}

.domain-avatar.sm {
  width: 28px;
  height: 28px;
  border-width: 1.5px;
  border-radius: 4px;
  box-shadow: 1.5px 1.5px 0 0 var(--border);
  font-size: 12px;
}

.link-title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 18px;
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.link-title a {
  color: var(--ink);
  text-decoration: none;
  background-image: linear-gradient(var(--yellow), var(--yellow));
  background-repeat: no-repeat;
  background-size: 0 40%;
  background-position: 0 88%;
  transition: background-size 0.18s var(--ease);
}

.link-title a:hover {
  background-size: 100% 40%;
}

.link-desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.link-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1.5px dashed var(--border);
}

.link-foot form { display: inline-flex; }

.link-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.danger-btn { background: var(--panel); }

.danger-btn:hover {
  background: var(--pink);
  color: #230000;
}

.link-empty { grid-column: 1 / -1; }

@media (max-width: 700px) {
  .link-grid { grid-template-columns: 1fr; }
  .link-thumb { height: 170px; }
  .link-card:hover { transform: none; }
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

.pager-step.is-disabled {
  visibility: hidden;
}

.pager-pages {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.pager-page {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 32px;
  padding: 0 8px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  box-shadow: 2px 2px 0 0 var(--border);
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.pager-page:hover {
  transform: translate(-1px, -1px);
  box-shadow: 3px 3px 0 0 var(--border);
}

.pager-page.is-active {
  background: var(--main);
  color: #00131f;
}


.pager-count {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

/* ---------- flash ---------- */

.flash {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: #bcffda;
  box-shadow: var(--shadow-sm);
  color: #00170b;
  font-size: 13.5px;
  font-weight: 700;
}

.flash svg { width: 17px; height: 17px; }

.flash-warn {
  background: #ffe08a;
  color: #241800;
}

[data-theme="sepia"] .flash { background: #e4e9cc; color: #2f3a22; }
[data-theme="sepia"] .flash-warn { background: #f2dfb6; color: #3b2e1a; }

/* ---------- reader ---------- */

.progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 60;
  height: 5px;
  width: 0;
  background: var(--main);
  border-right: 2px solid var(--border);
  opacity: 0;
  transition: width 0.08s linear, opacity 0.15s;
}

.reader-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  max-width: 880px;
  margin: 0 auto 14px;
}

.back-btn { background: var(--panel); }

.reader-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.control-group {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.control-group .icon-btn {
  border: 0;
  box-shadow: none;
  background: transparent;
  width: 30px;
  height: 28px;
}

.control-group .icon-btn.is-on {
  background: var(--main);
  color: #00131f;
}

.control-group .icon-btn:hover {
  background: var(--panel-2);
}

.wide-btn {
  width: auto !important;
  padding: 0 8px !important;
  font-size: 9px !important;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.reader {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(20px, 3.4vw, 46px);
  --reader-font: 18.5px;
  --reader-width: 70ch;
}

[data-reader-size="sm"] .reader { --reader-font: 16px; }
[data-reader-size="lg"] .reader { --reader-font: 21px; }
[data-reader-width="narrow"] .reader { --reader-width: 56ch; }
[data-reader-width="wide"] .reader { --reader-width: 78ch; }

.reader-head {
  padding-bottom: 20px;
  margin-bottom: 24px;
  border-bottom: 2px solid var(--border);
}

.reader-kicker {
  display: flex;
  align-items: center;
  gap: 10px;
}

.domain-avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 2px 2px 0 0 var(--border);
  color: #00131f;
  font-size: 18px;
  font-weight: 800;
}

.tone-0 { background: var(--main); }
.tone-1 { background: var(--yellow); }
.tone-2 { background: var(--green); }
.tone-3 { background: var(--pink); }
.tone-4 { background: var(--violet); }

.reader-source {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.reader-source .domain {
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.source-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.reader-title {
  margin: 16px 0 10px;
  font-size: clamp(26px, 4vw, 43px);
  line-height: 1.06;
  letter-spacing: -0.038em;
}

.reader-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.meta-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 700;
  text-underline-offset: 3px;
}

.meta-link svg { width: 13px; height: 13px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--ink);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.badge svg { width: 12px; height: 12px; }
.badge-green { background: #bcffda; color: #00170b; }
.badge-yellow { background: var(--yellow); color: #000; }

[data-theme="sepia"] .badge-green { background: #dce7c5; color: #2f3a22; }

.reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.reader-actions form { display: inline-flex; }

.reader-hero {
  display: block;
  width: 100%;
  max-height: 340px;
  object-fit: cover;
  margin: 0 0 26px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: var(--panel-2);
}

/* ---------- prose ---------- */

.prose {
  max-width: var(--reader-width);
  margin: 0 auto;
  font-size: var(--reader-font);
  line-height: 1.72;
  overflow-wrap: anywhere;
}

.prose > :first-child { margin-top: 0; }

.prose p,
.prose ul,
.prose ol,
.prose dl,
.prose table,
.prose figure {
  margin: 0 0 1.2em;
}

.prose h1,
.prose h2,
.prose h3,
.prose h4 {
  margin: 1.7em 0 0.55em;
  line-height: 1.16;
  letter-spacing: -0.025em;
}

.prose h1 { font-size: 1.65em; }
.prose h2 { font-size: 1.4em; }
.prose h3 { font-size: 1.2em; }
.prose h4 { font-size: 1.05em; }

.prose a {
  color: #0064a8;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 2px;
  font-weight: 600;
}

[data-theme="sepia"] .prose a { color: #8a4b1f; }
[data-theme="sepia"] .prose {
  font-family: Georgia, "Iowan Old Style", "Palatino Linotype", "Times New Roman", serif;
}

.prose strong, .prose b { font-weight: 800; }

.prose blockquote {
  margin: 1.4em 0;
  padding: 14px 18px;
  border: 2px solid var(--border);
  border-left: 7px solid var(--main);
  border-radius: var(--radius);
  background: var(--panel-2);
  box-shadow: 3px 3px 0 0 var(--border);
  font-weight: 600;
}

.prose blockquote > :last-child { margin-bottom: 0; }

.prose pre {
  margin: 1.3em 0;
  padding: 15px 16px;
  overflow-x: auto;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: #10131f;
  box-shadow: var(--shadow-sm);
  color: #e9eefc;
  font-size: 0.82em;
  line-height: 1.55;
}

.prose pre code {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-size: 1em;
}

.prose code {
  padding: 1px 5px;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: var(--panel-2);
  font-size: 0.88em;
}

.prose img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 1.4em 0;
  border: 2px solid var(--border);
  border-radius: 4px;
  box-shadow: var(--shadow-sm);
  background: #fff;
}

.prose figure { margin: 1.5em 0; }
.prose figure img { margin: 0 0 6px; }

.prose figcaption {
  font-size: 0.78em;
  color: var(--muted);
  text-align: center;
}

.prose hr {
  margin: 2.2em 0;
  border: 0;
  border-top: 2px dashed var(--border);
}

.prose ul, .prose ol { padding-left: 1.45em; }
.prose li { margin: 0.35em 0; }
.prose li > p { margin-bottom: 0.5em; }

.prose table {
  width: 100%;
  border-collapse: collapse;
  border: 2px solid var(--border);
  box-shadow: var(--shadow-sm);
  font-size: 0.88em;
  background: var(--panel);
}

.prose th, .prose td {
  padding: 8px 10px;
  border: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--panel-2);
  font-weight: 800;
}

.prose .note {
  padding: 12px 14px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  font-size: 0.9em;
  font-weight: 600;
}

.no-content {
  padding: 26px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  text-align: center;
}

.no-content-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin: 0 auto 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--yellow);
  color: #000;
  box-shadow: var(--shadow-sm);
}

.no-content h2 { font-size: 20px; margin-bottom: 4px; }
.no-content p { margin: 0 auto 14px; max-width: 48ch; font-size: 13.5px; color: var(--muted); }

.reader-foot {
  max-width: var(--reader-width);
  margin: 42px auto 0;
  padding-top: 22px;
  border-top: 2px solid var(--border);
}

.reader-extra {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
}

.extra-block h3 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.extra-block h3 svg { width: 15px; height: 15px; }

.extra-hint {
  margin-bottom: 8px;
  font-size: 12.5px;
  color: var(--muted);
}

.tag-edit {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.tag-edit .input { height: 38px; font-size: 13px; }

.copy-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  min-width: 0;
}

.copy-row .input {
  height: 38px;
  min-width: 0;
  font-size: 12px;
  text-overflow: ellipsis;
}

.copy-row .btn {
  flex: none;
}

.code-block {
  margin-top: 12px;
  padding: 12px 14px;
  overflow-x: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: #10131f;
  box-shadow: var(--shadow-sm);
  color: #e9eefc;
  font-size: 11px;
  line-height: 1.6;
}

.code-block code { padding: 0; border: 0; background: none; color: inherit; font-size: inherit; }

.danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 26px;
  padding-top: 16px;
  border-top: 2px dashed var(--border);
}

.danger-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- settings ---------- */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  align-items: start;
}

.panel-wide {
  grid-column: 1 / -1;
}

.telegram-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  align-items: end;
}

.telegram-grid .field {
  margin: 0;
}

.telegram-grid .btn {
  grid-column: 1 / -1;
  justify-self: start;
}

.telegram-locked-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.telegram-locked-head .badge-row {
  margin-bottom: 0;
}

.telegram-facts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel-2);
  box-shadow: var(--shadow-sm);
}

.telegram-fact {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.fact-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.fact-value {
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.telegram-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.telegram-actions form {
  display: inline-flex;
}

.field-optional {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  text-transform: uppercase;
}

.sub-muted {
  font-weight: 700;
  color: var(--muted);
}

.panel {
  padding: 20px;
}

.panel h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.panel h2 svg { width: 18px; height: 18px; }

.panel .lead {
  margin: 3px 0 14px;
  font-size: 12.5px;
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 12px;
}

.field label {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 5px 16px;
  margin: 0;
  font-size: 12.5px;
}

.kv dt {
  font-weight: 800;
}

.kv dd {
  margin: 0;
  color: var(--muted);
  word-break: break-word;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.about-card {
  background: var(--main-soft);
}

/* ---------- audit ---------- */

.audit-panel {
  overflow: hidden;
}

.audit-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border-bottom: 2px solid var(--border);
}

.audit-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
  font-size: 20px;
}

.audit-title svg { width: 18px; height: 18px; }

.audit-lead {
  max-width: 42ch;
  margin: 0;
  text-align: right;
}

.audit-list {
  --audit-cols: 150px 110px minmax(220px, 1fr) 170px 28px;
}

.audit-labels,
.audit-summary {
  display: grid;
  grid-template-columns: var(--audit-cols);
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
}

.audit-labels {
  border-bottom: 2px solid var(--border);
  background: var(--panel-2);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.audit-entry {
  border-bottom: 1px solid var(--border);
}

.audit-entry:last-child { border-bottom: 0; }

.audit-summary {
  cursor: pointer;
  list-style: none;
}

.audit-summary::-webkit-details-marker { display: none; }

.audit-summary:hover,
.audit-entry[open] .audit-summary {
  background: var(--panel-2);
}

.audit-when {
  font-weight: 700;
  white-space: nowrap;
}

.audit-actor { min-width: 0; }

.audit-action,
.audit-ip {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.audit-action {
  font-size: 11px;
  font-weight: 700;
}

.audit-ip {
  font-size: 11px;
}

.audit-ip a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.audit-ip a:hover { color: var(--main); }

.audit-caret {
  display: flex;
  justify-content: flex-end;
  color: var(--muted);
  transition: transform 0.12s var(--ease);
}

.audit-caret svg { width: 16px; height: 16px; }

.audit-entry[open] .audit-caret { transform: rotate(180deg); }

.audit-extra {
  display: grid;
  gap: 8px;
  margin: 0 16px 14px;
  padding: 10px 0 0;
  border-top: 1.5px dashed var(--border);
}

.audit-extra-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 10px;
}

.audit-extra-label {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.audit-extra-value {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
}

.nowrap { white-space: nowrap; }

.audit-empty {
  border: 0;
  box-shadow: none;
}

@media (max-width: 700px) {
  .audit-labels { display: none; }

  .audit-summary {
    grid-template-columns: minmax(0, 1fr) 24px;
    gap: 4px 10px;
    padding: 12px 14px;
  }

  .audit-when { grid-column: 1; }

  .audit-caret {
    grid-column: 2;
    grid-row: 1;
  }

  .audit-actor,
  .audit-action,
  .audit-ip {
    grid-column: 1 / -1;
    overflow: visible;
    white-space: normal;
    text-overflow: clip;
  }

  .audit-extra {
    margin: 0 14px 12px;
  }

  .audit-extra-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}

/* ---------- epub library ---------- */

.epub-list {
  display: flex;
  flex-direction: column;
}

.epub-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
}

.epub-row:last-child { border-bottom: 0; }

.epub-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--panel-2);
  box-shadow: 2px 2px 0 0 var(--border);
}

.epub-icon svg { width: 18px; height: 18px; }

.epub-info {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.epub-title {
  overflow-wrap: anywhere;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.epub-title:hover { text-decoration: underline; text-underline-offset: 2px; }

.epub-meta {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11.5px;
}

.epub-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.epub-actions form { display: inline-flex; }

.epub-empty {
  border: 0;
  box-shadow: none;
}

@media (max-width: 700px) {
  .epub-row { flex-wrap: wrap; padding: 12px 16px; }
  .epub-info { flex-basis: calc(100% - 52px); }
  .epub-actions { width: 100%; justify-content: flex-end; }
}

/* ---------- auth ---------- */

.auth-body {
  display: grid;
  min-height: 100vh;
  place-items: center;
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
}

.auth-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 100vh;
  padding: 28px;
  overflow: hidden;
}

.auth-card {
  position: relative;
  z-index: 2;
  width: min(430px, 100%);
  padding: 30px 28px 24px;
  background: var(--panel);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 7px 7px 0 0 var(--border);
}

.auth-brand {
  font-size: 19px;
}

.auth-title {
  margin: 20px 0 6px;
  font-size: clamp(38px, 8vw, 52px);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

.auth-lead {
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}

.auth-form {
  margin-top: 8px;
}

.auth-form .field { margin: 16px 0 18px; }

.auth-form .input {
  height: 46px;
  font-size: 15px;
}

.auth-foot {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1.5px dashed var(--border);
  font-size: 11px;
  color: var(--muted);
  text-align: center;
}

.alert {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 9px 11px;
  margin: 6px 0 4px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: #ffd2d3;
  box-shadow: 2px 2px 0 0 var(--border);
  color: #2b0000;
  font-size: 12.5px;
  font-weight: 700;
}

[data-theme="sepia"] .alert { background: #f3d6cc; color: #4a1f16; }
.alert svg { width: 16px; height: 16px; }

.auth-deco {
  position: absolute;
  z-index: 1;
  border: 2px solid var(--border);
  box-shadow: var(--shadow);
}

.deco-a {
  width: 90px;
  height: 90px;
  top: 12%;
  left: 12%;
  background: var(--main);
  transform: rotate(-8deg);
  border-radius: var(--radius);
}

.deco-b {
  width: 54px;
  height: 54px;
  bottom: 16%;
  right: 14%;
  background: var(--yellow);
  transform: rotate(12deg);
  border-radius: 50%;
}

.deco-c {
  width: 34px;
  height: 120px;
  top: 50%;
  right: 9%;
  background: var(--green);
  transform: rotate(-6deg);
  border-radius: var(--radius);
}

/* ---------- public page ---------- */

.public-body {
  background-image: radial-gradient(var(--dot) 1px, transparent 1px);
  background-size: 22px 22px;
}

.public-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 24px;
  background: var(--panel);
  border-bottom: 2px solid var(--border);
}

.public-bar .badge { margin-left: 2px; }
.public-home { margin-left: auto; }

.public-wrap {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 26px 22px 70px;
}

.public-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 26px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

/* ---------- responsive ---------- */

@media (max-width: 1080px) {
  .app { grid-template-columns: 252px minmax(0, 1fr); }
  .content { padding: 22px 22px 70px; }
  .topbar { padding: 0 22px; }
  .search { max-width: 360px; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(300px, 86vw);
    height: 100dvh;
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
    transform: translateX(-103%);
    transition: transform 0.22s var(--ease);
    box-shadow: 6px 0 0 rgba(0, 0, 0, 0.18);
  }

  body.menu-open .sidebar { transform: translateX(0); }

  .icon-btn.sidebar-close { display: inline-grid; }
  .icon-btn.menu-btn { display: inline-grid; }

  .scrim {
    position: fixed;
    inset: 0;
    z-index: 35;
    background: rgba(0, 0, 0, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
  }

  body.menu-open .scrim {
    opacity: 1;
    pointer-events: auto;
  }

  body.menu-open { overflow: hidden; }

  .queue-card {
    margin-bottom: 4px;
    padding: 7px 10px;
  }

  .queue-card .eyebrow,
  .queue-card span:last-child {
    display: none;
  }

  .queue-card strong {
    font-size: 14px;
  }

  .topbar { height: 62px; gap: 10px; }
  .page-title { font-size: 20px; }
  .settings-grid { grid-template-columns: 1fr; }
  .search { max-width: none; }
  .content { padding: 18px 18px 70px; }
  .add-form { grid-template-columns: minmax(0, 1fr) auto; }
  .add-tags { grid-column: 1 / -1; }
  .add-submit { grid-column: 2; grid-row: 1; }
}

@media (max-width: 700px) {
  .toolbar-note { width: 100%; }

  .toolbar-actions { width: 100%; }

  .toolbar-actions .sort-form { flex: 1 1 100%; }

  .subs-head { padding: 16px; }

  .subs-head-actions { width: 100%; }

  .subs-page .subs-body { padding: 4px 16px 14px; }

  .sub-row {
    flex-wrap: wrap;
  }

  .sub-info { flex-basis: 100%; }

  .sub-meta { white-space: normal; }

  .sub-actions { margin-left: auto; }

  .add-form.two { grid-template-columns: 1fr; }

  .topbar {
    height: auto;
    min-height: 60px;
    flex-wrap: wrap;
    padding: 10px 16px;
    row-gap: 8px;
  }

  .page-title { order: 2; flex: 1; font-size: 19px; }
  .menu-btn { order: 1; }
  .theme-btn { order: 3; }
  .search {
    order: 4;
    flex-basis: 100%;
    max-width: none;
    height: 40px;
    box-shadow: 2px 2px 0 0 var(--border);
  }

  .content { padding: 16px 14px 64px; }
  .add-card { padding: 16px 14px 14px; }
  .add-card::before { width: 5px; }
  .add-head { align-items: flex-start; }
  .add-badge { display: none; }
  .add-form { grid-template-columns: 1fr; gap: 8px; }
  .add-submit { grid-column: 1; grid-row: auto; width: 100%; }
  .add-tags { grid-column: auto; }

  .toolbar { align-items: stretch; }
  .tabs { width: 100%; }
  .tab { flex: 1 1 auto; text-align: center; }
  .sort-form { width: 100%; }
  .sort-form .select { width: 100%; }

  .article-card {
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px;
  }

  .article-card::before { width: 5px; }
  .article-thumb { display: none; }
  .article-main { flex-basis: 100%; }
  .article-actions {
    flex-direction: row;
    justify-content: flex-end;
    width: 100%;
    padding-top: 9px;
    border-top: 1.5px dashed var(--border);
  }

  .article-actions .icon-btn { width: 34px; height: 34px; }

  .reader-top { flex-wrap: wrap; }
  .reader-controls { margin-left: auto; }
  .reader-title { font-size: clamp(25px, 7vw, 34px); }
  .reader { padding: 18px 16px; }
  .reader-head { padding-bottom: 16px; margin-bottom: 18px; }
  .reader-actions .btn { flex: 1 1 auto; }
  .reader-actions form { flex: 1 1 auto; }
  .reader-actions form .btn { width: 100%; }

  .reader-extra { gap: 18px; }
  .danger-row { flex-direction: column; align-items: flex-start; }
  .danger-row form { width: 100%; }
  .danger-row .btn { width: 100%; }

  .pager { flex-wrap: wrap; justify-content: center; }
  .pager-count { order: 3; width: 100%; text-align: center; }

  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid .panel-wide { grid-column: auto; }
  .telegram-grid { grid-template-columns: 1fr; }
  .telegram-grid .btn { grid-column: auto; width: 100%; }
  .telegram-actions { flex-direction: column; align-items: stretch; }
  .telegram-actions .btn { width: 100%; }
  .telegram-facts { grid-template-columns: 1fr; }
  .panel { padding: 16px; }

  .auth-wrap { padding: 18px; }
  .auth-card { padding: 24px 20px 20px; box-shadow: 5px 5px 0 0 var(--border); }
  .deco-a { width: 60px; height: 60px; top: 6%; left: 5%; }
  .deco-b { width: 40px; height: 40px; right: 6%; bottom: 8%; }
  .deco-c { display: none; }

  .public-bar { padding: 10px 14px; flex-wrap: wrap; }
  .public-bar .badge { display: none; }
  .public-wrap { padding: 16px 12px 50px; }
}

@media (max-width: 420px) {
  .brand-name { font-size: 19px; }
  .reader-source .domain { font-size: 12px; }
  .control-group { padding: 3px; }
  .tag-edit { flex-direction: column; }
  .tag-edit .btn { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .reader-top, .reader-actions, .reader-foot, .public-bar, .public-foot, .progress, .flash { display: none !important; }
  .content, .public-wrap { padding: 0; }
  .reader { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .prose { max-width: none; }
  .prose a { text-decoration: underline; color: #000; }
  .prose img { box-shadow: none; }
}


/* ---------- two-factor ---------- */

.badge-warn { background: #ffe6a6; color: #2b1d00; }
.alert-warn { background: #ffe6a6; color: #2b1d00; }
.alert-warn svg { width: 16px; height: 16px; }

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0 10px;
}

.backup-codes {
  width: 100%;
  min-height: 190px;
  margin-top: 14px;
  padding: 14px 16px;
  line-height: 1.9;
  font-size: 15px;
  letter-spacing: 0.08em;
  resize: vertical;
  background: var(--panel);
}

.code-input {
  font-size: 22px;
  letter-spacing: 0.3em;
}

.library-stamp {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 9px;
  border: 2px solid var(--pink);
  border-radius: 4px;
  box-shadow: 2px 2px 0 0 var(--pink);
  color: var(--pink);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transform: rotate(8deg);
}

/* ---------- standalone safe areas ---------- */

@supports (padding: env(safe-area-inset-top)) {
  .sidebar {
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(20px + env(safe-area-inset-bottom));
  }

  @media (max-width: 700px) {
    .topbar { padding-top: calc(10px + env(safe-area-inset-top)); }
    .content { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  }
}
