:root {
  --bg: #eceff0; --surface: #fafbfb; --ink: #16262b; --mute: #566a70; --line: #d3dbdc;
  --accent: #1b6a65; --accent-ink: #ffffff; --accent-wash: #d9e9e7;
  --user: #1f3f45; --user-ink: #f1f7f6;
  --warn: #7a4f00; --warn-wash: #f5e9cf; --bad: #9b2c2c;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Charter, "Bitstream Charter", Georgia, "Noto Serif", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --composer-h: 150px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1517; --surface: #172124; --ink: #e5eeee; --mute: #93a6a9; --line: #2a3a3d;
    --accent: #66bdb4; --accent-ink: #08201e; --accent-wash: #1b3634;
    --user: #2a5658; --user-ink: #f1f7f6;
    --warn: #e3b75f; --warn-wash: #2f2815; --bad: #f0a0a0;
  }
}
* { box-sizing: border-box; }
html { color-scheme: light dark; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); min-height: 100dvh; overflow-x: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }

/* ---------- top ---------- */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-in { max-width: 700px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-family: var(--serif); font-size: 18px; font-weight: 600; letter-spacing: .01em; }
.brand svg { width: 22px; height: 22px; color: var(--accent); }
.top-links { display: flex; gap: 14px; font-size: 14px; }
.top-links a { color: var(--mute); text-decoration: none; padding: 6px 0; }
.top-links a:hover { color: var(--ink); text-decoration: underline; }

/* ---------- thread ---------- */
.wrap { max-width: 700px; margin: 0 auto; padding: 8px 16px calc(var(--composer-h) + 24px); }
.thread { display: flex; flex-direction: column; }
.day { display: flex; align-items: center; gap: 12px; margin: 26px 0 14px; color: var(--mute); font-size: 13px; }
.day::before, .day::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.row { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 10px; margin-top: 14px; }
.row.cont { margin-top: 6px; }
.row.a.cont .mono { visibility: hidden; }
.mono { width: 30px; height: 30px; border-radius: 50%; background: var(--accent-wash); color: var(--accent); display: grid; place-items: center; margin-top: 2px; }
.mono svg { width: 18px; height: 18px; }
.col { display: flex; flex-direction: column; gap: 8px; min-width: 0; align-items: flex-start; }
.say { margin: 0; font-family: var(--serif); font-size: 17.5px; line-height: 1.55; max-width: 34em; overflow-wrap: anywhere; }
.say.hello { font-size: 25px; line-height: 1.3; font-weight: 500; letter-spacing: -.005em; }
.say small { display: block; margin-top: 8px; font-family: var(--sans); font-size: 12.5px; line-height: 1.4; color: var(--mute); }
.say ul { margin: 6px 0 0; padding-left: 1.1em; }
.say .link { font: inherit; }
.row.u { grid-template-columns: minmax(0, 1fr); justify-items: end; }
.row.u .col { align-items: flex-end; max-width: 88%; }
.bubble { background: var(--user); color: var(--user-ink); padding: 10px 14px; border-radius: 18px 18px 5px 18px; font-size: 16px; overflow-wrap: anywhere; white-space: pre-wrap; }
.att { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.att span { background: var(--user); color: var(--user-ink); opacity: .86; border-radius: 12px; padding: 4px 10px; font-size: 13px; }
.att img { width: 84px; height: 84px; object-fit: cover; border-radius: 12px; }
.typing { display: inline-flex; gap: 5px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px 18px 18px 5px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--mute); animation: dot 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
.typing em { font-style: normal; font-size: 13px; color: var(--mute); margin-left: 6px; }
@keyframes dot { 0%, 80%, 100% { opacity: .25; transform: none; } 40% { opacity: 1; transform: translateY(-3px); } }
.link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; text-align: left; }

/* ---------- cards in the stream ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; width: 100%; max-width: 34em; }
.prop { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 14px; padding: 14px; }
.when { text-align: center; border-right: 1px solid var(--line); padding-right: 12px; font-family: var(--serif); }
.when b { display: block; font-size: 30px; line-height: 1; font-weight: 600; }
.when span { display: block; font-size: 14px; color: var(--mute); margin-top: 2px; }
.when i { display: block; font: normal 12px/1.3 var(--sans); color: var(--mute); margin-top: 6px; }
.what .t { margin: 0; font-weight: 600; font-size: 16px; overflow-wrap: anywhere; }
.what .src { margin: 4px 0 0; font-size: 13.5px; color: var(--mute); }
.what .quote { margin: 8px 0 0; padding-left: 10px; border-left: 2px solid var(--accent-wash); font-family: var(--serif); font-size: 14.5px; color: var(--mute); overflow-wrap: anywhere; }
.flag { display: inline-block; margin-top: 8px; padding: 2px 9px; border-radius: 10px; font-size: 12.5px; background: var(--warn-wash); color: var(--warn); }
.what details { margin-top: 8px; font-size: 14px; }
.what summary { cursor: pointer; color: var(--accent); }
.what label { display: block; margin-top: 8px; font-size: 14px; }
.what input[type=date], .sheet-body input, .sheet-body select { margin-top: 4px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); min-height: 40px; max-width: 100%; }
.btns { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.btn { min-height: 42px; padding: 8px 18px; border-radius: 21px; border: 1px solid var(--line); background: transparent; font-weight: 600; font-size: 15px; }
.btn.go { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn:disabled { opacity: .55; cursor: default; }
.paper { display: block; width: 100%; max-width: 34em; text-align: left; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.paper:hover { border-color: var(--accent); }
.paper .n { font-weight: 600; overflow-wrap: anywhere; }
.paper .s { margin: 3px 0 0; font-size: 14px; color: var(--mute); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.paper .m { margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; font-size: 12.5px; color: var(--mute); }
.chip { background: var(--accent-wash); color: var(--accent); padding: 1px 9px; border-radius: 10px; }
.chip.warn { background: var(--warn-wash); color: var(--warn); }
.agenda { padding: 4px 14px; }
.agenda button { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 10px; width: 100%; padding: 10px 0; background: none; border: 0; border-top: 1px solid var(--line); text-align: left; }
.agenda button:first-child { border-top: 0; }
.agenda .d { color: var(--mute); font-size: 14px; }
.agenda .d b { display: block; color: var(--ink); font-family: var(--serif); font-size: 16px; }
.agenda .v { overflow-wrap: anywhere; align-self: center; }
.src-list { display: flex; flex-wrap: wrap; gap: 6px; }
.src-list button { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px 11px; font-size: 13px; }

/* ---------- composer ---------- */
.composer { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; background: linear-gradient(to bottom, transparent, var(--bg) 22px); padding-top: 22px; }
.composer-in { max-width: 700px; margin: 0 auto; padding: 0 16px calc(12px + env(safe-area-inset-bottom)); }
.quick { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: none; }
.quick::-webkit-scrollbar { display: none; }
.quick button { flex: none; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 6px 14px; font-size: 14px; min-height: 36px; white-space: nowrap; }
.quick button:hover { border-color: var(--accent); color: var(--accent); }
.quick span { margin-left: 6px; color: var(--mute); }
.staged { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 8px; }
.staged span { display: inline-flex; align-items: center; gap: 6px; background: var(--accent-wash); color: var(--ink); border-radius: 14px; padding: 4px 6px 4px 11px; font-size: 13px; max-width: 100%; }
.staged b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 200px; }
.staged button { border: 0; background: none; width: 22px; height: 22px; line-height: 1; border-radius: 50%; }
.field { display: flex; align-items: flex-end; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 26px; padding: 5px; }
.field:focus-within { border-color: var(--accent); }
.field textarea { flex: 1; min-width: 0; resize: none; border: 0; background: none; padding: 10px 6px; max-height: 120px; line-height: 1.4; outline: none; }
.ic { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; background: none; color: var(--mute); display: grid; place-items: center; }
.ic svg { width: 22px; height: 22px; }
.ic:hover { color: var(--ink); background: var(--bg); }
.ic.rec { background: var(--bad); color: #fff; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .6; } }
.send { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; }
.send svg { width: 22px; height: 22px; }
.send:disabled { opacity: .5; }
.asnote { display: block; margin-top: 6px; font-size: 13px; color: var(--mute); }

/* ---------- sheet ---------- */
dialog { padding: 0; border: 0; background: var(--surface); color: var(--ink); max-width: none; max-height: none; margin: 0; }
dialog::backdrop { background: rgba(8, 18, 20, .5); }
dialog[open] { display: flex; flex-direction: column; position: fixed; top: 0; right: 0; left: auto; bottom: 0; width: min(560px, 100%); height: 100dvh; border-left: 1px solid var(--line); animation: slide .22s ease-out; }
@keyframes slide { from { transform: translateX(28px); opacity: 0; } }
.sheet-head { flex: none; display: flex; align-items: center; gap: 4px; padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--line); }
.sheet-head h2 { flex: 1; margin: 0; font: 600 20px/1.2 var(--serif); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-head .back { margin-left: -12px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 16px 18px 40px; }
.sheet-body h3 { font: 600 16px/1.3 var(--serif); margin: 22px 0 8px; }
.sheet-body h3:first-child { margin-top: 0; }
.muted { color: var(--mute); font-size: 14px; }
.lead { font-family: var(--serif); font-size: 17px; line-height: 1.55; margin: 0 0 12px; }
.filters { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }
.filters button { border: 1px solid var(--line); background: none; border-radius: 16px; padding: 4px 12px; font-size: 13.5px; min-height: 34px; }
.filters button[aria-pressed=true] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.plist { list-style: none; margin: 0; padding: 0; }
.plist li + li { border-top: 1px solid var(--line); }
.plist button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 12px 0; }
.plist .n { font-weight: 600; overflow-wrap: anywhere; }
.plist .m { font-size: 13px; color: var(--mute); margin-top: 2px; }
.weeknav { display: flex; align-items: center; gap: 6px; margin-bottom: 14px; }
.weeknav b { flex: 1; text-align: center; font-family: var(--serif); font-size: 16px; }
.weeknav button { border: 1px solid var(--line); background: none; border-radius: 18px; padding: 6px 14px; min-height: 38px; }
.dayrow .dd b { white-space: nowrap; }
.dayrow { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.dayrow .dd { font-size: 13px; color: var(--mute); }
.dayrow .dd b { display: block; font: 600 22px/1.1 var(--serif); color: var(--ink); }
.dayrow.today .dd b { color: var(--accent); }
.dayrow.today .dd::after { content: "dnes"; font-size: 12px; color: var(--accent); }
.ev { display: block; width: 100%; text-align: left; background: var(--bg); border: 0; border-left: 3px solid var(--accent); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; overflow-wrap: anywhere; }
.ev.ceka { border-left-color: var(--warn); }
.ev small { display: block; color: var(--mute); font-size: 12.5px; }
.free { color: var(--mute); font-size: 14px; }
.big { font: 600 38px/1.1 var(--serif); letter-spacing: -.01em; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0; }
.two div { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.two b { display: block; font: 600 19px/1.2 var(--serif); }
.spark { width: 100%; height: 70px; display: block; color: var(--accent); }
.item { padding: 12px 0; border-top: 1px solid var(--line); }
.item .top2 { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; }
.item .top2 b { overflow-wrap: anywhere; }
.item .top2 span { font: 600 16px var(--serif); white-space: nowrap; }
.item .sub { font-size: 13px; color: var(--mute); margin-top: 2px; }
.bar { height: 6px; background: var(--bg); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--accent); }
.inl { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: flex-end; }
.inl input, .inl select { flex: 1 1 110px; min-width: 0; }
.orig img { width: 100%; border-radius: 8px; border: 1px solid var(--line); display: block; margin-bottom: 8px; }
.orig iframe { width: 100%; height: 420px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.txt { white-space: pre-wrap; font: 13.5px/1.5 var(--sans); background: var(--bg); padding: 12px; border-radius: 8px; overflow-wrap: anywhere; max-height: 320px; overflow: auto; }
.term { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding: 10px 0; border-top: 1px solid var(--line); }

@media (max-width: 700px) {
  .say.hello { font-size: 23px; }
  .prop { grid-template-columns: 52px minmax(0, 1fr); gap: 12px; padding: 12px; }
  .when b { font-size: 26px; }
  .top-links { gap: 10px; font-size: 13px; }
  dialog[open] { top: auto; left: 0; width: 100%; height: 92dvh; border-left: 0; border-radius: 18px 18px 0 0; animation: rise .24s ease-out; }
  @keyframes rise { from { transform: translateY(40px); opacity: 0; } }
}
@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
