:root {
  --paper: #EEF0F5; --ink: #1A1F36; --muted: #586079; --line: #D0D5E2; --field: #FFFFFF;
  --accent: #4650C8; --accent-hover: #3640B0; --ok: #1B7F58; --bad: #B83232; --warn: #965600;
  --display: "Bricolage Grotesque", "Avenir Next", system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 var(--body); }
main { max-width: 1180px; margin: 0 auto; padding: 32px 28px 80px; }
h1, h2, .brand, .wordmark { font-family: var(--display); letter-spacing: -0.01em; }
h1 { font-size: 2rem; line-height: 1.15; margin: 0 0 4px; font-weight: 700; }
h2 { font-size: 1.2rem; margin: 0; font-weight: 700; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.top { display: flex; justify-content: space-between; align-items: center; max-width: 1180px;
  margin: 0 auto; padding: 18px 28px 0; }
.brand { font-size: 1.35rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px;
  margin-bottom: 28px; flex-wrap: wrap; }
.page-head p { margin: 0; }

.btn, button.link, a.link { font: inherit; cursor: pointer; }
.btn { display: inline-block; padding: 9px 16px; border-radius: 6px; border: 1px solid var(--line);
  background: var(--field); color: var(--ink); font-weight: 600; text-decoration: none; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--bad); margin-left: auto; }
button.link, a.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline;
  text-underline-offset: 3px; font-weight: 500; }

.flash { padding: 12px 16px; border-left: 4px solid var(--ok); background: #E1F1EA; margin: 0 0 24px; }
.flash.bad { border-color: var(--bad); background: #F7E3E3; }
.flash ul { margin: 6px 0 0; padding-left: 20px; }

/* dashboard timetable */
.rows { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.row { display: grid; grid-template-columns: minmax(0,2fr) minmax(0,2fr) minmax(0,1.3fr) minmax(0,1.8fr) auto;
  gap: 16px; align-items: center; padding: 16px 4px; border-bottom: 1px solid var(--line); }
.row.paused .name { color: var(--muted); }
.cell { min-width: 0; overflow-wrap: anywhere; }
.cell.main { display: flex; flex-direction: column; }
.cell.bad { color: var(--bad); }
.name { font-family: var(--display); font-size: 1.15rem; font-weight: 700; color: var(--ink); text-decoration: none; }
.name:hover { text-decoration: underline; }
.acts { display: flex; gap: 16px; justify-content: flex-end; }
.acts form { margin: 0; }
.tag { display: inline-block; padding: 1px 8px; border: 1px solid var(--warn); color: var(--warn);
  border-radius: 4px; font-size: .85rem; font-weight: 600; }
.empty { padding: 48px 0; max-width: 460px; }
.empty p { color: var(--muted); }

/* login */
.login { max-width: 360px; margin: 12vh auto 0; }
.wordmark { font-size: 3rem; margin: 0 0 4px; font-weight: 700; }
.login form { display: grid; gap: 16px; margin-top: 20px; }

/* editor */
.editor { display: grid; grid-template-columns: minmax(0,1fr) 440px; gap: 56px; align-items: start; }
.fields { display: grid; gap: 0; }
fieldset { border: 0; border-top: 1px solid var(--line); margin: 0; padding: 22px 0 26px; display: grid; gap: 16px; }
fieldset:first-of-type { border-top: 2px solid var(--ink); }
legend { font-family: var(--display); font-weight: 700; font-size: 1.15rem; padding: 0; float: left; width: 100%; margin-bottom: 12px; }
legend + * { clear: both; }
label { display: grid; gap: 4px; font-weight: 600; font-size: .95rem; }
label small { font-weight: 400; color: var(--muted); font-size: .85rem; }
.warnfix { color: var(--warn) !important; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--ink); background: var(--field);
  border: 1px solid var(--line); border-radius: 6px; padding: 9px 11px; width: 100%; }
input:hover, select:hover, textarea:hover { border-color: var(--muted); }
textarea { resize: vertical; line-height: 1.45; }
input[type=color] { padding: 2px; height: 42px; width: 80px; cursor: pointer; }
label.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 500; }
label.check input, .seg input, .chip input { width: auto; margin-top: 4px; accent-color: var(--accent); }
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg label, .chip { display: flex; flex-direction: row; align-items: center; gap: 8px; border: 1px solid var(--line);
  background: var(--field); padding: 8px 12px; border-radius: 6px; font-weight: 500; cursor: pointer; }
.seg label:has(input:checked), .chip:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.seg input, .chip input { margin: 0; }
.days { display: flex; flex-wrap: wrap; gap: 8px; }
.pair { display: grid; grid-template-columns: 100px 1fr; gap: 16px; align-items: start; }
.bar { display: flex; gap: 12px; flex-wrap: wrap; padding-top: 8px; border-top: 1px solid var(--line); }

/* live preview, drawn in Discord's own dark theme so what you see is what members see */
.preview-col { position: sticky; top: 20px; }
.pv-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.pv-nav { display: flex; gap: 12px; align-items: center; font-size: .9rem; color: var(--muted); }
.discord { background: #313338; color: #dbdee1; border-radius: 8px; padding: 18px 16px;
  font: 15px/1.4 "gg sans", "Noto Sans", "Helvetica Neue", Arial, sans-serif; overflow: hidden; }
.dmsg { display: flex; gap: 14px; }
.avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; background: #5865F2; color: #fff;
  display: grid; place-items: center; font-weight: 700; }
.dbody { min-width: 0; flex: 1; }
.dmeta { display: flex; align-items: center; gap: 6px; }
.dname { color: #f2f3f5; font-weight: 600; }
.apptag { background: #5865F2; color: #fff; font-size: 10px; font-weight: 600; padding: 1px 5px; border-radius: 3px; }
.dtime { color: #949ba4; font-size: 12px; margin-left: 4px; }
.dcontent { white-space: normal; overflow-wrap: anywhere; }
.dcontent:empty { display: none; }
.dembed { --edge: #5865F2; margin-top: 6px; max-width: 432px; background: #2b2d31; border-left: 4px solid var(--edge);
  border-radius: 4px; padding: 8px 16px 14px 12px; }
.dgrid { display: flex; gap: 14px; }
.dtext { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dauthor { font-size: 14px; font-weight: 600; color: #f2f3f5; margin-top: 6px; }
.dtitle { font-weight: 700; color: #f2f3f5; margin-top: 8px; font-size: 16px; }
.dtitle a { color: #00a8fc; text-decoration: none; }
.ddesc { font-size: 14px; margin-top: 8px; }
.dthumb { width: 80px; height: 80px; object-fit: cover; border-radius: 4px; margin-top: 8px; }
.dimage { display: block; max-width: 100%; border-radius: 4px; margin-top: 16px; }
.dfoot { font-size: 12px; color: #dbdee1; margin-top: 8px; display: flex; gap: 6px; }
.dauthor:empty, .dtitle:empty, .ddesc:empty, .dfoot:empty { display: none; }
.discord code { background: #1e1f22; padding: 1px 4px; border-radius: 3px; font-size: 90%; }
.discord a { color: #00a8fc; }

@media (max-width: 980px) {
  .editor { grid-template-columns: 1fr; }
  .preview-col { position: static; order: -1; }
  .row { grid-template-columns: 1fr; gap: 6px; }
  .acts { justify-content: flex-start; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
