:root {
  --blue: #4285F4; --red: #EA4335; --yellow: #FBBC04; --green: #34A853;
  --bg: #0f1115; --panel: #171a21; --panel-2: #1f232c; --line: #2a2f3a;
  --text: #e8eaf0; --muted: #9aa3b2; --link: #8ab4f8;
  --radius: 10px; --gap: 12px;
}
@media (prefers-color-scheme: light) {
  :root { --bg: #f6f7fb; --panel: #ffffff; --panel-2: #f0f2f7; --line: #dde1ea; --text: #1b1f27; --muted: #5f6878; --link: #1a56c4; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
code { background: var(--panel-2); padding: 1px 5px; border-radius: 5px; font-size: 0.92em; }
h1 { font-size: 1.45rem; margin: 0 0 var(--gap); }
h2 { font-size: 1.05rem; margin: 0 0 8px; }
h3 { font-size: 0.9rem; margin: 10px 0 4px; color: var(--muted); font-weight: 600; }
small, .small { font-size: 0.85em; }
.muted { color: var(--muted); }
.warn { color: var(--yellow); }
.ok { color: var(--green); }

/* header */
.top { display: grid; grid-template-columns: auto 1fr; grid-template-areas: "brand who" "nav nav"; align-items: center; gap: 6px 12px; padding: 10px 0 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
@media (min-width: 820px) { .top { grid-template-columns: auto 1fr auto; grid-template-areas: "brand nav who"; gap: 8px 16px; padding: 10px 14px; } }
.brand { grid-area: brand; font-weight: 700; color: var(--text); display: inline-flex; align-items: center; gap: 3px; margin-right: 6px; white-space: nowrap; }
.brand .mark { width: 29px; height: 16px; object-fit: contain; margin-right: 4px; }
.logo-plate { display: inline-block; width: 100%; max-width: 440px; height: auto; background: #fff; padding: 14px 18px; border-radius: 12px; box-sizing: border-box; }
.nav { grid-area: nav; display: flex; gap: 4px; flex-wrap: nowrap; overflow-x: auto; white-space: nowrap; margin: 0 0 0 -14px; padding: 0 14px 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.nav::-webkit-scrollbar { display: none; }
@media (min-width: 820px) { .nav { margin: 0; padding: 0; overflow: visible; flex-wrap: wrap; } }
.nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; font-weight: 500; flex: 0 0 auto; }
.nav a.on, .nav a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.who { grid-area: who; display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin: 0; padding-right: 14px; color: var(--muted); font-size: 0.9em; white-space: nowrap; min-width: 0; }
.who span { overflow: hidden; text-overflow: ellipsis; }
@media (min-width: 820px) { .who { padding-right: 0; } }
.tag { background: var(--panel-2); border-radius: 6px; padding: 1px 6px; color: var(--yellow); }

/* layout */
.page { padding: 16px 14px 40px; max-width: 1200px; margin: 0 auto; }
.narrow { max-width: 560px; margin: 0 auto; }
.wide { max-width: 980px; margin: 0 auto; }
.center { text-align: center; padding-top: 10vh; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: var(--gap); }
.head h1, .head h2 { margin: 0; }
.crumbs { color: var(--muted); margin: 0 0 8px; }
.grid.two { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
@media (min-width: 820px) { .grid.two { grid-template-columns: 1fr 1fr; } }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.count { color: var(--muted); font-weight: 400; }
.more { float: right; font-size: 0.85em; font-weight: 400; }

/* buttons and forms */
.btn { display: inline-block; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; font: inherit; cursor: pointer; }
.btn:hover { text-decoration: none; filter: brightness(1.1); }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
button.link, .link { background: none; border: 0; color: var(--link); cursor: pointer; font: inherit; padding: 0; }
.form { display: flex; flex-direction: column; gap: 10px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; color: var(--muted); }
.form input, .form select, .form textarea, .filters select, .composer textarea, .items input, .items select {
  width: 100%; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit;
}
.form textarea { resize: vertical; }
.form.compact { flex-direction: row; gap: 6px; margin-top: 8px; }
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: var(--gap); }
.filters select { width: auto; }
details.inline { display: inline-block; }
details.inline summary { list-style: none; display: inline-block; }
details.inline summary::-webkit-details-marker { display: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; margin: 10px 0 16px; }
.actions form { margin: 0; }

/* lists and cards */
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.row:last-child { border-bottom: 0; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 0.85em; }
.meta.big { font-size: 0.95em; margin-bottom: 8px; }
.owner { font-weight: 600; color: var(--text); }
.due.late { color: var(--red); font-weight: 600; }
.area { padding: 0 7px; border-radius: 999px; font-size: 0.8em; border: 1px solid var(--line); text-transform: lowercase; }
.area.events { color: var(--blue); border-color: var(--blue); }
.area.tech { color: var(--green); border-color: var(--green); }
.area.pr { color: var(--yellow); border-color: var(--yellow); }
.area.money { color: var(--red); border-color: var(--red); }
.area.career { color: #c58af9; border-color: #c58af9; }
.cycle { font-size: 0.8em; padding: 0 7px; border-radius: 999px; background: var(--panel-2); }
.flag { color: var(--yellow); font-size: 0.8em; }
.flag.blocked { color: var(--red); }
.chan { color: var(--blue); }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--gap); }
.card { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; color: var(--text); }
.card:hover { text-decoration: none; border-color: var(--blue); }
.card-title { font-weight: 600; margin-bottom: 4px; }
.card.task { margin-bottom: 8px; border-left: 3px solid var(--line); }
.card.task.doing { border-left-color: var(--blue); }
.card.task.blocked { border-left-color: var(--red); }
.card.task.done { border-left-color: var(--green); opacity: 0.8; }
.status { font-size: 0.7em; vertical-align: middle; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); color: var(--muted); }
.status.doing { color: var(--blue); } .status.blocked { color: var(--red); } .status.done { color: var(--green); }

/* board */
.board { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
@media (min-width: 700px) { .board { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .board { grid-template-columns: repeat(4, 1fr); } }
.column { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.column h2 { padding: 2px 4px 8px; }
.empty { padding: 4px; }

/* "Coming up" on Today */
.cal { list-style: none; margin: 0; padding: 0; }
.cal-row { display: grid; grid-template-columns: 1fr; gap: 2px 10px; padding: 7px 0; border-bottom: 1px solid var(--line); align-items: start; }
.cal-row:last-child { border-bottom: 0; }
.cal-row .when { color: var(--blue); font-weight: 600; font-size: 0.9em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cal-row .what { min-width: 0; overflow-wrap: anywhere; }
.cal-row .pill { justify-self: start; }
@media (min-width: 600px) {
  .cal-row { grid-template-columns: minmax(0, 35%) 1fr auto; }
  .cal-row .when { font-size: 1em; }
  .cal-row .pill { justify-self: end; margin-top: 2px; }
}
.pill { display: inline-block; padding: 0 8px; border-radius: 999px; font-size: 0.75em; line-height: 1.6; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.pill.fixed { color: var(--green); border-color: var(--green); }
.pill.proposed { color: var(--yellow); border-color: var(--yellow); }
.pill.open { color: var(--blue); border-color: var(--blue); }

/* "This week" strip on Today */
.week { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: var(--gap); }
@media (min-width: 600px) { .week { grid-template-columns: repeat(4, 1fr); } }
.week a { display: flex; align-items: baseline; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px 12px; color: var(--muted); font-size: 0.9em; }
.week a:hover { text-decoration: none; border-color: var(--blue); }
.week a strong { font-size: 1.3em; color: var(--text); }
.week a.late strong { color: var(--red); }
.week a.warn strong { color: var(--yellow); }

/* markdown */
.md { overflow-wrap: anywhere; }
.md table { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: 0.95em; display: block; overflow-x: auto; }
.md th, .md td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.md th { color: var(--muted); font-weight: 600; background: var(--panel-2); }
.md tr:hover td { background: var(--panel-2); }
.md h1 { font-size: 1.3rem; } .md h2 { font-size: 1.1rem; margin-top: 18px; } .md h3 { color: var(--text); font-size: 1rem; }
.md pre { background: var(--panel-2); padding: 10px; border-radius: 8px; overflow-x: auto; }
.md blockquote { border-left: 3px solid var(--line); margin: 8px 0; padding: 2px 10px; color: var(--muted); }
.doc { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 20px; }
.body { margin-bottom: 20px; }

/* chat */
.chat { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.msg { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; max-width: 92%; align-self: flex-start; }
.msg.me { align-self: flex-end; background: rgba(66, 133, 244, 0.12); border-color: rgba(66, 133, 244, 0.35); }
.msg.op { max-width: 100%; align-self: stretch; }
.msg.reply { margin: 8px 0 0 18px; max-width: 100%; }
.msg-head { font-size: 0.85em; margin-bottom: 2px; }
.msg .md p { margin: 4px 0; }
.composer { display: flex; gap: 8px; align-items: flex-end; position: sticky; bottom: 0; background: var(--bg); padding: 8px 0; }
.composer textarea { flex: 1; resize: vertical; }

/* slack layout */
.slack { display: grid; grid-template-columns: 1fr; gap: var(--gap); }
@media (min-width: 820px) { .slack { grid-template-columns: 220px 1fr; } }
.channels { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; align-self: start; }
.channels ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
@media (min-width: 820px) { .channels ul { flex-direction: column; } }
.channels li a { display: block; padding: 6px 8px; border-radius: 8px; color: var(--muted); }
.channels li.on a, .channels li a:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.threads { list-style: none; margin: 0; padding: 0; }
.threads li a { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--text); }
.threads li a:hover { background: var(--panel); text-decoration: none; }
.t-title { font-weight: 600; }
.t-preview { font-size: 0.9em; margin-top: 2px; }

/* meeting review */
.items { display: flex; flex-direction: column; gap: 6px; }
.item, .item-head { display: grid; grid-template-columns: 24px 1fr; gap: 6px; align-items: center; }
.item-head { display: none; color: var(--muted); font-size: 0.85em; }
@media (min-width: 820px) {
  .item, .item-head { grid-template-columns: 24px 2fr 1fr 110px 150px; }
  .item-head { display: grid; }
}
