
:root {
  color-scheme: light;
  --text: #1d2443;
  --muted: #565e78;
  --line: #dce0ee;
  --surface: #fff;
  --accent: #4650bf;
  --accent-hover: #363f9f;
  --wash: #f1f2fc;
  font-family: system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: #f6f7fc;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
a, button, input, summary { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }
button, input { font: inherit; }
button, summary { cursor: pointer; }
button { border: 0; }
:focus-visible { outline: 3px solid #6d76e8; outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1.05; letter-spacing: -.055em; }
h2 { font-size: 1.25rem; letter-spacing: -.02em; }

.topbar { background: #20254a; color: #fff; }
.topbar-inner, .workspace { max-width: 69rem; margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2.5rem); }
.topbar-inner { min-height: 4.4rem; display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.brand { display: inline-flex; gap: .65rem; align-items: center; font-weight: 680; font-size: .9rem; text-decoration: none; }
.mark {
  display: grid; place-items: center; width: 2.15rem; height: 2.15rem; flex: none;
  border-radius: .7rem; font-size: 1.22rem; line-height: 1; font-weight: 700; background: #c6cbff; color: #282f77;
}
.sign-out { color: #f1f2ff; background: transparent; border: 1px solid #686d95; border-radius: .65rem; padding: .55rem .75rem; font-size: .85rem; }
.sign-out:hover { background: #343b68; }
.workspace { padding-block: clamp(2.5rem, 8vw, 5rem) 4rem; }
.heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1.65rem; }
.heading p { margin-top: .55rem; color: var(--muted); }
.layout { display: grid; gap: 1rem; align-items: start; }
.layout.with-editor { grid-template-columns: minmax(0, 1.6fr) minmax(17rem, 1fr); }
.panel { border: 1px solid var(--line); background: var(--surface); border-radius: 1.15rem; box-shadow: 0 10px 32px #24336d08; }
.primary, .subtle, .danger {
  display: inline-flex; align-items: center; justify-content: center; min-height: 2.65rem;
  white-space: nowrap; border-radius: .65rem; padding: .54rem .85rem;
  font-size: .89rem; line-height: 1.15; font-weight: 650; text-decoration: none;
}
.primary { color: white; background: var(--accent); }
.primary:hover { background: var(--accent-hover); }
.subtle { color: #343c84; background: var(--wash); }
.subtle:hover { background: #e2e5fc; }
.danger { color: #8c253b; background: #fbe9ee; }
.danger:hover { background: #f8d7e0; }
.collection { padding: clamp(.7rem, 2.5vw, 1.2rem); }
.filter { padding: .2rem .2rem .9rem; }
.filter input { width: min(100%, 22rem); }
.link-list { list-style: none; margin: 0; padding: 0; }
.link-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: .85rem; padding: .9rem .7rem; border-radius: .75rem; }
.link-row + .link-row { border-top: 1px solid var(--line); }
.link-row.selected { background: #f5f5fe; }
.link-mark { display: grid; place-items: center; width: 2.5rem; height: 2.5rem; border-radius: .7rem; background: #e8eaff; color: #424bbb; font-size: 1.2rem; }
.link-text { min-width: 0; display: grid; gap: .28rem; }
.link-title { width: fit-content; max-width: 100%; font-weight: 700; text-decoration: none; overflow-wrap: anywhere; }
.link-title:hover { text-decoration: underline; text-underline-offset: .18em; }
.link-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .85rem; }
.link-actions, .editor-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.editor, .login-panel { padding: clamp(1rem, 3vw, 1.55rem); }
.editor h2 { margin-bottom: 1.15rem; }
.editor-actions { margin-top: 1.2rem; }
label { display: block; margin-bottom: .38rem; font-size: .89rem; font-weight: 680; }
input:not([type=hidden]) { min-height: 2.75rem; border: 1px solid #c5cae0; border-radius: .65rem; padding: .58rem .72rem; background: white; color: var(--text); }
input::placeholder { color: #68718b; }
.editor input, .login-panel input { width: 100%; }
.editor input + label { margin-top: .85rem; }
.delete { margin-top: 1.4rem; padding-top: .95rem; border-top: 1px solid var(--line); }
.delete summary { color: #8c253b; font-size: .9rem; }
.delete button { margin-top: .65rem; }
.message { border-radius: .7rem; padding: .75rem .9rem; font-size: .9rem; margin-bottom: 1rem; }
.error { color: #84253a; background: #fbe9ee; }
.success { color: #205947; background: #e4f4ec; }
.empty { padding: 1.2rem .65rem; color: var(--muted); }
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 1.3rem;
  background: radial-gradient(ellipse at 78% 12%, #484e90 0%, transparent 65%), #20254a;
}
.login-panel { width: min(100%, 26rem); padding: clamp(1.4rem, 6vw, 2.3rem); }
.login-panel h1 { font-size: clamp(2rem, 8vw, 2.7rem); margin: .95rem 0 1.65rem; }
.login-panel button { margin-top: 1.05rem; width: 100%; }
.back-to-links { display: block; margin-top: 1rem; text-align: center; color: var(--muted); font-size: .9rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

@media (max-width: 680px) {
  .layout.with-editor { grid-template-columns: minmax(0, 1fr); }
  .editor { grid-row: 1; scroll-margin-top: 1rem; }
}
@media (max-width: 430px) {
  .link-row { grid-template-columns: auto minmax(0, 1fr); gap: .65rem; }
  .link-actions { grid-column: 2; }
  .link-actions .subtle { min-height: 2.4rem; }
}
