/* rss-feed-proxy admin — monochrome, monospace, hairline borders, keine Radien,
   keine Dekoration, die keine Information traegt. */

:root {
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #6b7075;
  --line: #d8dade;
  --line-strong: #9a9ea3;
  --subtle: #f4f5f6;
  --inv-bg: #0a0a0a;
  --inv-fg: #ffffff;
  /* Einzige Farbe im Interface: was rausfliegt. */
  --drop: #c0261f;
  --scrim: rgba(0, 0, 0, .45);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Typo-Skala, Basis 16px. */
  --fs: 16px;
  --fs-sm: 15px;
  --fs-xs: 14px;
  --fs-2xs: 13px;
  --fs-3xs: 12px;
  --fs-4xs: 11px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0b0c;
    --fg: #f1f1f2;
    --muted: #8a8d93;
    --line: #26282b;
    --line-strong: #43464b;
    --subtle: #161719;
    --inv-bg: #f1f1f2;
    --inv-fg: #0b0b0c;
    --drop: #e5544b;
    /* Schwarz auf Fast-Schwarz trennt kaum, im Dunkeln braucht es mehr. */
    --scrim: rgba(0, 0, 0, .68);
  }
}

* { box-sizing: border-box; border-radius: 0; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: var(--fs)/1.5 var(--mono);
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
code, .mono { font-family: var(--mono); font-size: 1em; }

/* ---------- shell ---------- */

.app { display: flex; flex-direction: column; height: 100%; }

.topbar {
  display: flex; align-items: center; gap: 1rem;
  padding: 0 1.1rem; height: 46px; flex: 0 0 46px;
  border-bottom: 1px solid var(--line-strong);
}
.topbar h1 {
  font-size: var(--fs-2xs); font-weight: 700; margin: 0;
  text-transform: uppercase; letter-spacing: .12em;
}
.topbar .path { margin-left: auto; color: var(--muted); font-size: var(--fs-2xs); }
.topbar .logout { margin: 0; }
.topbar .logout .linklike { font-size: var(--fs-2xs); text-decoration: none; }
.topbar .logout .linklike:hover { text-decoration: underline; }
.topbar a { color: var(--muted); text-decoration: none; font-size: var(--fs-2xs); }
.topbar a:hover { color: var(--fg); text-decoration: underline; }

.columns {
  flex: 1 1 auto; min-height: 0;
  display: grid; grid-template-columns: 264px minmax(0, 1fr) minmax(0, 1fr);
}
.columns > * { min-height: 0; overflow-y: auto; padding: 1.1rem; }
.columns > * + * { border-left: 1px solid var(--line-strong); }
@media (max-width: 1180px) {
  .columns { grid-template-columns: 1fr; }
  .columns > * + * { border-left: 0; border-top: 1px solid var(--line-strong); }
  .columns > * { overflow-y: visible; }
  .app { height: auto; }
}

/* ---------- sidebar ---------- */

.sidebar-section + .sidebar-section { margin-top: 1.6rem; }
.sidebar-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .45rem; padding-bottom: .35rem;
  border-bottom: 1px solid var(--line-strong);
}
.sidebar-head h2 {
  margin: 0; font-size: var(--fs-3xs); font-weight: 700;
  text-transform: uppercase; letter-spacing: .12em; color: var(--fg);
}
.feeds { list-style: none; margin: 0; padding: 0; }
.feeds li + li { border-top: 1px solid var(--line); }
.feeds button {
  display: block; width: 100%; text-align: left;
  padding: .4rem .55rem; border: 0; border-left: 2px solid transparent;
  background: none; color: var(--muted); font: inherit; cursor: pointer;
}
.feeds button:hover { background: var(--subtle); color: var(--fg); }
.feeds button[aria-current="true"] {
  border-left-color: var(--fg); background: var(--subtle); color: var(--fg); font-weight: 700;
}
.feeds .name { display: flex; align-items: center; gap: .4rem; }
.feeds .meta { display: block; font-size: var(--fs-2xs); color: var(--muted); font-weight: 400; }

.dot { width: 6px; height: 6px; background: var(--fg); flex: none; }

/* ---------- forms ---------- */

.section { margin-bottom: 1.5rem; }
.section > h2 {
  font-size: var(--fs-3xs); font-weight: 700; text-transform: uppercase;
  letter-spacing: .12em; color: var(--fg); margin: 0 0 .55rem;
  padding-bottom: .35rem; border-bottom: 1px solid var(--line-strong);
}
.field { margin-bottom: .7rem; }
.field label {
  display: block; font-size: var(--fs-3xs); color: var(--muted);
  text-transform: uppercase; letter-spacing: .1em; margin-bottom: .25rem;
}
.row { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }

input[type=text], input[type=number], input[type=password], select {
  width: 100%; padding: .38rem .55rem;
  border: 1px solid var(--line);
  background: var(--bg); color: var(--fg); font: inherit;
  appearance: none;
}
select {
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: right .85rem center, right .6rem center;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 1.6rem;
}
input:focus, select:focus { outline: none; border-color: var(--fg); box-shadow: inset 0 0 0 1px var(--fg); }
input::placeholder { color: var(--muted); opacity: .6; }
/* Autofill would otherwise paint the login form in the browser's own blue. */
input:-webkit-autofill {
  -webkit-text-fill-color: var(--fg);
  -webkit-box-shadow: inset 0 0 0 100px var(--bg);
  caret-color: var(--fg);
  font: inherit;
}

/* ---------- rules ---------- */

.rule {
  border: 1px solid var(--line);
  padding: .55rem; margin-bottom: -1px;
}
/* The rule under the cursor, paired with the reordered preview. */
.rule.editing { border-color: var(--fg); position: relative; z-index: 1; }
.rule-top { display: grid; grid-template-columns: 1fr 1fr 1fr auto; gap: .4rem; align-items: center; }
.rule-value { margin-top: .4rem; display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: center; }
.check {
  display: flex; align-items: center; gap: .4rem; font-size: var(--fs-3xs);
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); white-space: nowrap; cursor: pointer;
}
.check input { accent-color: var(--fg); margin: 0; }

/* The groups a feed belongs to, each a way into that group. */
.memberships { display: flex; flex-wrap: wrap; gap: .35rem; }

/* Member picker for groups. */
.members { display: flex; flex-wrap: wrap; gap: .5rem 1.15rem; padding: .7rem .75rem;
  border: 1px solid var(--line); }
.check.member { color: var(--fg); font-size: var(--fs-sm); text-transform: none; letter-spacing: 0; gap: .55rem; }
/* The label text carries the spacing itself, so no engine's idea of an
   anonymous flex item can swallow it. */
.check > span { margin-left: .1rem; }

.icon-btn {
  border: 1px solid transparent; background: none; color: var(--muted); cursor: pointer;
  font: inherit; line-height: 1; padding: .3rem .4rem;
}
.icon-btn:hover { border-color: var(--fg); color: var(--fg); }

/* ---------- buttons ---------- */

.btn {
  padding: .38rem .8rem; border: 1px solid var(--fg);
  background: var(--bg); color: var(--fg); font: inherit; cursor: pointer;
  text-transform: uppercase; letter-spacing: .1em; font-size: var(--fs-2xs);
}
.btn:hover:not(:disabled) { background: var(--subtle); }
.btn:disabled { opacity: .35; cursor: default; }
.btn.primary { background: var(--inv-bg); border-color: var(--inv-bg); color: var(--inv-fg); }
.btn.primary:hover:not(:disabled) { opacity: .82; background: var(--inv-bg); }
.btn.quiet { border-color: var(--line); color: var(--muted); }
.btn.quiet:hover:not(:disabled) { color: var(--fg); border-color: var(--fg); }
.btn.small { padding: .22rem .55rem; font-size: var(--fs-3xs); }

/* The feed address is the secret, so it gets a field of its own that is easy
   to select in one go and easy to copy without touching it. */
.served { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: center; margin-bottom: .5rem; }
.served input { color: var(--fg); }

.linklike {
  border: 0; padding: 0; background: none; font: inherit; color: var(--muted);
  text-decoration: underline; cursor: pointer;
}
.linklike:hover:not(:disabled) { color: var(--fg); }
.linklike:disabled { opacity: .35; cursor: default; }

.actions { display: flex; gap: .5rem; align-items: center; padding-top: .35rem; }
.actions .spacer { margin-left: auto; }

/* ---------- messages ---------- */

.notice {
  border: 1px solid var(--line); border-left-width: 3px; border-left-color: var(--fg);
  padding: .5rem .65rem; margin-bottom: .9rem; font-size: var(--fs-sm);
}
.notice.muted { border-left-color: var(--line); color: var(--muted); }
/* ---------- confirmation overlay ---------- */

/* A question, not a report: it blocks the way until it is answered. */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 1.1rem;
  background: var(--scrim);
}
.dialog {
  width: min(30rem, 100%);
  background: var(--bg); color: var(--fg);
  border: 1px solid var(--fg);
  padding: .9rem 1rem 1rem;
}
.confirm-question { margin: 0 0 .35rem; }
.dialog .hint { display: block; margin: 0 0 .1rem; }
.hint { color: var(--muted); font-size: var(--fs-xs); }

/* ---------- preview ---------- */

.preview-head {
  display: flex; align-items: baseline; gap: .6rem; margin-bottom: .8rem; flex-wrap: wrap;
  position: sticky; top: -1.1rem; background: var(--bg);
  padding: 1.1rem 0 .5rem; margin-top: -1.1rem;
  border-bottom: 1px solid var(--line-strong);
}
.count { font-size: 25px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.count small { font-size: var(--fs-3xs); font-weight: 400; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; }

.preview-head .spacer { margin-left: auto; }
.pulse { width: 6px; height: 6px; background: var(--fg); animation: pulse 1s steps(2, end) infinite; }
@keyframes pulse { 0%, 100% { opacity: .2; } 50% { opacity: 1; } }

.item { padding: .5rem 0 .5rem .6rem; border-left: 3px solid var(--fg); }
.item + .item { border-top: 1px solid var(--line); }
.item.dropped { border-left-color: var(--drop); }
.item.dropped .item-title { text-decoration: line-through; color: var(--muted); }
.item-title { display: block; }
.item-meta { display: flex; flex-wrap: wrap; gap: .45rem; align-items: baseline; margin-top: .2rem; }
.tag { font-size: var(--fs-4xs); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
/* Which member feed a merged entry came from. */
.tag.origin { border: 1px solid var(--line); padding: 0 .3rem; text-transform: none; letter-spacing: 0; }
.rule-ref { font-size: var(--fs-2xs); color: var(--muted); }

/* Every field a rule can address, shown per entry. */
.fields {
  display: grid; grid-template-columns: 6.6rem minmax(0, 1fr);
  gap: .12rem .8rem; margin: .5rem 0 .1rem;
  padding-top: .4rem; border-top: 1px solid var(--line);
}
.field-row { display: contents; }
.fields dt { font-size: var(--fs-4xs); color: var(--muted); line-height: 1.7; text-transform: uppercase; letter-spacing: .1em; }
.fields dd { margin: 0; font-size: var(--fs-xs); color: var(--muted); overflow-wrap: anywhere; }
.fields .value { display: block; }
.fields .value + .value { margin-top: .12rem; }
/* Only clamp the values that actually run long. */
.fields dd .value {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.field-row.matched dt { color: var(--fg); font-weight: 700; }
.field-row.matched dd { color: var(--fg); }

.empty {
  color: var(--muted); padding: 2.2rem 0; text-align: center; font-size: var(--fs-2xs);
  text-transform: uppercase; letter-spacing: .12em;
}
