/* DotSlash — styles. No framework, no web fonts (uses Inter if installed). */

:root {
  --accent: #7AA2F7;
  --on-accent: #0D1220;
  --accent-soft: rgba(122, 162, 247, 0.14);
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --r-sm: 4px;
  --r: 6px;
  --r-lg: 8px;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0F1115; --hdr: #13161B; --line: #1F232A;
  --card: #15181E; --card-hover: #1A1E25; --border: #232830; --border-strong: #2E3440;
  --text: #E6E8EB; --body: #C9CED6; --muted: #8B93A1; --label: #9AA2AF;
  --field: #0F1216; --field-border: #2C313A; --code: #0F1216;
  --dock: rgba(24, 27, 33, 0.94); --dock-border: #2C313A;
  --overlay: rgba(6, 7, 9, 0.62); --danger: #F49DAE; --warn: #F2A65A; --ok: #7FDCCB;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35); --row-active: rgba(122, 162, 247, 0.10);
  --t0b: rgba(122,162,247,.14); --t0f: #9DB8F9;
  --t1b: rgba(94,211,190,.13);  --t1f: #7FDCCB;
  --t2b: rgba(240,180,90,.14);  --t2f: #F2C27C;
  --t3b: rgba(176,140,247,.14); --t3f: #C4A9F9;
  --t4b: rgba(240,120,140,.14); --t4f: #F49DAE;
  --t5b: rgba(160,170,185,.12); --t5f: #B9C0CB;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #F5F6F8; --hdr: #FFFFFF; --line: #E4E7EB;
  --card: #FFFFFF; --card-hover: #FAFBFC; --border: #E3E6EA; --border-strong: #CBD1D9;
  --text: #16191F; --body: #343A44; --muted: #5B6472; --label: #4A525E;
  --field: #F5F6F8; --field-border: #D5DAE0; --code: #F5F6F8;
  --dock: rgba(255, 255, 255, 0.95); --dock-border: #DDE1E6;
  --overlay: rgba(20, 22, 26, 0.35); --danger: #B4233F; --warn: #9A5B00; --ok: #16695C;
  --shadow: 0 10px 30px rgba(20, 22, 26, 0.12); --row-active: rgba(122, 162, 247, 0.12);
  --t0b: #E6EEFC; --t0f: #2B55B5;
  --t1b: #E0F3EF; --t1f: #16695C;
  --t2b: #FBEFD9; --t2f: #8A5A0B;
  --t3b: #EEE8FB; --t3f: #5B3DB0;
  --t4b: #FBE6EA; --t4f: #A3324A;
  --t5b: #ECEEF1; --t5f: #434B57;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.boot, .noscript { padding: 48px; text-align: center; color: var(--muted); }
svg { flex: none; }

/* ---------- header ---------- */
.hdr { background: var(--hdr-bg, var(--hdr)); color: var(--hdr-fg, var(--text)); border-bottom: 1px solid var(--line); padding: 16px 24px 0; }
.hdr-in { max-width: 1160px; margin: 0 auto; display: flex; flex-direction: column; gap: 16px; }
.hdr-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 36px; min-height: 36px; }
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; flex: none; }
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.app-icon { width: 26px; height: 26px; border-radius: 5px; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; background: var(--accent); color: var(--on-accent); overflow: hidden; }
.app-icon img { width: 100%; height: 100%; object-fit: cover; }
.app-icon.logo svg { width: 100%; height: 100%; display: block; }
.app-icon.lib { background: transparent; }
.app-icon.lib img { object-fit: contain; }
.sections { flex: 1 1 200px; display: flex; gap: 24px; }
.tab { height: 36px; display: inline-flex; align-items: center; gap: 6px; padding: 0; border: 0; background: none; color: inherit; opacity: .6; font-size: 14px; font-weight: 500; text-decoration: none; box-shadow: inset 0 -2px 0 transparent; white-space: nowrap; }
.tab:hover { opacity: 1; }
.tab.on { opacity: 1; font-weight: 600; box-shadow: inset 0 -2px 0 var(--accent); }
.clock { display: flex; align-items: baseline; gap: 10px; flex: none; }
.clock-date { font-size: 13px; opacity: .6; }
.clock-time { font-family: var(--mono); font-size: 15px; font-weight: 500; }

.search { position: relative; }
.search-box { display: flex; align-items: center; gap: 12px; height: 44px; padding: 0 14px; background: rgba(127,127,127,.09); border: 1px solid rgba(127,127,127,.2); border-radius: var(--r); }
.search-box:focus-within { border-color: var(--accent); }
.search-box svg { opacity: .7; }
.search-box input { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; font-size: 14px; }
.search-box input::placeholder { color: currentColor; opacity: .55; }
kbd { font-family: var(--mono); font-size: 11px; opacity: .7; border: 1px solid rgba(127,127,127,.35); border-radius: 3px; padding: 1px 6px; }
.results { position: absolute; z-index: 30; top: calc(100% + 6px); left: 0; right: 0; max-height: min(60vh, 460px); overflow: auto; background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 4px; }
.result { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; padding: 6px 10px; border: 0; border-radius: var(--r-sm); background: none; text-align: left; color: inherit; text-decoration: none; }
.result.sel, .result:hover { background: var(--row-active); }
.result-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.result-title { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-ctx { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-kind { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.result-glyph { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: var(--r-sm); background: rgba(127,127,127,.12); color: var(--muted); }
.results-empty { padding: 14px; color: var(--muted); text-align: center; }

.sub { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 24px; }
.sub-tabs { flex: 1 1 280px; min-width: 0; display: flex; align-items: center; gap: 22px; overflow-x: auto; scrollbar-width: none; }
.sub-tabs::-webkit-scrollbar { display: none; }
.sub .tab { height: 42px; font-size: 13px; }
.sub .tab.on { box-shadow: inset 0 -2px 0 currentColor; }
.tab .count { font-size: 12px; opacity: .6; font-weight: 500; }
.sub-tools { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.sub-tools select { height: 30px; padding: 0 6px; background: transparent; border: 1px solid rgba(127,127,127,.28); border-radius: var(--r-sm); font-size: 12px; }
.sub-tools select option { background: var(--card); color: var(--text); }
.hdr-spacer { height: 6px; }

.ptab { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.ptab .tab { cursor: pointer; }
.ptab.editing { cursor: grab; }
.ptab.drop-before { box-shadow: inset 2px 0 0 var(--accent); }
.ptab.drop-after { box-shadow: inset -2px 0 0 var(--accent); }
.ptab-menu { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; border: 0; border-radius: var(--r-sm); background: transparent; color: inherit; opacity: .7; }
.ptab-menu:hover { background: rgba(127,127,127,.18); opacity: 1; }
.grip { opacity: .45; cursor: grab; }

/* ---------- layout ---------- */
.main { padding: 34px 24px 56px; min-height: calc(100vh - 230px); }
.wrap { max-width: 1160px; margin: 0 auto; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 36px 28px; align-items: start; }
.empty { max-width: 460px; margin: 64px auto; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty h2 { margin: 0; color: var(--text); font-size: 16px; font-weight: 600; }
.empty p { margin: 0; }

/* ---------- links ---------- */
.group { display: flex; flex-direction: column; gap: 10px; padding: 10px; margin: -11px; border: 1px dashed transparent; border-radius: var(--r-lg); }
.editing .group { border-color: var(--border-strong); }
.group.drop-target { border-color: var(--accent); background: var(--accent-soft); }
.group-head { display: flex; align-items: center; gap: 8px; padding: 0 2px; min-height: 22px; }
.group-name { margin: 0; flex: 1; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--label); }
.group-count { font-size: 12px; color: var(--muted); }
.links { display: flex; flex-direction: column; gap: 6px; min-height: 8px; }
.link { position: relative; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 10px 12px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r); text-decoration: none; color: var(--text); }
a.link:hover { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--card-hover); }
.link-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.link-name { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link-host { font-family: var(--mono); font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.link.drop-before::before, .link.drop-after::after { content: ""; position: absolute; left: 6px; right: 6px; height: 2px; border-radius: 1px; background: var(--accent); }
.link.drop-before::before { top: -5px; }
.link.drop-after::after { bottom: -5px; }
.link.dragging { opacity: .45; }
.link-edit { cursor: grab; }
.icon { width: 32px; height: 32px; flex: none; display: flex; align-items: center; justify-content: center; border-radius: var(--r-sm); font-size: 13px; font-weight: 600; overflow: hidden; }
.icon img { width: 78%; height: 78%; object-fit: contain; }
.icon.has-img { background: transparent; }
.t0 { background: var(--t0b); color: var(--t0f); } .t1 { background: var(--t1b); color: var(--t1f); }
.t2 { background: var(--t2b); color: var(--t2f); } .t3 { background: var(--t3b); color: var(--t3f); }
.t4 { background: var(--t4b); color: var(--t4f); } .t5 { background: var(--t5b); color: var(--t5f); }

/* tiles layout */
.layout-tiles .grid { grid-template-columns: repeat(auto-fill, minmax(500px, 1fr)); }
.layout-tiles .links { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.layout-tiles .link { flex-direction: column; justify-content: center; text-align: center; gap: 8px; height: 112px; padding: 12px 8px; }
.layout-tiles .link .icon { width: 46px; height: 46px; font-size: 16px; border-radius: var(--r); }
.layout-tiles .link-text { flex: none; width: 100%; }
.layout-tiles .link-host { display: none; }
.layout-tiles .link-name { font-size: 13px; }
.layout-tiles .link-edit .grip { position: absolute; top: 6px; left: 6px; }
.layout-tiles .link-edit .edit-btn { position: absolute; top: 2px; right: 2px; }
/* rows layout: one full-width row per group, links flow in a grid */
.layout-rows .grid { grid-template-columns: minmax(0, 1fr); gap: 30px; }
.layout-rows .group-head { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.layout-rows .links { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px; }
.layout-rows .link .link-host { font-size: 11.5px; }
/* compact layout */
.layout-compact .grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 28px 24px; }
.layout-compact .links { gap: 2px; }
.layout-compact .group-head { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.layout-compact .link { background: transparent; border-color: transparent; min-height: 38px; padding: 6px 8px; }
.layout-compact a.link:hover { background: var(--card); border-color: var(--border); }
.layout-compact .link .icon { width: 20px; height: 20px; font-size: 10px; }
.layout-compact .link-host { display: none; }

/* ---------- buttons & fields ---------- */
.btn { text-decoration: none; color: var(--text); height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px; background: transparent; border: 1px solid var(--field-border); border-radius: var(--r); font-size: 13px; font-weight: 500; white-space: nowrap; }
.btn:hover { background: rgba(127,127,127,.12); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { color: var(--danger); border-color: transparent; }
.btn.ghost { border-color: transparent; }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn { width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); }
.icon-btn:hover { background: rgba(127,127,127,.14); color: var(--text); }
.icon-btn.on { color: var(--accent); }
.add-btn { min-height: 40px; display: flex; align-items: center; justify-content: center; gap: 8px; background: transparent; border: 1px dashed var(--border-strong); border-radius: var(--r); color: var(--muted); font-size: 13px; }
.add-btn:hover { color: var(--text); border-color: var(--accent); }
.add-group { min-height: 140px; flex-direction: column; border-radius: var(--r-lg); }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--label); }
.input, .select, .textarea { width: 100%; height: 40px; padding: 0 12px; background: var(--field); border: 1px solid var(--field-border); border-radius: var(--r); color: var(--text); font-size: 14px; outline: 0; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input.mono { font-family: var(--mono); font-size: 13px; }
.textarea { height: auto; min-height: 320px; padding: 12px 14px; line-height: 1.6; resize: vertical; font-family: var(--mono); font-size: 13.5px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text); cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; padding: 3px; background: var(--field); border: 1px solid var(--border); border-radius: var(--r); }
.seg button { height: 32px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--muted); font-size: 13px; }
.seg button[aria-pressed="true"] { background: var(--card-hover); color: var(--text); box-shadow: 0 0 0 1px var(--border-strong); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatch { width: 30px; height: 30px; border-radius: 5px; border: 1px solid var(--border-strong); padding: 0; }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--text); }
.swatch.default { background: linear-gradient(135deg, var(--hdr) 50%, var(--bg) 50%); }

/* ---------- dock ---------- */
.dock { position: fixed; right: 24px; bottom: 24px; z-index: 40; display: flex; align-items: center; gap: 2px; padding: 4px; background: var(--dock); border: 1px solid var(--dock-border); border-radius: var(--r-lg); box-shadow: var(--shadow); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.dock .sep { width: 1px; height: 20px; margin: 0 4px; background: var(--dock-border); }
.dock-btn { height: 36px; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; background: transparent; border: 0; border-radius: 5px; font-size: 13px; font-weight: 500; color: var(--text); text-decoration: none; }
.dock-btn:hover { background: rgba(127,127,127,.14); }
.dock-btn.icon-only { width: 34px; padding: 0; justify-content: center; color: var(--muted); }
.dock-btn.muted { color: var(--muted); }
.dock-btn.primary { background: var(--accent); color: var(--on-accent); font-weight: 600; padding: 0 16px; }
.dock-btn.active { background: var(--accent-soft); color: var(--accent); }
.dock-btn:disabled { opacity: .4; cursor: default; background: transparent; }

/* ---------- notes ---------- */
.notes { display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-start; }
.note-list { flex: 1 1 280px; max-width: 360px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.note-list-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--border); font-size: 12px; color: var(--muted); }
.note-row { display: flex; flex-direction: column; gap: 3px; width: 100%; padding: 12px 14px; background: transparent; border: 0; border-bottom: 1px solid var(--border); text-align: left; color: inherit; text-decoration: none; }
.note-row:last-child { border-bottom: 0; }
.note-row:hover { background: rgba(127,127,127,.06); }
.note-row.on { background: var(--row-active); }
.note-row-top { display: flex; align-items: center; gap: 8px; }
.note-row-title { flex: 1; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-row-snip { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-row-time { font-size: 12px; color: var(--muted); }
.note { flex: 999 1 480px; min-width: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--r); }
.note-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 18px 22px 14px; border-bottom: 1px solid var(--border); }
.note-titles { flex: 1; min-width: 200px; display: flex; flex-direction: column; gap: 4px; }
.note-title { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.note-title-input { font-size: 20px; font-weight: 600; height: 42px; }
.note-meta { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.note-meta .warn { color: var(--warn); }
.note-actions { display: flex; gap: 4px; align-items: center; }
/* every control in the note header is the same height (36px) */
.note-actions .btn, .note-actions .copy-btn { height: 36px; padding: 0 14px; font-size: 13px; }
.note-actions .icon-btn { width: 36px; height: 36px; }
/* editing: the controls sit on the title input's line, not centered on title + status */
.note-head.is-edit { align-items: flex-start; }
.note-head.is-edit .note-actions { min-height: 42px; }
.note-body { padding: 20px 22px 28px; }
.note-back { display: none; }
.conflict { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 14px 22px 0; padding: 10px 12px; border: 1px solid var(--warn); border-radius: var(--r); color: var(--warn); font-size: 13px; }
.conflict span { flex: 1; }

.md { font-size: 15px; line-height: 1.65; color: var(--body); overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md h1, .md h2, .md h3 { color: var(--text); line-height: 1.3; margin: 1.3em 0 .4em; }
.md h1 { font-size: 20px; } .md h2 { font-size: 17px; } .md h3 { font-size: 15px; }
.md p { margin: 0 0 .8em; }
.md ul, .md ol { margin: 0 0 .8em; padding-left: 1.4em; }
.md li { margin: .15em 0; }
.md li.task { list-style: none; margin-left: -1.4em; display: flex; gap: 8px; align-items: baseline; }
.md li.task input { accent-color: var(--accent); }
.md code { font-family: var(--mono); font-size: 13px; background: var(--code); border: 1px solid var(--border); border-radius: 3px; padding: 0 4px; }
.md pre { margin: 0 0 .9em; padding: 12px 14px; background: var(--code); border: 1px solid var(--border); border-radius: var(--r-sm); overflow-x: auto; }
.md pre code { background: none; border: 0; padding: 0; font-size: 13px; line-height: 1.55; color: var(--text); }
.md blockquote { margin: 0 0 .8em; padding: 2px 0 2px 14px; border-left: 2px solid var(--border-strong); color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--border); margin: 1.2em 0; }
.md a { color: var(--accent); }

/* ---------- tasks ---------- */
.tgrid { gap: 24px; }
.tlist { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.tlist.drop-target { border-color: var(--accent); }
.tlist-head { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px 12px; border-bottom: 1px solid var(--border); }
.tlist-top { display: flex; align-items: center; gap: 10px; }
.tlist-title { margin: 0; flex: 1; font-size: 14px; font-weight: 600; }
.tlist-title-input { height: 32px; font-weight: 600; }
.tlist-prog { font-size: 12px; color: var(--muted); white-space: nowrap; }
.bar { height: 2px; background: var(--border); border-radius: 1px; overflow: hidden; }
.bar > div { height: 2px; background: var(--accent); }
.titems { display: flex; flex-direction: column; padding: 4px 0; }
.titem { display: flex; align-items: center; gap: 12px; min-height: 40px; padding: 4px 8px 4px 16px; }
.titem input[type="checkbox"] { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); flex: none; }
.titem-text { flex: 1; min-width: 0; font-size: 14px; overflow-wrap: anywhere; }
.titem.done .titem-text { color: var(--muted); text-decoration: line-through; }
.titem.flash { animation: flash 1.6s ease; }
@keyframes flash { 0%, 40% { background: var(--accent-soft); } 100% { background: transparent; } }
.due { font-size: 12px; color: var(--muted); white-space: nowrap; background: none; border: 0; padding: 2px 4px; border-radius: var(--r-sm); }
.due.soon { color: var(--warn); } .due.over { color: var(--danger); }
.titem .hover-only { opacity: 0; }
.titem:hover .hover-only, .titem:focus-within .hover-only { opacity: 1; }
.titem .input { height: 32px; }
.date-input { height: 30px; padding: 0 6px; background: var(--field); border: 1px solid var(--field-border); border-radius: var(--r-sm); font-size: 12px; color: var(--text); }
.tadd { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px 0 16px; border-top: 1px solid var(--border); color: var(--muted); }
.tadd input[type="text"] { flex: 1; min-width: 0; background: transparent; border: 0; outline: 0; font-size: 14px; color: var(--text); }
.tadd input::placeholder { color: var(--muted); }
.tempty { margin: 0; padding: 10px 16px; font-size: 13px; color: var(--muted); }

/* ---------- settings ---------- */
.settings-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 28px; }
.settings-head h1 { margin: 0; font-size: 24px; font-weight: 600; letter-spacing: -0.02em; }
.settings-head p { margin: 0; color: var(--muted); }
.settings { display: flex; flex-wrap: wrap; gap: 32px; align-items: flex-start; }
.snav { flex: 1 1 180px; max-width: 200px; display: flex; flex-direction: column; gap: 2px; position: sticky; top: 16px; }
.snav a { height: 36px; display: flex; align-items: center; padding: 0 10px; border-radius: 5px; color: var(--label); text-decoration: none; }
.snav a:hover { color: var(--text); }
.snav a.on { background: var(--card); color: var(--text); font-weight: 600; }
.spanel { flex: 999 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 24px; }
.scard { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); scroll-margin-top: 16px; }
.scard-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.scard-head h2 { margin: 0; font-size: 15px; font-weight: 600; }
.scard-head span { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.srow { display: flex; flex-wrap: wrap; gap: 12px 24px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.srow:last-child { border-bottom: 0; }
.srow-label { flex: 1 1 220px; display: flex; flex-direction: column; gap: 4px; }
.srow-label b { font-size: 14px; font-weight: 500; }
.srow-label span { font-size: 13px; color: var(--muted); }
.srow-ctl { flex: 1 1 300px; display: flex; flex-direction: column; gap: 10px; }
.srow-ctl.inline { flex-direction: row; align-items: center; flex-wrap: wrap; }
.icon-preview { width: 48px; height: 48px; font-size: 20px; border-radius: var(--r); }
.drop { min-height: 96px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 1px dashed var(--border-strong); border-radius: var(--r); color: var(--muted); font-size: 13px; cursor: pointer; text-align: center; padding: 12px; }
.drop.over, .drop:hover { border-color: var(--accent); color: var(--text); }
.backups { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 5px; }
.backup { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.backup:last-child { border-bottom: 0; }
.backup .when { flex: 1; }
.backup .why, .backup .size { font-size: 12px; color: var(--muted); }
.backup .size { width: 70px; text-align: right; font-family: var(--mono); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; padding: 18px 20px; font-size: 13px; }
.kv div { display: flex; flex-direction: column; gap: 4px; }
.kv span { color: var(--muted); }
.kv code, .mono { font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.notice { padding: 10px 12px; border: 1px solid var(--warn); border-radius: var(--r); color: var(--warn); font-size: 13px; }

/* ---------- blank, locked ---------- */
.blank { min-height: calc(100vh - 290px); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; opacity: .75; }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: var(--overlay); display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 24px; overflow-y: auto; }
.modal { width: 100%; max-width: 460px; background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: 0 24px 60px rgba(0,0,0,.45); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 6px; }
.modal-head h3 { margin: 0; font-size: 16px; font-weight: 600; }
.modal-body { display: flex; flex-direction: column; gap: 16px; padding: 12px 20px 20px; }
.modal-body p { margin: 0; color: var(--body); }
.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); }
.modal-foot .right { display: flex; gap: 8px; margin-left: auto; }
.preview-row { display: flex; align-items: center; gap: 14px; padding: 12px; background: var(--field); border: 1px solid var(--border); border-radius: var(--r); }
.preview-row .icon { width: 40px; height: 40px; font-size: 15px; }
.row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: 0; }
.hint { font-size: 12px; color: var(--muted); }
.login-page { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 14vh 16px 24px; }

.menu { position: fixed; z-index: 55; min-width: 190px; padding: 4px; background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--r); box-shadow: var(--shadow); }
.menu button { width: 100%; height: 36px; display: flex; align-items: center; gap: 10px; padding: 0 10px; background: transparent; border: 0; border-radius: var(--r-sm); text-align: left; font-size: 13px; }
.menu button:hover { background: rgba(127,127,127,.12); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px; }

/* ---------- toasts ---------- */
.toasts { position: fixed; left: 24px; bottom: 24px; z-index: 70; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 48px); }
.toast { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--r); box-shadow: var(--shadow); font-size: 13px; }
.toast.err { border-color: var(--danger); }
.toast button { background: none; border: 0; color: var(--accent); font-weight: 600; padding: 0; }

/* ---------- small screens ---------- */
@media (max-width: 760px) {
  .hdr { padding: 12px 16px 0; }
  .hdr-row { gap: 10px 20px; }
  .clock-date { display: none; }
  .main { padding: 24px 16px 40px; }
  .foot { padding-bottom: 80px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .layout-tiles .grid { grid-template-columns: minmax(0, 1fr); }
  .dock { right: 12px; bottom: 12px; }
  .toasts { left: 12px; bottom: 72px; }
  .notes.has-note .note-list { display: none; }
  .notes:not(.has-note) .note { display: none; }
  .note-list { max-width: none; }
  .note-back { display: inline-flex; }
  .snav { position: static; max-width: none; flex-direction: row; overflow-x: auto; }
  .row2 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- edit lock ---------- */
.hdr.locked .sections, .hdr.locked .brand { opacity: .35; pointer-events: none; }
.hdr.locked .search-box { opacity: .5; }

/* ---------- icon picker ---------- */
.ipick-wrap { position: relative; }
.ipick { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; right: 0; max-height: 268px; overflow-y: auto;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 4px; padding: 6px;
  background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow); }
.ipick[hidden] { display: none; }
.ipick-item { height: 78px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 7px; padding: 6px 4px;
  background: transparent; border: 1px solid transparent; border-radius: var(--r); color: var(--text); font-size: 11px; min-width: 0; }
.ipick-item img { width: 30px; height: 30px; object-fit: contain; }
.ipick-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.ipick-item:hover, .ipick-item.on { background: var(--row-active); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.ipick-item:hover span, .ipick-item.on span, .ipick-item.exact span { color: var(--text); }
.ipick-empty { grid-column: 1 / -1; padding: 12px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- footer ---------- */
.foot { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 20px 24px 92px; font-size: 12px; color: var(--muted); }
.foot a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--border-strong); }
.foot a:hover { color: var(--text); border-color: var(--accent); }

/* ---------- visibility ---------- */
.tab-lock { display: inline-flex; opacity: .55; margin-left: 2px; }
.vis-list { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--r); }
.vis-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 12px; border-bottom: 1px solid var(--line); }
.vis-row:last-child { border-bottom: 0; }
.vis-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 14px; }
.vis-name svg { color: var(--muted); }
.vis-row .seg { width: 180px; flex: none; }
.checks { display: flex; flex-wrap: wrap; gap: 10px 20px; }
.checks input:disabled { opacity: .6; }
.flash { animation: flash 1.6s ease; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font-size: inherit; font-weight: 600; }

/* ---------- chips ---------- */
.chip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 3px; background: var(--accent-soft); color: var(--text); font-size: 11.5px; font-weight: 500; white-space: nowrap; }

/* ---------- snippets ---------- */
.sgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(440px, 1fr)); gap: 18px; align-items: start; }
.snip { display: flex; flex-direction: column; min-width: 0; background: var(--card); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.snip-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--border); }
.snip-title { margin: 0; flex: 1; min-width: 0; font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snip-actions { display: flex; align-items: center; gap: 2px; }
.copy-btn { height: 30px; padding: 0 10px; font-size: 12px; }
.copy-btn.ok { color: var(--ok); border-color: var(--ok); }
.snip-body { margin: 0; padding: 12px 16px; max-height: 240px; overflow: auto; background: var(--code); font: 13px/1.55 var(--mono); color: var(--text); white-space: pre; }
.snip-body code { font: inherit; }
.editing .snip { border-style: dashed; border-color: var(--border-strong); }

/* ---------- sheet (directory table) ---------- */
.sheet-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--r); }
.sheet { width: 100%; min-width: 760px; border-collapse: collapse; font-size: 14px; }
.sheet th { position: sticky; top: 0; text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--label); background: var(--card); border-bottom: 1px solid var(--border); padding: 0 14px; height: 40px; white-space: nowrap; }
.sheet td { padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.sheet tbody tr:last-child td { border-bottom: 0; }
.sheet tbody tr:hover td { background: rgba(127,127,127,.04); }
.sheet .c-name { font-weight: 500; white-space: nowrap; }
.sheet .c-notes { color: var(--muted); max-width: 340px; }
.sheet td.mono { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.sheet a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--border-strong); }
.sheet a:hover { border-color: var(--accent); }
.th-btn { display: inline-flex; align-items: center; gap: 4px; height: 40px; padding: 0; background: none; border: 0; color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit; }
.th-btn:hover { color: var(--text); }
.th-btn .sort { color: var(--accent); }
.sheet.editing td { padding: 0; border-right: 1px solid var(--line); }
.sheet.editing td:last-child { border-right: 0; }
.sheet.editing th { border-right: 1px solid var(--line); }
.cell { width: 100%; height: 40px; padding: 0 12px; background: transparent; border: 0; outline: 0; color: var(--text); font-size: 14px; }
.cell:focus { background: var(--field); box-shadow: inset 0 0 0 2px var(--accent); }
.cell::placeholder { color: var(--muted); opacity: .45; }
.sheet .col-act { width: 44px; text-align: center; }
.sheet tr.saving td { opacity: .6; }
.sheet-add { margin-top: 10px; width: 100%; }

/* ---------- scratchpad ---------- */
.pad { position: fixed; z-index: 45; width: 340px; height: 280px; min-width: 240px; min-height: 160px; max-width: calc(100vw - 16px); max-height: calc(100vh - 16px);
  display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow); resize: both; overflow: hidden; }
.pad[hidden] { display: none; }
.pad.dragging { opacity: .92; user-select: none; }
.pad-head { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 12px; border-bottom: 1px solid var(--border); cursor: grab; user-select: none; touch-action: none; }
.pad.dragging .pad-head { cursor: grabbing; }
.pad-title { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; }
.pad-title svg { color: var(--accent); }
.pad-status { flex: 1; display: flex; align-items: center; justify-content: flex-end; gap: 4px; font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; }
.pad-status .warn { color: var(--warn); }
.pad .icon-btn { width: 30px; height: 30px; }
.pad-text { flex: 1; width: 100%; resize: none; padding: 12px 14px; background: transparent; border: 0; outline: 0; color: var(--text); font: 14px/1.55 var(--font); }
.pad-text::placeholder { color: var(--muted); opacity: .7; }

@media (max-width: 760px) {
  .sgrid { grid-template-columns: minmax(0, 1fr); }
  .pad { left: 12px !important; right: 12px; top: auto !important; bottom: 72px; width: auto !important; height: 42vh !important; resize: none; }
  .pad-head { cursor: default; }
  .vis-row .seg { width: 150px; }
}

/* ---------- notes: types & code copy ---------- */
.row-kind { display: inline-flex; color: var(--accent); }
.row-kind.big { margin-right: 8px; vertical-align: -1px; }
.note-row-snip.mono { font-family: var(--mono); font-size: 12px; }
.type-seg { width: 170px; }
.type-seg button { height: 28px; }
.note-actions .type-seg { padding: 3px; }
.textarea.code { white-space: pre; overflow-wrap: normal; overflow-x: auto; }
a.snip-title { color: var(--text); text-decoration: none; }
a.snip-title:hover { color: var(--accent); }
.snip-body { cursor: copy; }
.snip-full { max-height: none; border: 1px solid var(--border); border-radius: var(--r-sm); }
.code-wrap { position: relative; margin: 0 0 .9em; }
.code-wrap pre { margin: 0; padding-right: 44px; }
.code-copy { position: absolute; top: 6px; right: 6px; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; padding: 0;
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--muted); opacity: .75; }
.code-wrap:hover .code-copy, .code-copy:focus-visible { opacity: 1; }
.code-copy:hover { color: var(--text); border-color: var(--border-strong); }
.code-copy.ok { color: var(--ok); border-color: var(--ok); opacity: 1; }

/* ---------- directory ---------- */
.sheet.dir { min-width: 0; }
.sheet.dir.editing { min-width: 1280px; }
.sheet.dir.viewing td { white-space: nowrap; }
.sheet.dir.viewing td.col-notes, .sheet.dir.viewing td.col-address { white-space: normal; min-width: 180px; }
.sheet.dir .col-name { font-weight: 500; }
.sheet.dir .col-notes { color: var(--muted); }
.sheet.dir.editing .col-name { width: 180px; }
.sheet.dir.editing .col-category { width: 130px; }
.sheet.dir.editing .col-notes { width: 220px; }
.val { cursor: copy; border-radius: 3px; padding: 1px 3px; margin: -1px -3px; }
.val:hover { background: var(--accent-soft); }
.val.mono, .cell.mono { font-family: var(--mono); font-size: 13px; }
.cell-act { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-left: 6px; vertical-align: middle;
  border-radius: 4px; color: var(--muted); opacity: .55; text-decoration: none; border: 0 !important; }
tr:hover .cell-act, .cell-act:focus-visible { opacity: 1; }
.cell-act:hover { color: var(--accent); background: var(--accent-soft); }
.dir-hint { margin: 10px 2px 0; }

@media (max-width: 760px) {
  /* The directory turns into stacked cards on phones. */
  .sheet.dir.viewing, .sheet.dir.viewing tbody, .sheet.dir.viewing tr, .sheet.dir.viewing td { display: block; width: 100%; }
  .sheet.dir.viewing thead { display: none; }
  .sheet-wrap:has(.sheet.dir.viewing) { background: transparent; border: 0; overflow: visible; }
  .sheet.dir.viewing tr { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 10px 14px; margin-bottom: 10px; }
  .sheet.dir.viewing td { border: 0; padding: 4px 0; white-space: normal; display: flex; align-items: center; gap: 10px; min-height: 30px; }
  .sheet.dir.viewing td:empty { display: none; }
  .sheet.dir.viewing td::before { content: attr(data-label); flex: none; width: 74px; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--label); }
  .sheet.dir.viewing td.col-name { font-size: 15px; }
  .sheet.dir.viewing td.col-name::before { display: none; }
  .sheet.dir.viewing .cell-act { opacity: 1; width: 32px; height: 32px; margin-left: auto; }
  .type-seg { width: 140px; }
}

/* Directory: keep wide "All" views compact; long values are truncated (the full value still copies). */
.sheet.dir.viewing th, .sheet.dir.viewing td { padding-left: 12px; padding-right: 12px; }
.sheet.dir.viewing td.col-email .val, .sheet.dir.viewing td.col-url .val { display: inline-block; max-width: 210px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.sheet.dir.viewing td.col-notes { min-width: 160px; }
.sheet.dir.viewing td.col-address { min-width: 150px; }
.sheet-wrap {
  background:
    linear-gradient(to right, var(--card) 30%, transparent) left / 40px 100% no-repeat local,
    linear-gradient(to left, var(--card) 30%, transparent) right / 40px 100% no-repeat local,
    linear-gradient(to right, rgba(0,0,0,.25), transparent) left / 14px 100% no-repeat scroll,
    linear-gradient(to left, rgba(0,0,0,.25), transparent) right / 14px 100% no-repeat scroll,
    var(--card);
}
@media (max-width: 760px) {
  .sheet.dir.viewing td.col-email .val, .sheet.dir.viewing td.col-url .val { max-width: 100%; }
  .sheet.dir.viewing th, .sheet.dir.viewing td { padding-left: 0; padding-right: 0; }
}
