* { box-sizing: border-box; margin: 0; }
[hidden] { display:none !important; }
:root { --bg:#0a0a0b; --panel:#161619; --line:#26262b; --text:#f5f5f4; --muted:#9a9aa5;
  --accent:#e11d48; --green:#16a34a; --note:#fde68a; --note-bg:#2a2410; }
body { background:var(--bg); color:var(--text); line-height:1.6; min-height:100vh;
  font-family:-apple-system,BlinkMacSystemFont,"PingFang HK","Noto Sans TC","Segoe UI",sans-serif; }
a { color:inherit; }
:focus-visible { outline:2px solid var(--accent); outline-offset:2px; }
.topbar { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 20px;
  border-bottom:1px solid var(--line); position:sticky; top:0; background:rgba(10,10,11,.94); z-index:20; }
.brand { font-weight:800; font-size:20px; text-decoration:none; }
.brand span { font-size:11px; color:var(--muted); letter-spacing:.12em; margin-left:6px; }
nav { display:flex; gap:16px; align-items:center; font-size:15px; }
nav a { text-decoration:none; }
main.container { max-width:680px; margin:0 auto; padding:20px 16px 96px; }
main.container.wide { max-width:1000px; }
h1 { font-size:24px; margin:8px 0 12px; }
h2 { font-size:17px; margin:20px 0 8px; }
.muted { color:var(--muted); } .small { font-size:13px; }
.flash { background:#1f2937; border-left:3px solid var(--accent); padding:10px 14px; border-radius:8px; margin:0 0 14px; }
.card { background:var(--panel); border:1px solid var(--line); border-radius:12px; padding:16px; margin:14px 0; }
.card h2 { margin-top:0; }
.notice { border-color:#3f3410; }
.stack { display:flex; flex-direction:column; gap:12px; }
label { display:flex; flex-direction:column; gap:4px; font-size:14px; color:var(--muted); }
label.check { flex-direction:row; align-items:center; gap:8px; }
input, select, textarea { font:inherit; font-size:16px; color:var(--text); background:#0f0f12;
  border:1px solid var(--line); border-radius:8px; padding:10px 12px; width:100%; }
textarea { resize:vertical; }
input[type=checkbox] { width:auto; }
.btn { font:inherit; font-size:15px; padding:9px 16px; border-radius:8px; border:1px solid var(--line);
  background:#222228; color:var(--text); cursor:pointer; text-decoration:none; display:inline-block; white-space:nowrap; }
.btn-primary { background:var(--accent); border-color:var(--accent); font-weight:700; }
.btn.big { width:100%; padding:14px; font-size:17px; }
.btn.danger, .danger { color:#f87171; }
button.link { background:none; border:0; color:var(--muted); font:inherit; cursor:pointer; padding:0; text-decoration:underline; }
.badge { font-size:12px; background:#3b1d24; color:#fda4af; padding:2px 8px; border-radius:99px; }
.badge.ok { background:#13301d; color:#86efac; }
.row { display:flex; justify-content:space-between; gap:10px; padding:8px 0; border-top:1px solid var(--line); text-decoration:none; }
.row:first-of-type { border-top:0; }
.folders { display:flex; flex-wrap:wrap; gap:8px; margin:4px 0 8px; }
.chip { border:1px solid var(--line); border-radius:99px; padding:6px 12px; font-size:14px; text-decoration:none; background:var(--panel); }
.chip.on { border-color:var(--accent); color:#fff; background:#2a0f17; }
.chip.add summary { cursor:pointer; list-style:none; color:var(--muted); }
.chip.add[open] { border-radius:12px; width:100%; }
.inline { display:flex; gap:8px; margin-top:8px; }
.head-row { display:flex; justify-content:space-between; align-items:center; gap:12px; margin-top:10px; }
.script-row { display:flex; flex-direction:column; gap:2px; padding:12px 14px; margin:8px 0; background:var(--panel);
  border:1px solid var(--line); border-radius:10px; text-decoration:none; }
.script-row.dim { opacity:.6; }
.script-row .preview { color:#c9c9d0; font-size:14px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.script-row .actions { display:flex; gap:14px; margin-top:4px; }
.empty { padding:24px 0; text-align:center; }
.manage { margin-top:28px; } .manage form { margin-top:8px; }
/* editor */
.editor { display:flex; flex-direction:column; gap:10px; }
.meter { position:sticky; top:53px; z-index:10; display:flex; justify-content:space-between; align-items:center;
  background:var(--bg); padding:8px 0; border-bottom:1px solid var(--line); }
#count { font-size:20px; font-weight:800; }
.title { font-size:20px; font-weight:700; }
#body { min-height:55vh; line-height:1.8; font-size:17px; }
.del { margin-top:24px; text-align:center; }
.pre { white-space:pre-wrap; }
/* lines + notes */
.lines { border:1px solid var(--line); border-radius:12px; overflow:hidden; margin:12px 0; }
.line { display:grid; grid-template-columns:1fr 1fr; gap:12px; padding:8px 14px; border-top:1px solid var(--line); }
.line:first-child { border-top:0; }
.line .text { white-space:pre-wrap; font-size:17px; line-height:1.7; min-height:1.7em; }
.line.has-note { background:#14120a; }
.line.has-note .text { box-shadow:inset 3px 0 0 #facc15; padding-left:8px; }
.note { background:var(--note-bg); color:var(--note); border-radius:8px; padding:8px 30px 8px 10px; font-size:14px;
  white-space:pre-wrap; position:relative; margin-bottom:6px; }
.note .x { position:absolute; top:6px; right:8px; }
.addnote summary { cursor:pointer; color:var(--muted); font-size:13px; list-style:none; }
.addnote form { display:flex; flex-direction:column; gap:6px; margin-top:6px; }
.sticky-bottom { position:sticky; bottom:12px; margin-top:16px; }
@media (max-width:700px) {
  .line { grid-template-columns:1fr; gap:4px; }
  .line .side:empty { display:none; }
}
/* v2: save, tags, folders */
.actions-row { display:flex; gap:10px; margin:4px 0 6px; }
.actions-row form { flex:1; } .actions-row .btn { width:100%; padding:12px; font-size:16px; }
.actions-row > .btn { flex:1; }
h2.label { font-size:12px; color:var(--muted); letter-spacing:.08em; margin:14px 0 6px; }
.chip.tag { border-style:dashed; }
.chip.tag a { text-decoration:none; margin-left:4px; }
h1 .chip { font-size:14px; font-weight:400; vertical-align:middle; }
.tags { display:flex; flex-wrap:wrap; gap:6px; margin-top:4px; }
.tagpill { font-size:12px; color:#c4b5fd; background:#1e1a33; border-radius:99px; padding:1px 8px; }
.meter { gap:10px; }
.meter #count { flex:1; text-align:center; font-size:18px; }
.btn.save { background:#13301d; border-color:#166534; color:#bbf7d0; font-weight:700; }
.btn.save.dirty { background:var(--green); color:#fff; }
.status { font-size:13px; margin:-4px 0 0; text-align:right; min-height:1.2em; }
.status.ok { color:#86efac; } .status.warn { color:#fbbf24; } .status.err { color:#f87171; }
.tagbox { display:flex; flex-wrap:wrap; gap:6px; align-items:center; background:#0f0f12; border:1px solid var(--line); border-radius:8px; padding:6px 8px; }
.tagbox input { border:0; background:none; padding:4px; flex:1; min-width:140px; }
.tagbox .tagpill { font-size:14px; padding:3px 10px; display:inline-flex; gap:6px; align-items:center; }
.tagbox .tagpill button { background:none; border:0; color:inherit; cursor:pointer; padding:0; font-size:14px; }
#tagchips { display:contents; }
.send .btn { width:100%; padding:12px; }
/* v3: monthly limits */
.quota { margin:0 0 4px; }
.block-reason { background:#2a1d0a; color:#fcd34d; border-radius:8px; padding:8px 12px; font-size:14px; margin:8px 0; }
.btn:disabled { opacity:.45; cursor:not-allowed; }
.extra { display:flex; gap:10px; align-items:flex-end; margin:8px 0; }
.extra label { flex:1; }
