:root {
  color-scheme: dark;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  --base: #080f1b;
  --panel: #101c2b;
  --field: #0b1423;
  --line: #263952;
  --text: #eef5ff;
  --muted: #a4b6cf;
  --accent: #8ceecc;
  --sky: #a9cdfc;
  --error: #ffadb8;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(ellipse at 80% -15%, #16334b 0%, transparent 50%), var(--base);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
}
button, input, textarea, select { font: inherit; }
a { color: var(--sky); }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
h1, h2, p { margin: 0; }
h1 { font-size: clamp(27px, 4vw, 36px); line-height: 1.2; letter-spacing: -.035em; }
h2 { font-size: 17px; }
.topbar { border-bottom: 1px solid var(--line); background: #0a1321e8; }
.topbar-inner {
  width: min(1264px, calc(100% - 48px));
  margin-inline: auto;
  min-height: 74px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 11px;
  color: var(--accent);
  border: 1px solid #386d65;
  background: #153538;
  font: 700 18px/1 ui-monospace, Consolas, monospace;
}
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); font-size: 12px; }
.top-actions, .editor-actions { display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.control {
  min-height: 42px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  padding: 8px 14px;
  border-radius: 9px;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.control.subtle { background: #152235; border-color: var(--line); color: var(--text); }
.control.subtle:hover { background: #22344c; }
.control.primary { background: var(--accent); color: #102922; }
.control.primary:hover { background: #a8f7dd; }
.control:disabled { opacity: .48; cursor: default; }
.control.compact { min-height: 38px; padding-inline: 10px; font-size: 13px; }
.control.remove { color: var(--error); background: transparent; border-color: #5c3749; }
.control.remove:hover { background: #382237; }
.control.full { width: 100%; margin-top: 5px; }
.login-shell {
  min-height: calc(100svh - 74px);
  display: grid;
  place-items: center;
  padding: 28px 18px 72px;
}
.login-panel {
  width: min(100%, 452px);
  padding: clamp(22px, 5vw, 36px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 60px #02060c60;
}
.section-marker { width: 38px; height: 3px; border-radius: 3px; background: var(--accent); margin-bottom: 19px; }
.lede { color: var(--muted); margin-top: 9px; }
.notice {
  margin: 16px 0;
  padding: 10px 12px;
  border-left: 3px solid #6b91bd;
  border-radius: 5px;
  background: #142338;
  color: #c6d8ed;
  overflow-wrap: anywhere;
}
.notice[data-tone="error"] { border-color: var(--error); color: var(--error); background: #2a1b2a; }
.notice[data-tone="success"] { border-color: var(--accent); color: var(--accent); background: #132c2d; }
.notice[data-tone="warning"] { border-color: #edc276; color: #f3d49f; background: #2e271b; }
.workspace {
  width: min(1264px, calc(100% - 48px));
  margin: 36px auto 72px;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 30px;
}
.sidebar { align-self: start; position: sticky; top: 22px; }
.sidebar nav { display: grid; gap: 7px; }
.nav-button {
  text-align: left;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 44px;
  padding: 9px 13px;
  cursor: pointer;
}
.nav-button:hover { background: #132238; }
.nav-button[aria-current="page"] { color: var(--accent); background: #142d33; border-color: #295356; font-weight: 700; }
.sidebar-foot { color: var(--muted); margin: 20px 13px 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 13px; }
.section-header, .panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 13px; }
.section-header { flex-wrap: wrap; }
.editor-actions { align-self: start; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: clamp(15px, 3vw, 24px);
}
#profile-form { display: grid; gap: 14px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 15px; }
.field { display: grid; gap: 5px; color: #dce7f6; font-size: 14px; align-content: start; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
#login-form { display: grid; gap: 12px; margin-top: 20px; }
input, textarea, select {
  background: var(--field);
  color: var(--text);
  border: 1px solid #334a66;
  border-radius: 7px;
  padding: 9px 10px;
  width: 100%;
  min-width: 0;
}
textarea { resize: vertical; min-height: 92px; }
.repeat-list { display: grid; gap: 10px; margin-top: 13px; }
.repeat-row {
  border: 1px solid #30435c;
  border-radius: 8px;
  padding: 11px;
  display: grid;
  grid-template-columns: 1fr 1fr .65fr auto;
  align-items: start;
  gap: 10px;
}
.repeat-row.focus-row { grid-template-columns: minmax(0, 1fr) auto; }
.repeat-row.timeline-row { grid-template-columns: 125px minmax(0, 1fr) auto; }
.repeat-row .remove { align-self: end; }
.repeat-row .wide { grid-row: 2; }
.posts-grid { display: grid; grid-template-columns: minmax(235px, 1fr) minmax(0, 2fr); gap: 14px; align-items: start; }
.post-count { color: var(--muted); margin-left: 3px; font-size: 13px; font-weight: 400; }
#post-list { margin-top: 13px; display: grid; gap: 7px; }
.post-select {
  display: grid;
  text-align: left;
  color: var(--text);
  border: 1px solid #2c415d;
  background: #101b2c;
  border-radius: 8px;
  cursor: pointer;
  padding: 10px;
  gap: 3px;
  overflow-wrap: anywhere;
}
.post-select:hover { background: #1b2b42; }
.post-select[aria-current="true"] { border-color: #547dab; background: #1c3450; }
.post-select small, .empty { color: var(--muted); font-size: 13px; }
.post-editor .form-grid { margin-top: 15px; }
#post-form textarea { min-height: 235px; line-height: 1.7; }
@media (max-width: 865px) {
  .workspace { display: block; margin-top: 20px; }
  .sidebar { position: static; display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 22px; }
  .sidebar nav { display: flex; }
  .sidebar-foot { margin: 0; padding: 0; border: 0; }
}
@media (max-width: 620px) {
  .topbar-inner, .workspace { width: calc(100% - 24px); }
  .topbar-inner { min-height: 64px; }
  .brand { gap: 7px; }
  .brand-mark { width: 32px; height: 32px; font-size: 14px; }
  .top-actions { gap: 5px; }
  .top-actions .control { padding: 6px 8px; font-size: 12px; }
  .posts-grid, .form-grid, .repeat-row, .repeat-row.timeline-row { grid-template-columns: minmax(0, 1fr); }
  .repeat-row .wide { grid-row: auto; }
  .repeat-row .remove { justify-self: end; }
  .sidebar-foot { display: none; }
}
