/* Stocks blog – one small stylesheet, system fonts only (fast, no external requests). */
:root {
  --ink: #17201f;
  --muted: #5b6766;
  --line: #e3e8e7;
  --bg: #fbfcfb;
  --card: #ffffff;
  --brand: #0f3d3e;
  --accent: #1b7f5c;
  --down: #b4232c;
  --warn-bg: #fff6d6;
  --radius: 10px;
  --wrap: 1080px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --serif: Georgia, "Iowan Old Style", "Noto Serif", "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 17px/1.6 var(--sans); color: var(--ink); background: var(--bg); }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--accent); }
img { max-width: 100%; height: auto; }
.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 18px; }
.sr-only, .hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; }
.skip:focus { left: 12px; top: 12px; background: #fff; padding: 8px 12px; z-index: 10; }

/* Header */
.site-header { background: var(--brand); color: #fff; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 14px; padding-bottom: 12px; }
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.2rem; letter-spacing: .2px; }
.brand:hover { color: #d9f3ea; }
.logo { color: #6fe0b4; }
.search input { width: 220px; max-width: 42vw; padding: 7px 12px; border-radius: 999px; border: 0; font: inherit; font-size: .95rem; }
.cats { background: #0b3132; overflow-x: auto; white-space: nowrap; }
.cats a { display: inline-block; color: #cfe7e1; text-decoration: none; padding: 9px 14px 10px 0; margin-right: 8px; font-size: .95rem; }
.cats a:hover, .cats a[aria-current] { color: #fff; box-shadow: inset 0 -3px 0 #6fe0b4; }

main { padding-top: 26px; padding-bottom: 40px; min-height: 60vh; }
.hero h1 { font-family: var(--serif); font-size: 2rem; margin: 0 0 4px; }
.hero p, .page-head p { color: var(--muted); margin-top: 0; }
.page-head h1, .page-title { font-family: var(--serif); margin-bottom: 4px; }

/* Cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; margin: 18px 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; }
.card h2 { font-family: var(--serif); font-size: 1.2rem; line-height: 1.3; margin: 6px 0 8px; }
.card h2 a { color: var(--ink); text-decoration: none; }
.card h2 a:hover { color: var(--accent); }
.card p { color: var(--muted); font-size: .95rem; margin: 0 0 10px; flex: 1; }
.card time { font-size: .82rem; color: var(--muted); }
.tag { font-size: .75rem; text-transform: uppercase; letter-spacing: .6px; color: var(--accent); text-decoration: none; font-weight: 600; }
.pager { display: flex; justify-content: space-between; margin: 24px 0; }
.empty { color: var(--muted); padding: 24px 0; }

/* Post */
.post { max-width: 720px; margin: 0 auto; }
.crumbs { font-size: .85rem; color: var(--muted); }
.crumbs a { color: var(--muted); }
.post h1 { font-family: var(--serif); font-size: 2.1rem; line-height: 1.2; margin: 8px 0 6px; }
.meta { color: var(--muted); font-size: .9rem; margin-top: 0; }
.lede { font-size: 1.15rem; color: #34403f; }
.content h2 { font-family: var(--serif); font-size: 1.45rem; margin: 1.8em 0 .4em; }
.content h3 { font-size: 1.15rem; margin: 1.5em 0 .3em; }
.content blockquote { margin: 1em 0; padding: 4px 16px; border-left: 4px solid var(--accent); background: #f1f7f4; }
.content hr { border: 0; border-top: 1px solid var(--line); margin: 2em 0; }
.content code { font-family: var(--mono); font-size: .9em; background: #eef2f1; padding: 1px 4px; border-radius: 4px; }
.table-wrap { overflow-x: auto; margin: 1em 0; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.content th { background: #f1f5f4; }
.content td:not(:first-child), .content th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
.source { font-size: .95rem; }
.disclaimer { margin: 28px 0 10px; padding: 14px 16px; background: #f6f7f2; border: 1px solid var(--line); border-radius: var(--radius); font-size: .9rem; color: #3d4746; }
.related h2 { font-family: var(--serif); margin-top: 40px; }
mark.todo { background: var(--warn-bg); color: #6a4b00; padding: 0 3px; border-radius: 3px; }
.preview-banner { background: var(--warn-bg); border: 1px solid #edd27a; padding: 10px 14px; border-radius: var(--radius); margin-bottom: 18px; }
.ad { margin: 22px 0; text-align: center; min-height: 100px; }
.ad-label { display: block; font-size: .7rem; color: #8a9493; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 4px; }

/* Forms (public + admin) */
label { display: block; margin: 12px 0; font-weight: 600; font-size: .95rem; }
input, select, textarea { display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid #c9d2d1; border-radius: 7px; font: inherit; font-weight: 400; background: #fff; color: var(--ink); }
textarea.mono, .mono { font-family: var(--mono); font-size: .88rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid #8fd6bb; border-color: var(--accent); }
button, .btn { display: inline-block; cursor: pointer; border: 1px solid #c9d2d1; background: #fff; color: var(--ink); padding: 9px 16px; border-radius: 7px; font: inherit; font-weight: 600; text-decoration: none; }
button:hover, .btn:hover { border-color: var(--accent); color: var(--accent); }
.contact button, .btn.primary, .card-form button { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover, .contact button:hover, .card-form button:hover { background: #156a4c; color: #fff; }
.btn.danger { color: var(--down); }
.btn.danger:hover { border-color: var(--down); background: #fdf0f0; color: var(--down); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: .85rem; }
.btn.big { font-size: 1.1rem; padding: 14px 22px; }
.search.big { display: flex; gap: 8px; max-width: 560px; }
.search.big input { margin: 0; border-radius: 7px; width: auto; flex: 1; max-width: none; border: 1px solid #c9d2d1; }
.contact { max-width: 560px; }
.notice { padding: 10px 14px; border-radius: var(--radius); background: #eef6f3; border: 1px solid #cfe5dc; }
.notice.ok { background: #e7f6ee; border-color: #b9e2cb; }
.notice.err { background: #fdf0f0; border-color: #f0c7c9; }
.notice.warn { background: var(--warn-bg); border-color: #edd27a; }
.notice ul { margin: 4px 0; padding-left: 20px; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: #f3f5f4; padding: 22px 0 30px; font-size: .88rem; color: var(--muted); }
.site-footer nav a { margin-right: 16px; color: var(--muted); }
.foot-note { max-width: 760px; }

@media (max-width: 640px) {
  body { font-size: 16px; }
  .header-row { flex-wrap: wrap; }
  .search input { width: 100%; max-width: none; }
  .search { flex: 1 1 100%; }
  .post h1 { font-size: 1.7rem; }
  .grid { grid-template-columns: 1fr; }
}

/* ---------- Admin ---------- */
body.admin { background: #f4f6f6; font-size: 16px; }
.admin-bar { background: var(--brand); color: #fff; padding: 10px 18px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.admin-bar nav { display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center; }
.admin-bar nav a, .admin-bar .link { color: #d7ece6; text-decoration: none; font-size: .92rem; }
.admin-bar .link { background: none; border: 0; padding: 0; font-weight: 400; cursor: pointer; }
.admin-bar .link:hover, .admin-bar nav a:hover { color: #fff; }
.admin-main { max-width: 820px; margin: 0 auto; padding: 22px 18px 60px; }
.admin-main.wide { max-width: 1100px; }
.admin h1 { font-size: 1.6rem; margin-top: 4px; }
.admin h2 { font-size: 1.15rem; margin-top: 28px; }
.inline { display: inline; }
.sub { color: var(--muted); font-size: .85rem; font-weight: 400; }
.card-form { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.narrow { max-width: 420px; margin: 40px auto; }
.today { display: grid; grid-template-columns: 1fr auto; gap: 20px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; align-items: center; }
.today h2 { margin-top: 0; }
.today ol { margin: 0; padding-left: 20px; }
.gen { text-align: center; max-width: 280px; }
.report ul { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px 12px 34px; }
.report li.bad { color: var(--down); }
table.list { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table.list td.actions { text-align: right; white-space: nowrap; width: 1%; }
table.list td.actions form, table.list td.actions a { margin-left: 4px; }
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: 1px 7px; border-radius: 999px; background: #e7eeed; color: #44514f; margin: 3px 4px 0 0; }
.badge.warn { background: var(--warn-bg); color: #6a4b00; }
.badge.err { background: #fde3e4; color: var(--down); }
.editor fieldset { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; margin: 16px 0; padding: 6px 16px 12px; }
.editor legend { font-weight: 700; padding: 0 6px; }
.editor .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.editor textarea { line-height: 1.5; }
.form-table th { font-size: .9rem; white-space: nowrap; }
.form-table input { margin: 0; }
label.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
label.check input { width: auto; margin-top: 5px; }
.buttons { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.danger-zone { margin-top: 30px; padding-top: 14px; border-top: 1px dashed #d4dad9; display: flex; gap: 10px; }
.msg { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin: 12px 0; }
.msg.unread { border-left: 4px solid var(--accent); }
.pre { white-space: pre-wrap; }
details { margin-top: 24px; }
@media (max-width: 700px) { .today { grid-template-columns: 1fr; } .gen { max-width: none; } table.list td.actions { white-space: normal; } }
