/* PBN Link Dashboard — light chalk/brown theme */

:root {
    --bg: #f6f1e9;           /* page background — soft chalk */
    --panel: #fffdfa;        /* cards/boxes — slightly lighter than page for lift */
    --panel-2: #efe4d3;      /* subtle chip/pill background (was dark #30363d) */
    --border: #e2d5c0;       /* warm soft border */
    --border-strong: #d3c1a3;
    --text: #3a2f24;         /* warm near-black, easier on the eyes than pure black */
    --text-on-chip: #5b4632;
    --muted: #8a7a63;        /* secondary/help text */
    --muted-soft: #a3937b;
    --accent: #8c5a3c;       /* soft brown / clay */
    --accent-hover: #713f26;
    --accent-soft: #f1e2d1;  /* light chip version of accent */
    --ok: #5a7d4a;
    --ok-bg: rgba(90,125,74,.12);
    --danger: #af4d38;
    --danger-bg: rgba(175,77,56,.12);
    --warn: #a8752c;
    --warn-bg: rgba(168,117,44,.12);
    --radius: 10px;
    --shadow: 0 1px 2px rgba(58,47,36,.06), 0 4px 14px rgba(58,47,36,.05);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Helvetica, Arial, sans-serif;
    font-size: 15.5px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.container { max-width: 980px; margin: 0 auto; padding: 28px 22px 70px; }

.topbar { background: var(--panel); border-bottom: 1px solid var(--border); box-shadow: var(--shadow); }
.topbar-inner { max-width: 980px; margin: 0 auto; padding: 16px 22px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.brand { color: var(--accent); font-weight: 700; text-decoration: none; font-size: 17px; letter-spacing: -.01em; }
nav a { color: var(--muted); text-decoration: none; margin-left: 18px; font-size: 14px; transition: color .15s; }
nav a:hover { color: var(--accent); }

h1 { font-size: 23px; margin: 0 0 20px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 30px 0 12px; font-weight: 600; }
h3 { font-size: 14px; margin: 22px 0 8px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }

.flash { padding: 11px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.flash-success { background: var(--ok-bg); border-color: rgba(90,125,74,.35); color: var(--ok); }
.flash-error { background: var(--danger-bg); border-color: rgba(175,77,56,.35); color: var(--danger); }
.flash-warn { background: var(--warn-bg); border-color: rgba(168,117,44,.35); color: var(--warn); }

.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.card {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 16px; text-decoration: none; color: var(--text); display: block;
    box-shadow: var(--shadow); transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card .name { font-weight: 600; margin-bottom: 4px; }
.card .url { color: var(--muted); font-size: 13px; word-break: break-all; margin-bottom: 10px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--panel-2); color: var(--text-on-chip); }
.badge-connected { background: var(--ok-bg); color: var(--ok); }
.badge-pending { background: var(--warn-bg); color: var(--warn); }
.badge-failed { background: var(--danger-bg); color: var(--danger); }
.meta { color: var(--muted); font-size: 12px; margin-top: 8px; }

form.box, .box {
    background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 22px; max-width: 560px; box-shadow: var(--shadow);
}
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 5px; font-weight: 500; }
label:first-child { margin-top: 0; }
input[type=text], input[type=url], input[type=password], input[type=number], select, textarea {
    width: 100%; padding: 10px 12px; background: #fffefc; border: 1px solid var(--border-strong);
    border-radius: 8px; color: var(--text); font-size: 14.5px; font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
    outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft);
}
input:disabled { background: var(--panel-2); color: var(--muted); }
textarea { min-height: 120px; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; }

button, .btn {
    background: var(--accent); color: #fff8f0; border: none; padding: 10px 18px;
    border-radius: 8px; font-size: 14.5px; font-weight: 600; cursor: pointer;
    text-decoration: none; display: inline-block; margin-top: 16px; transition: background .15s, transform .1s;
}
button:hover, .btn:hover { background: var(--accent-hover); }
button:active, .btn:active { transform: translateY(1px); }
.btn-secondary { background: var(--panel-2); color: var(--text-on-chip); }
.btn-secondary:hover { background: var(--border-strong); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #8f3c2a; }

table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .03em; background: var(--bg); }
tr:hover td { background: rgba(140,90,60,.04); }

/* "Links here" table: flag which rows are likely-safe deliberate anchors
   (full URLs) vs likely theme-generated structural links (bare relative/
   fragment hrefs — nav menus, TOCs, breadcrumbs) that repeat across every
   post and are riskier to bulk-edit/remove. Deliberately high-contrast
   against the page's cream/tan palette (a flat grey + reduced opacity vs a
   saturated amber), not a subtle tint — needs to read at a glance, not on
   close inspection. */
tr.link-locked { opacity: .55; }
tr.link-locked td { background: #e2e2e2; color: #6f6f6f; }
tr.link-locked:hover { opacity: .85; }
tr.link-active td { background: #fbdf9e; }
tr.link-active td:first-child { border-left: 4px solid #a8641c; }
tr.link-active:hover td { background: #f7cf76; }
a { color: var(--accent); }
a:hover { color: var(--accent-hover); }

/* Scrollable list container — long Posts/links/activity tables get a fixed
   viewport with a sticky header instead of stretching the whole page. */
.table-scroll {
    max-height: 480px; overflow-y: auto; border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow); background: var(--panel);
}
.table-scroll table { margin-top: 0; }
.table-scroll thead th { position: sticky; top: 0; z-index: 1; box-shadow: 0 1px 0 var(--border); }
.table-scroll table, .table-scroll td, .table-scroll th { border-left: none; border-right: none; }

.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }

/* Collapsible help disclosures — replaces long always-visible helper
   paragraphs with a small (!) toggle you open only when you need it. */
details.help { margin-top: 8px; }
details.help > summary {
    list-style: none; cursor: pointer; display: inline-flex; align-items: center;
    justify-content: center; width: 20px; height: 20px; border-radius: 999px;
    background: var(--panel-2); color: var(--text-on-chip); font-size: 12px; font-weight: 700;
    user-select: none; transition: background .15s;
}
details.help > summary::-webkit-details-marker { display: none; }
details.help > summary:hover { background: var(--border-strong); }
details.help[open] > summary { background: var(--accent); color: #fff8f0; }
details.help .hint { margin-top: 8px; padding: 10px 12px; background: var(--bg); border-radius: 8px; border: 1px solid var(--border); }

.type-toggle { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.type-toggle label {
    display: flex; align-items: center; gap: 6px; font-size: 14px; color: var(--text);
    margin: 0; font-weight: 400; padding: 7px 12px; border: 1px solid var(--border-strong);
    border-radius: 999px; background: var(--panel); cursor: pointer; transition: border-color .15s, background .15s;
}
.type-toggle label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }

.filter-pills { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.filter-pills .pill {
    margin: 0; background: var(--panel); color: var(--muted); border: 1px solid var(--border-strong);
    padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; cursor: pointer;
    transition: border-color .15s, background .15s, color .15s;
}
.filter-pills .pill:hover { border-color: var(--accent); color: var(--text); }
.filter-pills .pill.active { background: var(--accent); border-color: var(--accent); color: #fff8f0; }

code, pre { background: var(--panel-2); border: 1px solid var(--border); border-radius: 6px; color: var(--text-on-chip); }
code { padding: 1px 5px; font-size: 13px; }
pre { padding: 14px; overflow-x: auto; font-size: 13px; }
