/* SFixBase styles - phone first. Colours are variables so light and dark mode share everything else. */

:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --text: #1c2229;
  --muted: #656f7d;
  --border: #dfe3e8;
  --accent: #2459d6;
  --accent-text: #ffffff;
  --accent-soft: #e6edfc;
  --success: #17803d;
  --success-soft: #e3f3e8;
  --warning: #9a5b00;
  --warning-soft: #fdf1dc;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --mark: #fde68a;
  --code-bg: #f3f4f7;
  --diff-add: #e3f6e8;
  --diff-del: #fde8e6;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --c-keyword: #8b2fc9;
  --c-string: #116329;
  --c-number: #b35900;
  --c-comment: #737f8c;
  --c-variable: #0550ae;
  --c-function: #8a3c00;
  --radius: 12px;
  --tabbar-h: 62px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

[data-theme="dark"] {
  --bg: #0f1216;
  --surface: #171b21;
  --surface-2: #20262e;
  --text: #e4e8ed;
  --muted: #9aa4b0;
  --border: #2b323c;
  --accent: #6d9cf5;
  --accent-text: #0f1216;
  --accent-soft: #1c2943;
  --success: #4ccb7a;
  --success-soft: #15301f;
  --warning: #f0b45a;
  --warning-soft: #33270f;
  --danger: #f2837a;
  --danger-soft: #3a1c1a;
  --mark: #7a5b0b;
  --code-bg: #11151a;
  --diff-add: #143322;
  --diff-del: #3d1d1b;
  --shadow: none;
  --c-keyword: #d2a8ff;
  --c-string: #7ee2a8;
  --c-number: #ffb86b;
  --c-comment: #7f8b98;
  --c-variable: #79c0ff;
  --c-function: #ffa657;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: light; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html[data-theme="dark"] { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--accent); text-decoration: none; }
@media (hover: hover) { a:hover { text-decoration: underline; } }

h1, h2, h3 { line-height: 1.25; }
h2 { font-size: 1.05rem; margin: 1.6rem 0 .6rem; }
.muted { color: var(--muted); font-size: .88em; }
.hint { color: var(--muted); font-weight: normal; font-size: .85em; }
.desktop-only { display: none !important; }
.svg-icon { width: 1.25em; height: 1.25em; flex: none; }

/* ================= top bar ================= */

.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding-top: env(safe-area-inset-top, 0px);
}
.topbar-inner {
  max-width: 1100px; margin: 0 auto; padding: .5rem .75rem;
  display: flex; align-items: center; gap: .5rem;
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); display: inline-flex; align-items: center; flex: none; }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 2rem; height: 2rem;
  background: var(--accent); color: var(--accent-text);
  border-radius: 8px; font-size: 1.05rem; font-weight: 700;
}
.brand-name { display: none; margin-left: .45rem; }
.brand.big { font-size: 1.6rem; justify-content: center; margin-bottom: 1rem; }
.brand.big .brand-name { display: inline; }
.brand.big .brand-mark { width: 2.4rem; height: 2.4rem; font-size: 1.35rem; }

.search { flex: 1; min-width: 0; }
.search input { width: 100%; height: 2.5rem; border-radius: 999px; padding: 0 1rem; background: var(--surface-2); border-color: transparent; }

.nav { display: flex; align-items: center; gap: .35rem; flex: none; }
.nav-link { color: var(--muted); padding: .45rem .7rem; border-radius: 8px; font-weight: 500; }
.nav-link.active { color: var(--text); background: var(--surface-2); }
@media (hover: hover) { .nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; } }

.icon-button {
  display: inline-grid; place-items: center;
  width: 2.5rem; height: 2.5rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text);
  cursor: pointer; padding: 0;
}
.icon-button:hover { text-decoration: none; }
@media (hover: hover) { .icon-button:hover { background: var(--surface-2); } }

/* ================= bottom tab bar (phones) ================= */

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom));
}
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); font-size: .72rem; font-weight: 600;
}
.tab .svg-icon { width: 1.45rem; height: 1.45rem; }
.tab.active { color: var(--accent); }
.tab:hover { text-decoration: none; }
.tab-add .add-circle {
  display: grid; place-items: center;
  width: 3rem; height: 3rem; border-radius: 50%;
  background: var(--accent); color: var(--accent-text);
  box-shadow: 0 4px 12px rgba(36, 89, 214, .35);
  margin-top: -1.1rem;
}
.tab-add .add-circle .svg-icon { width: 1.6rem; height: 1.6rem; }

/* ================= layout ================= */

.page { max-width: 1100px; margin: 0 auto; padding: 1rem .9rem calc(var(--tabbar-h) + var(--safe-bottom) + 1.5rem); }
.page.no-tabbar { padding-bottom: 2rem; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.page-head .button { flex: none; }
.page-title { font-size: 1.35rem; margin: .1rem 0 .6rem; overflow-wrap: anywhere; }
.back-link { display: inline-flex; align-items: center; gap: .2rem; color: var(--muted); font-size: .9rem; margin-bottom: .4rem; }

.columns { display: block; }

.hero { padding: .6rem 0 0; }
.hero h1 { display: none; }
.hero-search { display: none; }
.stat-line { color: var(--muted); font-size: .88rem; margin: 0 0 .8rem; }

.attention { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .5rem; }
.attention a {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .55rem .85rem; border-radius: 999px; font-weight: 600; font-size: .9rem;
}
.attention .drafts { background: var(--accent-soft); color: var(--accent); }
.attention .stale { background: var(--warning-soft); color: var(--warning); }
.attention a:hover { text-decoration: none; }

.empty {
  text-align: center; padding: 2rem 1rem;
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); margin-top: 1rem;
}
.empty h2 { margin-top: 0; }
.empty .button { margin: .25rem; }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .2rem 1rem 1rem; margin-bottom: 1rem; box-shadow: var(--shadow);
}

/* ================= lists of fixes / snippets ================= */

.item {
  display: block;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .8rem .95rem; margin-bottom: .55rem; box-shadow: var(--shadow);
  position: relative;
}
.item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; }
.item-title { font-weight: 600; font-size: 1.02rem; color: var(--text); overflow-wrap: anywhere; }
/* Make the whole card clickable: the title link stretches over the card... */
a.item-title::after { content: ''; position: absolute; inset: 0; border-radius: inherit; }
/* ...and the chips sit on top of it so they still open their own filters */
.item .meta a { position: relative; z-index: 1; }
.item:has(a.item-title) { cursor: pointer; transition: border-color .15s; }
.item:has(a.item-title):hover { border-color: var(--accent); }
.item:has(a.item-title):hover .item-title { text-decoration: underline; }
.item-flags { display: flex; gap: .35rem; align-items: center; flex: none; }
.excerpt { margin: .3rem 0 .4rem; color: var(--muted); font-size: .92rem; overflow-wrap: anywhere; }
.excerpt mark, .md mark { background: var(--mark); color: inherit; border-radius: 3px; padding: 0 .1em; }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .45rem; margin: .4rem 0; }
.chip {
  display: inline-flex; align-items: center; min-height: 1.75rem;
  padding: .1rem .65rem; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-size: .82rem; border: 1px solid var(--border);
  white-space: nowrap;
}
.chip:hover { color: var(--text); text-decoration: none; }
.chip.category { background: var(--accent-soft); color: var(--accent); border-color: transparent; font-weight: 600; }
.badge { display: inline-block; font-size: .72rem; font-weight: 700; padding: .12rem .5rem; border-radius: 6px; text-transform: uppercase; letter-spacing: .03em; }
.badge.draft { background: var(--accent-soft); color: var(--accent); }
.badge.stale { background: var(--warning-soft); color: var(--warning); }
.badge.pin { background: var(--surface-2); color: var(--muted); }
.worked { color: var(--success); font-weight: 600; font-size: .85rem; white-space: nowrap; }
.lang { color: var(--muted); font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
.edit-link { margin-left: auto; padding: .3rem 0 .3rem .5rem; }

.plain-list { list-style: none; padding: 0; margin: 0; }
.plain-list li { border-bottom: 1px solid var(--border); }
.plain-list li a { display: flex; justify-content: space-between; padding: .65rem .1rem; color: var(--text); }
.tag-cloud { display: flex; flex-wrap: wrap; gap: .4rem; }

/* filter chips that scroll sideways on phones */
.segmented {
  display: flex; gap: .4rem; overflow-x: auto; scrollbar-width: none;
  margin: 0 -.9rem .7rem; padding: 0 .9rem;
}
.segmented::-webkit-scrollbar { display: none; }
.segmented a {
  flex: none; padding: .45rem .9rem; border-radius: 999px; font-size: .9rem; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
}
.segmented a.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.segmented a:hover { text-decoration: none; }
.segmented .count { opacity: .7; font-weight: 500; margin-left: .2rem; }

.filters { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-bottom: 1rem; }
.filters label { font-size: .8rem; color: var(--muted); display: flex; flex-direction: column; gap: .2rem; }
.filters select { width: 100%; }
.active-filter { display: flex; gap: .5rem; flex-wrap: wrap; margin: -.4rem 0 .8rem; }

/* ================= a single fix ================= */

.banner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .6rem;
  padding: .75rem .9rem; border-radius: var(--radius); margin: .4rem 0 .8rem; font-size: .92rem;
}
.banner form { margin: 0; }
.banner.draft { background: var(--accent-soft); color: var(--accent); }
.banner.stale { background: var(--warning-soft); color: var(--warning); }
.banner .banner-actions { display: flex; gap: .4rem; }

.fix-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin: .6rem 0 .4rem; }
.fix-actions form { margin: 0; display: contents; }
.fix-actions .button { width: 100%; }

.fix-section {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .1rem .95rem .6rem; margin: .7rem 0; box-shadow: var(--shadow);
}
.fix-section h2 { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: .85rem 0 .3rem; }
.fix-section.solution { border-left: 4px solid var(--success); }
.sources { margin: .3rem 0 .6rem; padding-left: 1.1rem; overflow-wrap: anywhere; }
.sources li { margin: .3rem 0; }

.file-list { list-style: none; margin: .2rem 0 .5rem; padding: 0; }
.file-list li { display: flex; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--border); }
.file-list li:last-child { border-bottom: none; }
.file-icon {
  flex: none; width: 2.4rem; height: 2.4rem; border-radius: 8px; display: grid; place-items: center;
  background: var(--surface-2); color: var(--muted); font-size: .66rem; font-weight: 700; text-transform: uppercase;
}
.file-name { flex: 1; min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.file-name .muted { display: block; font-weight: normal; }
.file-actions { display: flex; gap: .4rem; flex: none; }

.related-list { list-style: none; margin: .2rem 0 .5rem; padding: 0; }
.related-list li a { display: block; padding: .5rem 0; border-bottom: 1px solid var(--border); font-weight: 500; }
.related-list li:last-child a { border-bottom: none; }

.danger-zone { margin-top: 2rem; display: flex; justify-content: center; }

/* Markdown content */
.md { overflow-wrap: anywhere; }
.md.small { font-size: .92rem; color: var(--muted); }
.md p { margin: .45rem 0; }
.md ul, .md ol { padding-left: 1.3rem; }
.md li { margin: .2rem 0; }
.md img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 8px; margin: .4rem 0; cursor: zoom-in; display: block; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: .6rem 0; }
.md table { border-collapse: collapse; }
.md th, .md td { border: 1px solid var(--border); padding: .35rem .6rem; text-align: left; white-space: nowrap; }
.md blockquote { margin: .5rem 0; padding: .1rem .9rem; border-left: 3px solid var(--border); color: var(--muted); }

/* ================= code ================= */

code {
  font-family: "Cascadia Code", Consolas, "SFMono-Regular", Menlo, monospace;
  font-size: .86em; background: var(--code-bg); padding: .1em .35em; border-radius: 4px;
  overflow-wrap: anywhere;
}
.code-wrap { position: relative; margin: .5rem 0; }
pre {
  background: var(--code-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: .8rem .9rem; margin: 0; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.code-wrap pre { padding-top: 2.4rem; }          /* room for the Copy button on phones */
pre code { background: none; padding: 0; font-size: .82rem; line-height: 1.55; white-space: pre; overflow-wrap: normal; display: block; }
.copy-button {
  position: absolute; top: .4rem; right: .4rem; z-index: 2;
  font: inherit; font-size: .82rem; font-weight: 600; min-height: 2rem; padding: .25rem .8rem;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); cursor: pointer;
}
.copy-button.copied { color: var(--success); border-color: var(--success); }

/* snippet fill-in boxes for {{placeholders}} */
.placeholders { display: grid; gap: .5rem; margin: .6rem 0 .3rem; }
.placeholders label { display: flex; flex-direction: column; gap: .2rem; font-size: .8rem; font-weight: 600; color: var(--muted); }
.placeholders input { font-family: "Cascadia Code", Consolas, monospace; }
code .ph { background: var(--accent-soft); color: var(--accent); border-radius: 3px; padding: 0 .15em; font-weight: 600; }
code .ph.filled { background: var(--success-soft); color: var(--success); }

/* highlight.js colours */
.hljs-keyword, .hljs-built_in, .hljs-selector-tag, .hljs-literal { color: var(--c-keyword); }
.hljs-string, .hljs-attr, .hljs-addition { color: var(--c-string); }
.hljs-number, .hljs-symbol { color: var(--c-number); }
.hljs-comment, .hljs-quote { color: var(--c-comment); font-style: italic; }
.hljs-variable, .hljs-template-variable, .hljs-params { color: var(--c-variable); }
.hljs-title, .hljs-function, .hljs-section { color: var(--c-function); }
.hljs-deletion { color: var(--danger); }

/* ================= history ================= */

.version-list { list-style: none; padding: 0; margin: 0; }
.version-list li a {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: .75rem .9rem; margin-bottom: .5rem; color: var(--text);
}
.version-list li a:hover { text-decoration: none; border-color: var(--accent); }
.version-list .when { font-weight: 600; }
.diff { font-family: "Cascadia Code", Consolas, monospace; font-size: .8rem; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; margin: .4rem 0 1rem; }
.diff div { padding: .2rem .6rem; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 1.4em; }
.diff .del { background: var(--diff-del); }
.diff .add { background: var(--diff-add); }
.diff .gap { color: var(--muted); background: var(--surface-2); text-align: center; }
.diff .del::before { content: '− '; color: var(--danger); }
.diff .add::before { content: '+ '; color: var(--success); }
.diff .ctx::before { content: '  '; }
.diff-legend { display: flex; gap: 1rem; font-size: .85rem; margin-bottom: .5rem; }
.diff-legend .del { color: var(--danger); }
.diff-legend .add { color: var(--success); }

/* ================= forms ================= */

input[type=text], input[type=search], input[type=password], select, textarea {
  font: inherit; font-size: 16px;          /* 16px stops iPhones zooming in when you tap a box */
  color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: .6rem .75rem; width: 100%;
  min-height: 2.75rem;
}
input[type=file] { font: inherit; font-size: .9rem; max-width: 100%; color: var(--muted); }
input[type=file]::file-selector-button {
  font: inherit; font-weight: 600; font-size: .92rem; min-height: 2.75rem; padding: .5rem 1rem; margin-right: .7rem;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); cursor: pointer;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
textarea { resize: vertical; min-height: 5rem; line-height: 1.5; }
.code-editor { font-family: "Cascadia Code", Consolas, monospace; font-size: 14px; tab-size: 4; white-space: pre; overflow-x: auto; }
@media (max-width: 759px) {
  .code-editor { font-size: 16px; }
  /* On phones, long code lines wrap instead of scrolling sideways (Copy still copies the original lines) */
  pre code { white-space: pre-wrap; overflow-wrap: anywhere; }
}

.form { display: flex; flex-direction: column; gap: 1.1rem; max-width: 820px; }
.form.narrow { max-width: 420px; }
.form label, .field-label { font-weight: 600; display: flex; flex-direction: column; gap: .35rem; }
.form label .hint, .field-label .hint { font-weight: normal; }
.row { display: grid; grid-template-columns: 1fr; gap: 1.1rem; }
.form-actions { display: flex; flex-direction: column; gap: .6rem; }
.form-actions .button { width: 100%; }
.md-hint { margin: -.3rem 0 0; font-size: .85rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }

/* Write / Preview tabs on text boxes */
.editor { display: flex; flex-direction: column; gap: .35rem; }
.editor-tabs { display: flex; align-items: center; gap: .25rem; }
.editor-tabs .label { font-weight: 600; margin-right: auto; }
.editor-tab {
  font: inherit; font-size: .82rem; font-weight: 600; padding: .3rem .7rem; min-height: 2rem;
  border: none; border-radius: 7px; background: none; color: var(--muted); cursor: pointer;
}
.editor-tab.on { background: var(--surface-2); color: var(--text); }
.preview {
  border: 1px dashed var(--border); border-radius: 10px; padding: .4rem .8rem; min-height: 5rem;
  background: var(--surface);
}
.editor-tools { display: flex; gap: 1rem; }
.link-button {
  background: none; border: none; padding: .35rem 0; min-height: 2rem;
  color: var(--accent); font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer;
  display: inline-flex; align-items: center; gap: .3rem;
}
.uploading { opacity: .5; }

/* "similar fixes" box under the title */
.similar {
  background: var(--warning-soft); color: var(--text); border-radius: 10px; padding: .6rem .8rem; font-size: .9rem;
}
.similar strong { color: var(--warning); display: block; margin-bottom: .2rem; font-size: .85rem; }
.similar a { display: block; padding: .3rem 0; font-weight: 500; }

/* related fixes picker */
.picker { position: relative; }
.picker-results {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 15; margin-top: .25rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .15); overflow: hidden;
}
.picker-results button {
  display: block; width: 100%; text-align: left; font: inherit; font-size: .95rem;
  padding: .7rem .85rem; border: none; border-bottom: 1px solid var(--border); background: none; color: var(--text); cursor: pointer;
}
.picker-results button:last-child { border-bottom: none; }
.picker-results button:hover, .picker-results button:focus { background: var(--surface-2); }
.picked { display: flex; flex-wrap: wrap; gap: .4rem; }
.picked .chip { gap: .35rem; color: var(--text); padding-right: .3rem; white-space: normal; }
.picked .chip button {
  border: none; background: var(--border); color: var(--text); border-radius: 50%;
  width: 1.4rem; height: 1.4rem; line-height: 1; cursor: pointer; font-size: .9rem; flex: none;
}

.attach-list { list-style: none; padding: 0; margin: 0; }
.attach-list li { display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .45rem 0; border-bottom: 1px solid var(--border); font-weight: normal; }
.attach-list label { flex-direction: row; align-items: center; font-weight: 500; font-size: .88rem; color: var(--danger); gap: .3rem; }
.attach-list input { width: 1.1rem; height: 1.1rem; }

/* ================= buttons, messages ================= */

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.2;
  min-height: 2.75rem; padding: .55rem 1rem; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  text-align: center;
}
.button:hover { text-decoration: none; }
@media (hover: hover) { .button:hover { background: var(--surface-2); } .button.primary:hover { filter: brightness(1.08); background: var(--accent); } }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.button.success { background: var(--success-soft); border-color: transparent; color: var(--success); }
.button.danger { background: var(--danger-soft); border-color: transparent; color: var(--danger); }
.button.small { min-height: 2.25rem; padding: .35rem .75rem; font-size: .88rem; }
.button.wide { width: 100%; }

.flash { padding: .75rem 1rem; border-radius: 10px; margin-bottom: .9rem; background: var(--accent-soft); font-weight: 500; }
.flash.success { background: var(--success-soft); color: var(--success); }
.flash.error { background: var(--danger-soft); color: var(--danger); }

.auth-box {
  max-width: 380px; margin: 3rem auto; padding: 1.6rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow);
}

.big-search { margin: .4rem 0 1.2rem; }
.big-search input { font-size: 18px; min-height: 3.2rem; border-radius: 14px; }

.zoom-overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .9); z-index: 50;
  display: grid; place-items: center; cursor: zoom-out; padding: 1rem;
}
.zoom-overlay img { max-width: 100%; max-height: 100%; border-radius: 6px; }

/* ================= bigger screens ================= */

@media (min-width: 760px) {
  .desktop-only { display: initial !important; }
  .phone-only { display: none !important; }
  .tabbar { display: none; }
  .page { padding: 1.4rem 1rem 4rem; }
  .topbar-inner { padding: .55rem 1rem; gap: 1rem; }
  .brand-name { display: inline; }
  .search input { height: 2.4rem; }
  .page-title { font-size: 1.6rem; }
  .columns { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 2rem; }
  .hero { text-align: center; padding: 1.2rem 0 .4rem; }
  .hero h1 { display: block; font-size: 1.8rem; margin: 0 0 1rem; }
  .hero-search { display: flex; gap: .5rem; max-width: 680px; margin: 0 auto .6rem; }
  .hero-search input { flex: 1; font-size: 1.05rem; }
  .stat-line { text-align: center; }
  .attention { justify-content: center; }
  .row { grid-template-columns: 1fr 1fr; }
  .form-actions { flex-direction: row; }
  .form-actions .button { width: auto; }
  .fix-actions { display: flex; flex-wrap: wrap; justify-content: flex-start; }
  .fix-actions .button { width: auto; }
  .filters { display: flex; flex-wrap: wrap; gap: 1rem; }
  .filters select { width: auto; }
  .segmented { margin: 0 0 .8rem; padding: 0; flex-wrap: wrap; }
  .code-wrap pre { padding-top: .8rem; padding-right: 5.5rem; }
  .danger-zone { justify-content: flex-end; }
  .placeholders { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* ================= More menu, Personal, Tools ================= */

.menu-list { display: flex; flex-direction: column; gap: .6rem; margin: .4rem 0 1rem; max-width: 640px; }
.menu-item {
  display: flex; align-items: center; gap: .8rem; padding: .85rem .9rem; min-height: 4rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--text);
}
.menu-item:hover { text-decoration: none; border-color: var(--accent); }
.menu-item > .svg-icon { color: var(--muted); }
.menu-icon {
  display: grid; place-items: center; width: 2.5rem; height: 2.5rem; flex: none;
  border-radius: 10px; background: var(--accent-soft); color: var(--accent);
}
.menu-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .1rem; }
.menu-text .muted { overflow-wrap: anywhere; }
.space-intro { margin: -.3rem 0 .8rem; }

.badge.expired { background: var(--danger-soft); color: var(--danger); }
.domain.expired { border-left: 4px solid var(--danger); }
.domain.soon { border-left: 4px solid var(--warning); }
.domain .expiry { font-weight: 600; font-size: .9rem; }
.domain.expired .expiry { color: var(--danger); }
.domain.soon .expiry { color: var(--warning); }

input[type=date], input[type=datetime-local] {
  font: inherit; font-size: 16px; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: .6rem .75rem; width: 100%; min-height: 2.75rem;
}
.form label.check { flex-direction: row; align-items: center; gap: .6rem; font-weight: 500; }
.form label.check input { width: 1.25rem; height: 1.25rem; flex: none; }

.tool { max-width: 640px; }
.tool input[type=text] { font-family: "Cascadia Code", Consolas, monospace; }
.tool-error { color: var(--danger); font-weight: 500; margin: .5rem 0 0; }
.tool-results {
  display: grid; grid-template-columns: auto 1fr; gap: .45rem 1rem; margin: .9rem 0 0;
  font-size: .95rem;
}
.tool-results dt { color: var(--muted); }
.tool-results dd { margin: 0; font-family: "Cascadia Code", Consolas, monospace; overflow-wrap: anywhere; }
.tool-results dd.full { grid-column: 1 / -1; font-family: inherit; }

.tool h2 { font-size: 1rem; }
.tool h2.tool-first { margin-top: .8rem; }
.lookup-form { display: flex; gap: .5rem; margin: .9rem 0 .4rem; }
.lookup-form input { flex: 1; min-width: 0; }
.lookup-form .button { flex: none; }
.lookup-section h2 { margin-top: 1.2rem; }

/* ticks and crosses (IP range checker, blacklists) */
.range-results { list-style: none; padding: 0; margin: .9rem 0 0; display: flex; flex-direction: column; gap: .45rem; }
.range-results li {
  display: flex; flex-wrap: wrap; gap: .2rem .7rem; align-items: baseline; padding: .55rem .75rem;
  border-radius: 10px; background: var(--surface-2); overflow-wrap: anywhere;
}
.range-results li strong { flex: none; }
.range-results li.in strong { color: var(--success); }
.range-results li.out strong { color: var(--danger); }
.range-results li.bad strong { color: var(--warning); }

/* error lookup */
.error-results { margin-top: .8rem; }
.error-card { margin: .6rem 0; }
.error-meaning { margin: .35rem 0; }
.error-tip { margin: .35rem 0; padding: .5rem .7rem; border-radius: 8px; background: var(--accent-soft); font-size: .92rem; }
.error-links { display: flex; flex-wrap: wrap; gap: .5rem; margin: .9rem 0 0; }

/* permission calculator */
.perm-grid { border-collapse: collapse; margin: .4rem 0 1rem; }
.perm-grid th, .perm-grid td { padding: .35rem .7rem; text-align: center; }
.perm-grid th[scope=row] { text-align: left; font-weight: 600; }
.perm-grid thead th { color: var(--muted); font-size: .85rem; font-weight: 600; }
.perm-grid input { width: 1.4rem; height: 1.4rem; }
.perm-row { margin-bottom: .6rem; }
.perm-row label { font-weight: 600; display: flex; flex-direction: column; gap: .35rem; }
.perm-row input { font-family: "Cascadia Code", Consolas, monospace; }
.ref-table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.ref-table th, .ref-table td { border-bottom: 1px solid var(--border); padding: .45rem .5rem; text-align: left; vertical-align: top; }
.ref-table th { color: var(--muted); font-size: .8rem; }

/* password generator */
.pw-mode { margin: .8rem 0 .2rem; padding: 0; }
.pw-output code { font-size: 1.15rem; overflow-wrap: anywhere; white-space: pre-wrap; }
.pw-options { margin-top: 1.1rem; }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.check-grid .check:last-child { grid-column: 1 / -1; }
input[type=range] { width: 100%; accent-color: var(--accent); }

/* ================= Personal ================= */

.mono { font-family: "Cascadia Code", Consolas, monospace; }
.chip.mono { font-size: .8rem; }
.list-search { margin: 0 0 .8rem; }
.tag-filter { margin: 0 0 .8rem; }
.chip.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.chip.on .muted { color: inherit; }
.log-entry .md.small { color: var(--text); }
.note-body { padding: .6rem 1rem; }
.progress-line { display: flex; align-items: center; gap: .6rem; margin: .4rem 0; }
.progress-line progress { flex: 1; }
.learning.done .item-title { color: var(--muted); }
.related-box { margin-top: 1.5rem; max-width: 820px; }
.related-box .button { margin-top: .5rem; }

/* home network */
.net-tabs { margin-bottom: 1rem; }
.net-actions { margin: 0 0 .8rem; }
.device .chip, .scan-summary + .meta .chip { gap: .3rem; }
.device-foot { margin: .3rem 0 0; }
.scan-summary { text-align: left !important; }
.import-box p { margin-top: .8rem; }
.import-box form { margin: 0 0 .2rem; }
.detected { font-size: 1.15rem; margin: .4rem 0 .8rem; }
.detected .muted { font-size: .85rem; }
.other-nets { margin: .9rem 0 .3rem; }
.manual-scan { margin-top: 1rem; }
.manual-scan summary { cursor: pointer; font-weight: 600; color: var(--accent); padding: .3rem 0; }
progress { width: 100%; height: .8rem; accent-color: var(--accent); }

.connection { border: 1px solid var(--border); margin: 0 0 .7rem; min-width: 0; }
.connection legend { padding: 0 .3rem; font-weight: 600; }
.connection-fields { display: grid; gap: .6rem; }
.connection-fields label { display: flex; flex-direction: column; gap: .25rem; font-size: .82rem; font-weight: 600; color: var(--muted); }
.sticky-save {
  position: sticky; bottom: calc(var(--tabbar-h) + var(--safe-bottom) + .5rem); z-index: 5;
  background: var(--bg); padding: .5rem 0; margin-top: .5rem;
}

.diagram-wrap {
  overflow: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); margin: .2rem 0 1rem; max-height: 75vh;
}
.net-diagram { display: block; font-family: inherit; }
.net-diagram .edge { fill: none; stroke: var(--muted); stroke-width: 1.6; opacity: .7; }
.net-diagram .edge-label { font-size: 11px; fill: var(--muted); }
.net-diagram .edge.wifi, .diagram-key .edge.wifi { stroke-dasharray: 7 5; }
.net-diagram .edge.virtual, .diagram-key .edge.virtual { stroke-dasharray: 2 4; }
.net-diagram .node-stripe.wifi { fill: var(--accent); }
.diagram-key { display: flex; flex-wrap: wrap; gap: .4rem 1.2rem; font-size: .85rem; color: var(--muted); margin: -.4rem 0 1rem; }
.diagram-key span { display: inline-flex; align-items: center; gap: .4rem; }
.diagram-key .edge { fill: none; stroke: var(--muted); stroke-width: 1.6; }
.add-device { margin-bottom: 1rem; }
.add-device summary { cursor: pointer; font-weight: 600; color: var(--accent); padding: .6rem 0 .2rem; }
.add-device .form { gap: .7rem; max-width: none; }
.net-diagram .group-label { font-size: 12px; font-weight: 600; fill: var(--muted); }
.net-diagram .node { fill: var(--surface-2); stroke: var(--border); stroke-width: 1; }
.net-diagram .node.loose { stroke-dasharray: 4 3; }
.net-diagram a:hover .node, .net-diagram a:focus .node { stroke: var(--accent); stroke-width: 2; }
.net-diagram .node-name { font-size: 13px; font-weight: 600; fill: var(--text); }
.net-diagram .node-sub { font-size: 11px; fill: var(--muted); }
.net-diagram .node-stripe { fill: var(--muted); }
.net-diagram .node-stripe.router { fill: var(--danger); }
.net-diagram .node-stripe.switch, .net-diagram .node-stripe.ap { fill: var(--accent); }
.net-diagram .node-stripe.server, .net-diagram .node-stripe.vm { fill: var(--success); }
.net-diagram .node-stripe.printer, .net-diagram .node-stripe.camera, .net-diagram .node-stripe.smart { fill: var(--warning); }

@media (min-width: 760px) {
  .connection-fields { grid-template-columns: 1fr 1.3fr .8fr 1fr; }
  .add-device .connection-fields { grid-template-columns: 1.2fr 1fr 1.3fr .8fr 1fr; }
  .sticky-save { bottom: 0; }
}

/* Medium screens (tablets, narrow windows): Personal and Tools fold into a More link */
@media (min-width: 760px) and (max-width: 1099px) { .wide-only { display: none !important; } }
@media (min-width: 1100px), (max-width: 759px) { .mid-only { display: none !important; } }

/* ================= share links ================= */
.share-new { border-color: var(--accent); }
.share-new h2, .share-item .code-wrap { margin-top: .4rem; }
.share-item form { margin: .3rem 0 0; }
.share-item.ended { opacity: .65; }
.share-item .code-wrap code { white-space: pre-wrap; overflow-wrap: anywhere; }
.share-warning a { font-weight: 600; }
.shared-foot { text-align: center; margin: 2rem 0 1rem; }

/* ================= sign-in security ================= */
.code-input { font-family: "Cascadia Code", Consolas, monospace; font-size: 1.3rem !important; letter-spacing: .15em; }
.qr { background: #fff; padding: 12px; border-radius: 10px; display: inline-block; margin: .3rem 0 .6rem; line-height: 0; }
.qr img, .qr canvas { display: block; }
.secret-key { font-size: 1.05rem; overflow-wrap: anywhere; background: var(--surface-2); padding: .5rem .7rem; border-radius: 8px; }
.attempts tr.bad td:last-child { color: var(--danger); }
.attempts tr.ok td:last-child { color: var(--success); }
