/* macOS glass on a green and white gradient. */
* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0; min-height: 100vh; color: var(--ink); font: 15px/1.5 var(--ui);
  background:
    radial-gradient(900px 420px at 12% -60px, rgba(200, 240, 77, .28), transparent 70%),
    radial-gradient(800px 480px at 92% 40px, rgba(46, 139, 87, .45), transparent 70%),
    linear-gradient(180deg, #0d3b26 0, #1a5c3a 180px, #bfe0cc 520px, #eaf5ee 900px, #fff 1500px);
  background-repeat: no-repeat; background-color: #fff;
}
a { color: var(--green); }
h1 { font-size: 28px; line-height: 34px; margin: 0 0 6px; font-weight: 700; }
h2 { font-size: 20px; line-height: 26px; margin: 0 0 10px; font-weight: 700; }
h3 { font-size: 16px; line-height: 22px; margin: 0 0 6px; font-weight: 600; }
p { margin: 0 0 10px; }
.caption, .muted { font-size: 13px; line-height: 1.4; color: var(--ink-2); }
.mono { font-family: var(--mono); font-size: 13px; }
.hidden { display: none !important; }

.glass {
  background: var(--glass); border: 1px solid var(--glass-line); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(24px) saturate(1.6); -webkit-backdrop-filter: blur(24px) saturate(1.6);
}
.card { padding: 18px 20px; margin-bottom: 16px; }

/* shell */
.topbar { position: sticky; top: 12px; z-index: 20; margin: 12px 20px 0; padding: 10px 16px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 18px; color: var(--forest); letter-spacing: .2px; }
.brand span { font-weight: 400; color: var(--ink-2); margin-left: 6px; }
.topbar .spacer { flex: 1; }
.role-tag { font-size: 12px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--hair); color: var(--ink-2); margin-left: 6px; }
.meter { min-width: 190px; padding: 5px 10px; border-radius: var(--radius-sm); border: 1px solid var(--hair); background: var(--glass-strong); font-family: var(--mono); font-size: 12px; }
.meter-track { height: 4px; margin-top: 4px; border-radius: 4px; background: rgba(13, 59, 38, .12); overflow: hidden; }
.meter-track i { display: block; height: 100%; background: var(--sea); }
.meter.hot { background: var(--forest); color: #fff; border-color: var(--forest); }
.meter.hot .meter-track { background: rgba(255, 255, 255, .2); }
.meter.hot .meter-track i { background: var(--lime); }
.layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 20px; padding: 20px; align-items: start; }
.nav { position: sticky; top: 88px; max-height: calc(100vh - 100px); overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; font-weight: 600; }
.nav a:hover { background: rgba(255, 255, 255, .6); }
.nav a.on { background: linear-gradient(180deg, #1a5c3a, #0d3b26); color: #fff; }
.badge { min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--lime); color: var(--forest); font: 600 12px/20px var(--mono); text-align: center; }
main { min-width: 0; }
.page-head { color: #fff; margin: 4px 0 16px; }
.page-head .muted { color: rgba(255, 255, 255, .82); }

/* controls */
.btn { font: 600 15px/1 var(--ui); padding: 10px 16px; border-radius: var(--radius-sm); border: 0; cursor: pointer; color: #fff; background: linear-gradient(180deg, #2e8b57, #0d3b26); box-shadow: 0 2px 8px rgba(13, 59, 38, .25); }
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--glass-strong); color: var(--forest); border: 1px solid rgba(13, 59, 38, .2); box-shadow: none; }
.btn.danger { background: #fff; color: var(--fail); border: 1px solid var(--fail); box-shadow: none; }
.btn.small { padding: 6px 10px; font-size: 13px; }
.btn.big { padding: 14px 24px; font-size: 17px; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.link-btn { background: none; border: 0; padding: 0; color: var(--green); font: inherit; text-decoration: underline; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--ink); width: 100%; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid rgba(13, 59, 38, .2); background: rgba(255, 255, 255, .9); }
input:focus, textarea:focus, select:focus { outline: 2px solid rgba(46, 139, 87, .45); outline-offset: 1px; }
label { display: block; margin: 0 0 10px; font-weight: 600; font-size: 13px; color: var(--ink-2); }
label > input, label > textarea, label > select { margin-top: 4px; font-weight: 400; font-size: 15px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }

.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: rgba(255, 255, 255, .55); border: 1px solid var(--glass-line); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); flex-wrap: wrap; }
.seg button { font: 600 13px/1 var(--ui); border: 0; background: none; padding: 8px 12px; border-radius: 9px; color: var(--ink-2); cursor: pointer; }
.seg button.on { background: #fff; color: var(--forest); box-shadow: 0 1px 4px rgba(13, 59, 38, .18); }

/* status */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font: 600 12px/18px var(--ui); white-space: nowrap; border: 1px solid transparent; }
.pill svg { width: 12px; height: 12px; }
.pill.pass { color: var(--pass); background: var(--pass-bg); }
.pill.fail { color: var(--fail); background: var(--fail-bg); border-color: var(--fail); }
.pill.uns { color: var(--uns); background: var(--uns-bg); border: 1px dashed var(--uns); }
.pill.gate { color: #7a5c12; background: var(--gate-bg); border-color: var(--gate); }
.pill.quiet { color: var(--ink-2); background: rgba(13, 59, 38, .06); border: 1px dashed rgba(13, 59, 38, .3); }
.pill.done { color: var(--ink-2); background: rgba(13, 59, 38, .06); }
.tag { display: inline-block; font: 600 12px/18px var(--ui); padding: 1px 9px; border-radius: 999px; }
.tag.new { background: var(--forest); color: #fff; }
.tag.refresh { border: 1px solid var(--forest); color: var(--forest); }
.tag.tone, .tag.accuracy, .tag.structure { background: rgba(13, 59, 38, .07); color: var(--forest); text-transform: capitalize; }
.chip.toggle { font: inherit; font-size: 13px; cursor: pointer; }
.chip.toggle.on { background: var(--pass-bg); border-color: rgba(46, 139, 87, .5); color: var(--forest); }
.chip.toggle.on::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--sea); margin-right: 6px; vertical-align: 1px; }
.chip.toggle.off { background: rgba(255, 255, 255, .5); border-style: dashed; color: var(--ink-2); text-decoration: line-through; }
.steps .skipped .dot { border-style: dashed; }
.steps li.skipped .label { color: var(--ink-2); }
.chip { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 13px; background: rgba(255, 255, 255, .8); border: 1px solid var(--hair); margin: 0 6px 6px 0; }

/* tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font: 600 12px/1.4 var(--ui); color: var(--ink-2); text-transform: uppercase; letter-spacing: .4px; padding: 8px 10px; border-bottom: 1px solid var(--hair); }
.tbl td { padding: 10px; border-bottom: 1px solid var(--hair); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--hair); }
.table-wrap { overflow-x: auto; }

/* steps */
.steps { list-style: none; margin: 0; padding: 0; position: relative; }
.steps li { position: relative; padding: 0 0 18px 34px; }
.steps li::before { content: ""; position: absolute; left: 10px; top: 22px; bottom: 0; width: 2px; background: rgba(13, 59, 38, .15); }
.steps li:last-child::before { display: none; }
.steps .dot { position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: #fff; border: 2px solid rgba(13, 59, 38, .2); }
.steps .done .dot { background: var(--sea); border-color: var(--sea); }
.steps .done .dot::after { content: ""; width: 8px; height: 4px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.steps .running .dot { border-color: var(--sea); }
.steps .failed .dot { border-color: var(--fail); background: var(--fail-bg); }
.steps .failed .label { color: var(--fail); font-weight: 600; }
.steps .waiting .label { color: var(--ink-2); }
.steps .skipped { margin-top: 4px; padding: 4px 8px; border: 1px dashed rgba(13, 59, 38, .35); border-radius: 8px; font-size: 13px; color: var(--ink-2); }
.spinner { width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(46, 139, 87, .25); border-top-color: var(--sea); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* topics */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.topic { padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.topic .meta { display: flex; justify-content: space-between; align-items: center; }
.topic .reason { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink-2); }
.topic .links a { display: block; font: 12px/1.5 var(--mono); overflow-wrap: anywhere; }
.topic.picked { border: 2px solid var(--sea); box-shadow: 0 0 0 6px rgba(200, 240, 77, .45), var(--shadow); }
.topic.rejected { opacity: .62; border: 1px dashed rgba(13, 59, 38, .4); background: rgba(255, 255, 255, .5); }
.topic .banner { padding: 6px 10px; border-radius: 8px; background: var(--pass-bg); color: var(--pass); font-weight: 600; font-size: 13px; }

/* editor */
.editor-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.toolbar { display: flex; gap: 4px; padding: 8px; border-bottom: 1px solid var(--hair); flex-wrap: wrap; }
.toolbar button { min-width: 34px; padding: 6px 9px; border-radius: 8px; border: 1px solid transparent; background: none; font: 600 13px/1 var(--ui); color: var(--ink); cursor: pointer; }
.toolbar button:hover { background: rgba(13, 59, 38, .07); border-color: var(--hair); }
.post-body { font: 17px/1.65 var(--serif); padding: 22px 28px; min-height: 60vh; outline: none; }
.post-body h2 { font: 600 22px/1.3 var(--serif); margin: 22px 0 8px; }
.post-body h3 { font: 600 18px/1.35 var(--serif); margin: 18px 0 6px; }
.post-body > p:first-child { background: rgba(200, 240, 77, .22); border-left: 4px solid var(--lime); padding: 12px 14px; border-radius: 0 10px 10px 0; }
.post-body[contenteditable="true"] { box-shadow: inset 0 0 0 2px rgba(46, 139, 87, .25); border-radius: 0 0 var(--radius) var(--radius); }
.post-body mark { background: none; color: inherit; border-radius: 3px; }
.post-body mark.passed { box-shadow: inset 0 -2px 0 var(--pass); }
.post-body mark.failed { outline: 2px solid var(--fail); outline-offset: 1px; }
.post-body mark.unsourced { outline: 2px dashed var(--uns); outline-offset: 1px; }
.post-body mark.resolved { box-shadow: inset 0 -2px 0 rgba(13, 59, 38, .3); }
.post-body .fc { margin-left: 4px; vertical-align: 2px; font-family: var(--ui); user-select: none; }
.panel { position: sticky; top: 84px; padding: 14px; max-height: calc(100vh - 170px); overflow: auto; }
.panel .seg { margin-bottom: 12px; }
.panel-list { list-style: none; margin: 0; padding: 0; }
.panel-list > li { padding: 10px 0; border-bottom: 1px solid var(--hair); }
.panel-list > li:last-child { border-bottom: 0; }
.panel-list a { font: 12px/1.5 var(--mono); overflow-wrap: anywhere; }
.bar { position: sticky; bottom: 12px; z-index: 15; margin-top: 16px; padding: 10px 14px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.popover { position: absolute; bottom: 56px; right: 14px; width: 320px; padding: 14px; z-index: 30; }
.banner.gold { padding: 12px 16px; border-radius: 14px; background: var(--gate-bg); border: 1px solid var(--gate); margin-bottom: 14px; }
.banner.info { padding: 12px 16px; border-radius: 14px; background: var(--pass-bg); border: 1px solid rgba(46, 139, 87, .4); margin-bottom: 14px; }
.banner.fail { padding: 12px 16px; border-radius: 14px; background: var(--fail-bg); border: 1px solid var(--fail); color: var(--fail); margin-bottom: 14px; }

/* history and memory */
.cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cols .col { padding: 16px; font: 15px/1.6 var(--serif); }
.cols .col .body { white-space: pre-line; }
.cols .col h3, .cols .col select, .cols .col .caption { font-family: var(--ui); }
ins { text-decoration: underline; text-decoration-color: var(--sea); background: rgba(200, 240, 77, .45); }
del { text-decoration: line-through; color: var(--fail); background: var(--fail-bg); }
.loop { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 14px 16px; }
.loop .step { padding: 8px 12px; border-radius: 10px; background: rgba(255, 255, 255, .85); border: 1px solid var(--hair); font-weight: 600; font-size: 14px; }
.loop .arrow { color: var(--sea); font-weight: 700; }
.capbar { height: 8px; border-radius: 8px; background: rgba(13, 59, 38, .12); overflow: hidden; margin-top: 6px; }
.capbar i { display: block; height: 100%; background: linear-gradient(90deg, #2e8b57, #c8f04d); }
.snips { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0; }
.snip { padding: 8px 10px; border-radius: 10px; font: 14px/1.5 var(--serif); }
.snip.before { background: var(--fail-bg); }
.snip.after { background: var(--pass-bg); }
.snip b { display: block; font: 600 12px/1.4 var(--ui); color: var(--ink-2); margin-bottom: 2px; }
details.expand summary { cursor: pointer; color: var(--green); font-weight: 600; font-size: 13px; margin-top: 6px; }
pre.code { font: 12px/1.5 var(--mono); background: #0d3b26; color: #e3f3ea; padding: 14px; border-radius: 12px; overflow: auto; max-height: 360px; }
.article-preview { font: 17px/1.65 var(--serif); padding: 22px 28px; }
.article-preview h1 { font: 700 28px/1.25 var(--serif); }
.article-preview h2 { font: 600 22px/1.3 var(--serif); }

/* empty, dialog, toasts */
.empty { text-align: center; padding: 34px 20px; color: var(--ink-2); }
.empty h3 { color: var(--ink); }
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; background: rgba(13, 59, 38, .25); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); padding: 16px; }
.dialog { max-width: 440px; width: 100%; padding: 22px 24px; }
.toasts { position: fixed; top: 76px; right: 20px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast { padding: 10px 14px; display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.toast.warn { border-left: 4px solid var(--gate); }
.toast.ok { border-left: 4px solid var(--sea); }
.toast.err { border-left: 4px solid var(--fail); }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login { width: 100%; max-width: 380px; padding: 28px; }

@media (max-width: 700px) {
  .layout { grid-template-columns: 1fr; padding: 12px; gap: 12px; }
  .nav { position: static; flex-direction: row; overflow-x: auto; }
  .nav a { flex: none; gap: 6px; }
  .topbar { margin: 8px 12px 0; top: 8px; }
  .editor-wrap, .cols, .snips { grid-template-columns: 1fr; }
  .panel { position: static; max-height: none; }
  .post-body, .article-preview { padding: 16px; }
  .popover { left: 14px; right: 14px; width: auto; }
}
[hidden] { display: none !important; }
