/* linkly — design system (Inter Tight, muted-blue accent, card surfaces) */

:root {
  --accent:       oklch(0.55 0.10 256);
  --accent-soft:  oklch(0.96 0.018 256);
  --paper:  #ffffff;
  --bg:     #f4f4f2;
  --ink:    #1b1b1a;
  --muted:  #9a9a96;
  --muted2: #6a6a66;
  --faint:  #b0b0ab;
  --line:      #e7e7e3;
  --line-soft: #f3f3f0;
  --field:  #f5f5f2;
  --chip:   #f3f3f0;
  --chip-ink: #5c5c58;
  --hover:  #fafaf8;
  --dark:   #1b1b1a;
  --danger: #b3261e;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.05);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: 'Inter Tight', 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
::placeholder { color: #a6a6a2; }
input, textarea, button { font-family: inherit; }

.wrap { max-width: 1000px; margin: 0 auto; padding: 28px 20px 64px; }
@media (max-width: 640px) { .wrap { padding: 14px 12px 48px; } }

/* The single app card that wraps top bar + page content. */
.app {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ---------------------------------------------------------------- top bar */
.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 15px 22px; border-bottom: 1px solid #ededea;
}
.brand {
  display: inline-flex; align-items: baseline; gap: 3px;
  font-weight: 700; font-size: 18px; letter-spacing: -.5px; color: var(--ink);
}
.brand .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); transform: translateY(-1px); }

.search {
  flex: 1; display: flex; align-items: center; gap: 9px;
  background: var(--field); border: 1px solid transparent; border-radius: 9px;
  padding: 9px 13px; min-width: 0;
}
.search:focus-within { border-color: var(--accent); background: #fff; }
.search svg { flex: none; }
.search input { border: 0; background: transparent; outline: none; flex: 1; min-width: 0; font-size: 13.5px; color: var(--ink); }

.topnav { display: flex; align-items: center; gap: 12px; }
.navlink { font-weight: 500; font-size: 13px; color: var(--muted2); }
.navlink:hover { color: var(--ink); }

.btn-dark {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--dark); color: #fff; border: 0; border-radius: 9px;
  padding: 9px 15px; font-weight: 600; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.btn-dark:hover { background: #000; }
.btn-dark .plus { font-size: 15px; line-height: 1; margin-top: -1px; }

/* top bar overflow menu */
.menu { position: relative; }
.menu-btn {
  border: 1px solid var(--line); background: #fff; color: var(--muted2);
  width: 34px; height: 34px; border-radius: 9px; cursor: pointer; font-size: 16px; line-height: 1;
}
.menu-btn:hover { border-color: var(--accent); color: var(--accent); }
.menu-pop {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,.12); padding: 6px; min-width: 168px;
}
.menu-pop[hidden] { display: none; }
.menu-pop a, .menu-pop button {
  display: block; width: 100%; text-align: left; background: none; border: 0;
  padding: 8px 10px; border-radius: 7px; font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer;
}
.menu-pop a:hover, .menu-pop button:hover { background: var(--accent-soft); color: var(--accent); }

/* --------------------------------------------------------- filter chip row */
.filterrow {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 12px 22px; border-bottom: 1px solid var(--line-soft);
}
.filterrow .label {
  font-weight: 500; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); margin-right: 2px;
}
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 0; cursor: pointer;
  background: var(--chip); color: var(--chip-ink); border-radius: 20px;
  padding: 5px 12px; font-weight: 500; font-size: 12px;
}
.chip:hover { background: #e9e9e5; color: var(--ink); }
.chip .n { color: #b8b8b3; font-size: 11px; }
.chip.active { background: var(--accent); color: #fff; }
.chip.active .x { opacity: .8; font-size: 13px; line-height: 1; }
.chip.ghost { background: none; border: 1px solid var(--line); color: var(--muted2); }
.chip.ghost:hover { border-color: var(--accent); color: var(--accent); }
.filterrow .saved { margin-left: auto; font-weight: 500; font-size: 12px; color: var(--muted); white-space: nowrap; }

/* ----------------------------------------------------------------- list */
.bm {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 22px; border-bottom: 1px solid var(--line-soft);
}
.bm:hover { background: var(--hover); }
.bm-body { min-width: 0; flex: 1; }
.bm-title { font-weight: 600; font-size: 14.5px; letter-spacing: -.2px; color: var(--ink); }
.bm-title:hover { color: var(--accent); }
.bm-meta { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bm-desc { font-size: 13px; color: var(--muted2); margin: 7px 0 0; line-height: 1.5; }
.bm-tags { display: flex; gap: 6px; margin-top: 9px; flex-wrap: wrap; }
.tag {
  background: var(--accent-soft); color: var(--accent); border-radius: 5px;
  padding: 2px 8px; font-weight: 500; font-size: 11.5px;
}
.tag:hover { background: var(--accent); color: #fff; }
.badge {
  font-weight: 600; font-size: 10px; letter-spacing: .4px; text-transform: uppercase;
  color: #92400e; background: #fef3c7; border-radius: 4px; padding: 1px 6px;
}
.badge-dl { color: #0f6e56; background: #e1f5ee; }   /* archived locally */

.bm-actions { display: flex; gap: 10px; align-items: center; flex: none; font-size: 12px; }
.bm-actions a, .bm-actions button { color: var(--muted); font-weight: 500; }
.bm-actions a:hover { color: var(--ink); }
.bm-actions .del { color: var(--muted); background: none; border: 0; cursor: pointer; padding: 0; }
.bm-actions .del:hover { color: var(--danger); }
@media (hover: hover) {
  .bm-actions { opacity: 0; transition: opacity .12s; }
  .bm:hover .bm-actions, .bm-actions:focus-within { opacity: 1; }
}

.empty { padding: 54px 22px; text-align: center; color: #a6a6a2; font-size: 14px; }

/* pagination */
.pager { display: flex; gap: 6px; flex-wrap: wrap; padding: 16px 22px; }
.pager a {
  min-width: 30px; text-align: center; padding: 5px 9px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 12.5px; font-weight: 500; color: var(--muted2);
}
.pager a:hover { border-color: var(--accent); color: var(--accent); }
.pager a.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ----------------------------------------------------------- all-tags modal */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-start; justify-content: center; padding: 60px 24px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(27,27,26,.20); }
.modal-card {
  position: relative; background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,.22); width: 100%; max-width: 580px; max-height: 100%;
  display: flex; flex-direction: column; overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #ededea; font-weight: 600; font-size: 15px; letter-spacing: -.2px;
}
.modal-head .dim { color: #b6b6b1; font-weight: 500; }
.modal-head .x { background: none; border: 0; color: #bdbdb9; font-size: 17px; cursor: pointer; line-height: 1; }
.modal-tools { padding: 12px 20px; border-bottom: 1px solid var(--line-soft); }
.modal-search {
  width: 100%; background: var(--field); border: 1px solid transparent; border-radius: 9px;
  padding: 9px 12px; font-size: 13.5px; color: var(--ink); outline: none;
}
.modal-search:focus { border-color: var(--accent); background: #fff; }
.modal-body { padding: 18px 20px; overflow-y: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.modal-empty { width: 100%; color: #a6a6a2; font-size: 13px; padding: 4px 2px; }
.tag-btn {
  display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff;
  border-radius: 8px; padding: 7px 13px; font-weight: 500; font-size: 13px; color: #3a3a37;
}
.tag-btn:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.tag-btn .n { color: #c2c2bd; font-size: 11.5px; }

/* --------------------------------------------------------------- panels/forms */
.panel { padding: 22px; }
.panel + .panel { border-top: 1px solid var(--line-soft); }
.panel h1 { font-size: 17px; font-weight: 600; letter-spacing: -.3px; margin: 0 0 14px; }
.panel h2 { font-size: 14px; font-weight: 600; margin: 0 0 12px; }
.panel-sub { color: var(--muted); font-size: 13px; margin: -8px 0 16px; }

.field { margin-bottom: 14px; }
.field > label, .flabel {
  display: block; font-weight: 600; font-size: 10.5px; letter-spacing: .7px;
  text-transform: uppercase; color: #a0a09b; margin-bottom: 6px;
}
.flabel .opt { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--faint); }
.input, .textarea {
  width: 100%; background: var(--field); border: 1px solid transparent; border-radius: 9px;
  padding: 10px 12px; font-size: 13.5px; color: var(--ink); outline: none;
}
.textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.input:focus, .textarea:focus { border-color: var(--accent); background: #fff; }
.input.mono { font-weight: 400; font-size: 12.5px; color: var(--muted2); }

.actions { display: flex; align-items: center; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.btn-text { background: none; border: 0; font-weight: 500; font-size: 13px; color: #8a8a86; cursor: pointer; padding: 8px 6px; }
.btn-text:hover { color: var(--ink); }
.error { color: var(--danger); font-size: 13px; margin: 0 0 12px; }

/* tag chip input (add/edit + popup) */
.tagfield {
  position: relative;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  background: var(--field); border: 1px solid transparent; border-radius: 9px; padding: 8px 10px;
}
.tag-suggest {
  position: fixed; z-index: 1000;
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  box-shadow: 0 12px 30px rgba(0,0,0,.12); padding: 4px; max-height: 240px; overflow-y: auto;
}
.tag-suggest[hidden] { display: none; }
.tag-suggest .opt {
  padding: 7px 10px; border-radius: 6px; font-size: 13px; color: var(--ink); cursor: pointer;
}
.tag-suggest .opt.active, .tag-suggest .opt:hover { background: var(--accent-soft); color: var(--accent); }
.tagfield.focus { border-color: var(--accent); background: #fff; }
.tagfield .pill {
  display: inline-flex; align-items: center; gap: 5px; background: var(--accent); color: #fff;
  border-radius: 6px; padding: 3px 5px 3px 9px; font-weight: 500; font-size: 11.5px;
}
.tagfield .pill .rm { cursor: pointer; opacity: .85; font-size: 12px; line-height: 1; }
.tagfield input {
  flex: 1; min-width: 90px; border: 0; background: transparent; outline: none;
  font-size: 13px; color: var(--ink); padding: 3px 0;
}
.suggested { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-top: 10px; }
.suggested .lbl { font-size: 11.5px; color: var(--faint); }
.suggested button {
  background: var(--chip); color: var(--chip-ink); border: 0; border-radius: 6px;
  padding: 3px 9px; font-weight: 500; font-size: 11.5px; cursor: pointer;
}
.suggested button:hover { background: var(--accent-soft); color: var(--accent); }

/* feeds table */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; border-bottom: 1px solid var(--line); padding: 8px 10px; }
.tbl td { border-bottom: 1px solid var(--line-soft); padding: 11px 10px; vertical-align: top; }
.tbl tr.off { opacity: .55; }
.tbl .ftitle { font-weight: 600; }
.tbl .url { color: var(--muted); font-size: 12px; word-break: break-all; margin-top: 2px; }
.tbl .ferr { color: var(--danger); font-size: 12px; margin-top: 3px; }
.rowact { white-space: nowrap; text-align: right; }
.rowact button { background: none; border: 0; color: var(--muted); font-weight: 500; font-size: 12.5px; cursor: pointer; padding: 0 0 0 12px; }
.rowact button:hover { color: var(--ink); }
.rowact button.del:hover { color: var(--danger); }

.inline { display: inline; }

/* ------------------------------------------------------------------- auth */
.auth-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.auth {
  background: var(--paper); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); width: 100%; max-width: 360px; padding: 28px;
}
.auth .brand { font-size: 22px; margin-bottom: 18px; }
.auth .field:last-of-type { margin-bottom: 18px; }
.auth .btn-dark { width: 100%; justify-content: center; padding: 11px; }

/* bookmarklet install page */
.drag-link {
  display: inline-block; background: var(--dark); color: #fff; padding: 9px 16px;
  border-radius: 9px; font-weight: 600; font-size: 13px;
}
.drag-link .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); display: inline-block; margin-left: 2px; transform: translateY(-1px); }
.hint { color: var(--muted); font-size: 13px; line-height: 1.6; }
.hint code { background: var(--field); padding: 1px 6px; border-radius: 5px; font-size: 12px; }

/* ---------------------------------------------------------------- popup */
.popup-body { background: var(--bg); margin: 0; padding: 16px; }
.popup {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 16px 40px rgba(0,0,0,.12); overflow: hidden;
  max-width: 380px; margin: 0 auto;
}
.popup-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid #ededea; }
.popup-head .who { display: flex; align-items: center; gap: 8px; }
.popup-head .brand { font-size: 15px; }
.popup-head .sub { font-weight: 500; font-size: 13px; color: var(--muted); }
.popup-head .x { background: none; border: 0; color: #bdbdb9; font-size: 16px; cursor: pointer; line-height: 1; }
.popup-inner { padding: 18px; }
.popup-foot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 13px 18px; border-top: 1px solid var(--line-soft); background: #fcfcfb; }
.popup-foot .btn-dark { padding: 9px 20px; }

/* ---------------------------------------------------------------- reader */
.reader { max-width: 680px; margin: 0 auto; padding: 26px 22px 48px; }
.reader .back { font-size: 13px; color: var(--muted); }
.reader .back:hover { color: var(--ink); }
.reader-title { font-size: 27px; font-weight: 700; letter-spacing: -.4px; line-height: 1.2; margin: 16px 0 10px; }
.reader-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.reader-meta a { color: var(--accent); }
.reader-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.reader-note {
  margin-top: 24px; padding: 16px 18px; background: var(--field);
  border-radius: 10px; color: var(--muted2); font-size: 14px;
}
.reader-note div { margin-top: 8px; }

.prose { margin-top: 22px; font-size: 16px; line-height: 1.7; color: #23241f; }
.prose > *:first-child { margin-top: 0; }
.prose h1, .prose h2, .prose h3, .prose h4 { line-height: 1.3; letter-spacing: -.2px; margin: 1.6em 0 .5em; }
.prose h1 { font-size: 1.5em; } .prose h2 { font-size: 1.3em; } .prose h3 { font-size: 1.12em; }
.prose p, .prose ul, .prose ol, .prose blockquote, .prose pre, .prose figure { margin: 0 0 1.1em; }
.prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.prose img { max-width: 100%; height: auto; border-radius: 8px; display: block; margin: 1.2em 0; }
.prose figure { margin: 1.4em 0; }
.prose figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; text-align: center; }
.prose blockquote { padding-left: 16px; border-left: 3px solid var(--line); color: var(--muted2); }
.prose pre { background: #1b1b1a; color: #f3f3f0; padding: 14px 16px; border-radius: 10px; overflow-x: auto; font-size: 13.5px; }
.prose code { background: var(--field); padding: 1px 5px; border-radius: 5px; font-size: .92em; }
.prose pre code { background: none; padding: 0; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li { margin: .3em 0; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }

@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; }
  .search { order: 3; flex-basis: 100%; }
  .filterrow { overflow-x: auto; flex-wrap: nowrap; }
  .filterrow .saved { display: none; }
  .bm-actions { opacity: 1; }
}
