:root {
  color-scheme: light;
  --bg: #f5f7f9;
  --surface: #ffffff;
  --ink: #1b2230;
  --ink-2: #3d4757;
  --muted: #5d6676;
  --line: #d4dae2;
  --web: #1d6787;
  --web-soft: #e2eff5;
  --warn: #b0431b;
  --chip: #eef1f5;
  --ok: #37724b;
  --yonsei: #003876; /* Yonsei Blue: the feed and home accent (main.yonsei in feed.css) */
  --yonsei-soft: #e6eff9;
  --hot: var(--yonsei); /* strongest feed title (most relevant); mixes toward --ink */
  --band: #e5ecf5; /* feed section header band */
  --band-line: #c4d3e3;
  --sans: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
/* Dark by system preference unless a page pins data-theme="light"; data-theme="dark" forces it. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #10141a;
    --surface: #171c24;
    --ink: #e3e8ef;
    --ink-2: #c3cad5;
    --muted: #97a1af;
    --line: #2b333f;
    --web: #6cb4d4;
    --web-soft: #15303c;
    --warn: #ef8a62;
    --chip: #202733;
    --ok: #7dc293;
    --yonsei: #82b4ed; /* Yonsei Blue lightened to read on the dark surface */
    --yonsei-soft: #14283d;
    --band: #1b2837;
    --band-line: #2b3c50;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #10141a;
  --surface: #171c24;
  --ink: #e3e8ef;
  --ink-2: #c3cad5;
  --muted: #97a1af;
  --line: #2b333f;
  --web: #6cb4d4;
  --web-soft: #15303c;
  --warn: #ef8a62;
  --chip: #202733;
  --ok: #7dc293;
  --yonsei: #82b4ed;
  --yonsei-soft: #14283d;
  --band: #1b2837;
  --band-line: #2b3c50;
}
/* The MFA vault stylesheet from the Portal uses --ui-* names. */
:root {
  --ui-bg: var(--bg);
  --ui-surface: var(--surface);
  --ui-surface-2: var(--bg);
  --ui-surface-raised: var(--surface);
  --ui-border: var(--line);
  --ui-text: var(--ink);
  --ui-muted: var(--muted);
  --ui-faint: var(--muted);
  --ui-accent: var(--web);
  --ui-accent-soft: var(--web-soft);
  --ui-accent-text: var(--web); /* accent-colored text (code hover, gate icon), not text on the accent */
  --ui-danger: var(--warn);
  --ui-success: var(--ok);
  --ui-mono: var(--mono);
  --ui-radius-control: 6px;
  --ui-radius-overlay: 10px;
  --ui-shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.18);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--sans); font-size: 14.5px; line-height: 1.5; }
a { color: inherit; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 10px 20px; border-bottom: 1px solid var(--line); background: var(--surface); }
.brand { font-weight: 700; text-decoration: none; }
.top nav { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }
.top nav a { text-decoration: none; color: var(--muted); white-space: nowrap; }
.top nav a[aria-current="page"] { color: var(--ink); font-weight: 600; }
/* Right end: theme button, 문서 · 설정, 로그아웃. */
.util { margin-left: auto; display: flex; align-items: center; gap: 6px 14px; }
.logout { margin: 0; }
.logout button { font: inherit; font-size: 14px; padding: 0; background: none; border: 0; color: var(--muted); cursor: pointer; white-space: nowrap; }
.logout button:hover, .top nav a:hover, .theme:hover, .menu:hover { color: var(--ink); }
.theme, .menu { display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.theme svg, .menu svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
/* The icon names the theme a click switches to. */
.theme .sun { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .moon { display: none; }
  :root:not([data-theme="light"]) .theme .sun { display: block; }
}
:root[data-theme="dark"] .theme .moon { display: none; }
:root[data-theme="dark"] .theme .sun { display: block; }
/* Narrow screens fold the menus under the bar behind the menu button (studio.js
   flips aria-expanded); wider ones keep them in the bar and hide the button. */
.top-menu { display: contents; }
.menu, .menu .x, .menu[aria-expanded="true"] .bars { display: none; }
.menu[aria-expanded="true"] .x { display: block; }
@media (max-width: 640px) {
  .menu { display: inline-grid; margin-left: auto; }
  .menu[aria-expanded="false"] + .top-menu { display: none; }
  .menu + .top-menu { display: grid; flex-basis: 100%; gap: 4px; }
  .menu + .top-menu > nav { flex-direction: column; gap: 0; }
  .menu + .top-menu > nav a { padding: 8px 0; }
  .menu + .top-menu .util { margin-left: 0; padding-top: 4px; border-top: 1px solid var(--line); }
  .menu + .top-menu .util, .menu + .top-menu .util nav { gap: 18px; }
  .menu + .top-menu .util nav a, .menu + .top-menu .logout button { padding: 8px 0; }
}
main { max-width: 980px; margin: 0 auto; padding: 16px 20px 48px; display: grid; gap: 12px; }
.meta { color: var(--muted); font-size: 13px; margin: 0; }
.mono { font-family: var(--mono); font-size: 12px; }
.empty { color: var(--muted); }
.msg { margin: 0; padding: 6px 14px; font-size: 13px; color: var(--ink-2); background: var(--chip); }
.err { color: var(--warn); }
/* A failed form check, shown in the page instead of the browser bubble (studio.js). */
[aria-invalid="true"] { border-color: var(--warn); outline: 1px solid var(--warn); }
[aria-invalid="true"]:focus-visible { outline: 2px solid var(--warn); outline-offset: 2px; }
.field-note { grid-column: 1 / -1; align-self: center; color: var(--warn); font-size: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.btn { font: inherit; font-size: 13px; display: inline-block; padding: 3px 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink-2); text-decoration: none; cursor: pointer; }
.btn.pri { background: var(--web); border-color: var(--web); color: var(--surface); }
button:focus-visible, a:focus-visible, input:focus-visible, .row:focus-visible { outline: 2px solid var(--web); outline-offset: 2px; }

.login { display: grid; gap: 12px; justify-items: start; padding-top: 10vh; }
.login h1 { margin: 0; }

/* feed and library rows */
.feed { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.fsec-h { margin: 0; padding: 7px 14px 5px; font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: 0.03em; background: var(--bg); border-bottom: 1px solid var(--line); }
.fsec + .fsec .fsec-h { border-top: 1px solid var(--line); }
.row { position: relative; padding: 6px 14px 7px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.row + .row { border-top: 1px solid var(--line); }
.row:hover, .row:focus-within { background: var(--bg); }
.row .t { font-size: 14px; line-height: 1.4; font-weight: 500; padding-right: 150px; text-decoration: none; }
.row .t:hover { text-decoration: underline; }
.row .sub { display: flex; justify-content: space-between; gap: 12px; font-size: 12.5px; color: var(--muted); }
.row .al { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .date { flex: none; font-variant-numeric: tabular-nums; }
.row .note { font-size: 12.5px; color: var(--ink-2); }
.acts { position: absolute; right: 10px; top: 5px; display: flex; gap: 2px; opacity: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 5px; padding: 1px 2px; transition: opacity 0.12s; }
.row:hover .acts, .row:focus-within .acts { opacity: 1; }
.act { font: inherit; font-size: 13px; padding: 0 5px; border: 0; border-radius: 3px; background: none; cursor: pointer; line-height: 1.6; }
.act.on { background: var(--web-soft); }
.act[aria-busy="true"] { opacity: 0.4; }

/* sources (the feed's source dialog) and add bars */
.addbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.addbar input[type="text"] { flex: 1 1 260px; font: inherit; font-size: 13.5px; padding: 4px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.src-row { position: relative; display: grid; grid-template-columns: 14em minmax(0, 1fr) auto; gap: 4px 12px; align-items: baseline; padding: 5px 14px; font-size: 13.5px; }
.src-row + .src-row { border-top: 1px solid var(--line); }
.src-row:hover, .src-row:focus-within { background: var(--bg); }
.src-row .nm2 { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-row .url { font-family: var(--mono); font-size: 11.5px; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src-row .st { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.src-row .st.bad { color: var(--warn); }
.src-row .ra { position: absolute; right: 10px; top: 2px; display: flex; gap: 4px; padding-left: 8px; background: var(--bg); opacity: 0; transition: opacity 0.12s; }
.src-row .ra form { margin: 0; }
.src-row:hover .ra, .src-row:focus-within .ra { opacity: 1; }
.src-row.off .nm2, .src-row.off .url { color: var(--muted); text-decoration: line-through; }

/* author names (_authors.html): Following in the accent color, candidates dotted, the rest plain */
.au, [data-authors] a:not(.au) { color: inherit; text-decoration: none; }
.au:hover, [data-authors] a:not(.au):hover { text-decoration: underline; }
.au.tracked { color: var(--web); font-weight: 500; }
.au.cand { text-decoration: underline dashed var(--web); text-underline-offset: 3px; }

/* follow dialog: an author name joins Following (studio.js) */
.fdlg { width: min(400px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); box-shadow: var(--ui-shadow-lg); }
.fdlg::backdrop { background: rgba(6, 10, 16, 0.55); }
.fdlg-in { display: grid; gap: 8px; padding: 16px 18px 14px; }
.fdlg-t { margin: 0; font-size: 17px; line-height: 1.35; overflow-wrap: anywhere; }
.fdlg-q { margin: 0; font-size: 13.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.fdlg-q a { color: var(--web); text-decoration: none; }
.fdlg-q a:hover { text-decoration: underline; }
.fdlg .btns { margin-top: 6px; }
.fdlg [hidden] { display: none; }
.fdlg[aria-busy="true"] .btns { opacity: 0.5; pointer-events: none; }
.pad { padding: 10px 14px; }
.pill { display: inline-block; font-size: 12.5px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--line); color: var(--ink-2); }
input, select { font: inherit; font-size: 13.5px; padding: 3px 8px; border: 1px solid var(--line); border-radius: 5px; background: var(--surface); color: var(--ink); }
form.inline, .inline { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; }
.btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.btns form { margin: 0; }

/* library */
.lib { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; display: grid; grid-template-columns: 190px minmax(0, 1fr); }
.lib-side { background: var(--bg); border-right: 1px solid var(--line); padding: 10px 8px; display: grid; gap: 1px; align-content: start; font-size: 13px; }
.lib-side .grp { font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.04em; margin: 8px 6px 2px; }
.lib-side .src { display: flex; justify-content: space-between; gap: 8px; padding: 2px 6px; border-radius: 4px; text-decoration: none; }
.lib-side .src.on { background: var(--web-soft); color: var(--web); font-weight: 500; }
.lib-side .n { color: var(--muted); font-variant-numeric: tabular-nums; }
.lib-list { min-width: 0; }
.lib-list .row .t { padding-right: 0; }
.lib-head { display: flex; justify-content: space-between; gap: 12px; padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.card-page { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 14px 16px; display: grid; gap: 10px; }
.card-page.stack { max-width: 520px; }
.it-title { font-size: 18px; margin: 0; line-height: 1.35; }
.it-authors { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.kv { display: grid; grid-template-columns: 5em minmax(0, 1fr); gap: 5px 10px; font-size: 13.5px; align-items: baseline; }
.kv .k2 { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag { display: inline-flex; align-items: center; gap: 2px; font-size: 12.5px; padding: 0 4px 0 9px; border-radius: 999px; background: var(--chip); }
.tag form { margin: 0; }
.tag button { font: inherit; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 4px; }
.marks-inline { display: flex; gap: 4px; }
.marks-inline form { margin: 0; }
.marks-inline .act { border: 1px solid var(--line); padding: 1px 8px; }
.note-form { display: flex; gap: 6px; }
.note-form input { flex: 1; }
.bib { font-family: var(--mono); font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; overflow-x: auto; margin: 0; white-space: pre; }
.prose { max-width: 70ch; }
.prose h1 { font-size: 20px; }
.prose h2 { font-size: 16px; margin-top: 18px; }

/* people */
.addbar.solo { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.addbar.solo input { flex: 1 1 260px; }
.person { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.p-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 6px 16px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.p-name { font-size: 18px; font-weight: 700; }
.p-tags { display: flex; gap: 6px; flex-wrap: wrap; }
.p-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); }
.p-box { background: var(--surface); padding: 10px 14px; display: grid; gap: 6px; align-content: start; font-size: 13.5px; }
.p-box h4 { margin: 0 0 2px; font-family: var(--mono); font-size: 11.5px; font-weight: 500; color: var(--muted); letter-spacing: 0.04em; }
.check { display: inline-flex; gap: 4px; align-items: center; }
.mk { display: inline-block; width: 1.6em; }

/* settings */
.set { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); overflow: hidden; }
.set-row { display: grid; grid-template-columns: 11em minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 6px 14px; font-size: 13.5px; margin: 0; }
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row form { margin: 0; }
.set-row .vl .meta { margin-left: 6px; }
.set-row.off { color: var(--muted); }
.set-row.hot { background: var(--web-soft); }
.set-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.set-log li { overflow-wrap: anywhere; }
.set-log li.err { color: var(--warn); }
.set-log code { font-size: 12px; }
.set-prof { display: grid; gap: 8px; padding: 10px 14px; margin: 0; font-size: 13.5px; }
.set-prof textarea { width: 100%; min-height: 12em; resize: vertical; font-family: var(--mono); font-size: 12.5px; line-height: 1.5; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
.set-prof textarea:focus-visible { outline: 2px solid var(--web); outline-offset: 1px; }

@media (max-width: 640px) {
  .lib { grid-template-columns: 1fr; }
  .lib-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .set-row { grid-template-columns: 1fr auto; }
  .set-row .vl { grid-column: 1 / -1; order: 3; }
}

@media (prefers-reduced-motion: reduce) { .acts, .src-row .ra { transition: none; } }
@media (max-width: 560px) {
  .row .t { padding-right: 0; }
  .acts { position: static; justify-self: start; margin-top: 4px; }
  .row:not(:focus-within) .acts { display: none; }
  .src-row { grid-template-columns: minmax(0, 1fr) auto; }
  .src-row .url { grid-column: 1 / -1; }
  .src-row .ra { position: static; opacity: 1; grid-column: 1 / -1; flex-wrap: wrap; background: none; padding-left: 0; }
}
