/* OMS demo: page shell modelled on the ONCOLOGY Management System, then the two plan tiles */
:root {
  --bg: #f1f4f9; --surface: #ffffff; --sunk: #f3f4f6; --ink: #1f2937; --text: #374151; --muted: #6b7280; --line: #e5e7eb; --grid: #d1d5db; --wkend: #f6f7f9;
  --blue: #0c83ff; --green: #059669; --red: #ef4444; --orange: #f58646; --pink: #f781be; --syringe: #f35c86;
  --done: #6a4bc4; --done-soft: #ece7fb; --done-ink: #3f2a8c;
  --next: #c2560f; --next-soft: #fff1e4;
  --dev: #a35207; --dev-soft: #fcefd9;
  --note: #1d4ed8; --plan: #7b8794; --bad: #b42318;
  --shadow: 0 10px 30px rgba(20, 28, 40, .16), 0 2px 6px rgba(20, 28, 40, .08);
  --card-shadow: 0 1px 3px rgba(0, 0, 0, .1), 0 1px 2px -1px rgba(0, 0, 0, .1);
  --f-body: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-data: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  --top-h: 54px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-padding-top: 110px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--f-body); -webkit-font-smoothing: antialiased; }
svg { flex: none; }
.top svg, .side svg, .phead svg, .pinfo svg, .study svg, .tile-h svg, .lab-f svg, .rc-h svg, .totop svg, .rc-b svg, .card svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* top bar */
.top { position: sticky; top: 0; z-index: 15; height: var(--top-h); display: flex; align-items: center; padding: 0 28px 0 10px; color: #fff; background: linear-gradient(90deg, #0a3978 0%, #4ba3ed 54%, #0b790d 100%); }
.logo { display: flex; align-items: center; color: #fff; text-decoration: none; }
.logo svg { display: block; fill: initial; stroke: none; }
.navbtn { display: none; border: 0; background: none; color: #fff; padding: 6px; margin-right: 4px; }
.navbtn svg { width: 22px; height: 22px; }
.search { position: absolute; left: 50%; top: 8px; transform: translateX(-50%); width: 466px; max-width: calc(100vw - 560px); height: 38px; border: 1px solid rgba(255, 255, 255, .32); border-radius: 19px; display: flex; align-items: center; gap: 14px; padding: 0 16px; }
.search svg { width: 17px; height: 17px; }
.search input { border: 0; background: none; color: #fff; font: 14px var(--f-body); width: 100%; outline: none; }
.search input::placeholder { color: #fff; opacity: .95; }
.top-r { margin-left: auto; display: flex; align-items: center; gap: 30px; }
.ti { display: inline-flex; }
.ti svg { width: 20px; height: 20px; }
.user { position: relative; }
.user > button { border: 0; background: none; color: #fff; display: flex; align-items: center; gap: 8px; font: 600 14px var(--f-body); letter-spacing: .01em; padding: 4px 0; cursor: pointer; }
.user > button svg { width: 19px; height: 19px; }
.umenu { position: absolute; right: 0; top: calc(100% + 10px); background: #fff; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); min-width: 230px; padding: 6px; z-index: 25; font-size: 14px; }
.umenu .mi { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; font: inherit; color: inherit; cursor: pointer; }
.umenu .mi:hover { background: var(--sunk); }
.umenu .mh { padding: 6px 10px 8px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.umenu .cf { padding: 8px 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* layout */
.layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); }
.side { position: sticky; top: var(--top-h); height: calc(100vh - var(--top-h)); overflow-y: scroll; background: #6f98d1; color: #fff; padding: 12px 0 20px; scrollbar-width: thin; scrollbar-color: #6b7280 #eef0f3; }
.dash { display: flex; align-items: center; gap: 14px; padding: 4px 18px 0; height: 32px; color: #fff; text-decoration: none; font-weight: 600; font-size: 14px; }
.dash svg { width: 15px; height: 15px; fill: #fff; stroke: none; }
.side .sec { padding: 20px 18px 6px; font-size: 12px; font-weight: 500; letter-spacing: .04em; color: rgba(255, 255, 255, .78); }
.pats { list-style: none; margin: 0; padding: 0; }
.pat { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 41.5px; border: 0; background: none; color: #fff; text-align: left; padding: 4px 12px 4px 10px; font: 14px/1.3 var(--f-body); cursor: pointer; }
.pat svg { width: 16px; height: 16px; }
.pat:hover { background: rgba(255, 255, 255, .12); }
.pat[aria-current="true"] { background: rgba(255, 255, 255, .24); font-weight: 600; box-shadow: inset 3px 0 0 #fff; }
.main { min-width: 0; }

/* patient header + info bar */
.phead { background: #fff; min-height: 78px; display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 8px 16px 8px 22px; border-bottom: 1px solid #e4e6ea; }
.pname { display: flex; align-items: center; gap: 8px; font-size: 20px; font-weight: 700; color: var(--ink); }
.pname svg { width: 17px; height: 17px; color: var(--muted); }
.pname small { font-size: 14px; font-weight: 400; color: var(--muted); }
.pbtns { margin-left: auto; display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.pb { height: 33px; min-width: 41px; padding: 0 11px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; border: 1px solid #e5e7eb; background: #f3f4f6; border-radius: 6px; color: var(--ink); font: 500 15px var(--f-body); box-shadow: 0 1px 1px rgba(0, 0, 0, .04); }
.pb svg { width: 15px; height: 15px; }
.pb.app { height: 38px; min-width: 48px; }
.pb.app svg { width: 22px; height: 22px; stroke: none; }
.pb.bdb { height: 38px; color: #2563eb; font-weight: 600; padding: 0 16px; }
.pb.bdb svg { stroke: none; }
.pb.close { height: 39px; padding: 0 15px; color: var(--text); font-weight: 400; gap: 8px; }
.pb.close svg { width: 17px; height: 17px; stroke-width: 1.7; }
.pinfo { position: sticky; top: var(--top-h); z-index: 12; background: #fff; min-height: 43px; display: flex; flex-wrap: wrap; align-items: center; padding: 6px 16px 6px 20px; font-size: 14px; color: var(--ink); border-bottom: 1px solid #e3e6eb; box-shadow: 0 2px 4px rgba(15, 23, 42, .04); }
.pinfo .it { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.pinfo .it svg { width: 15px; height: 15px; color: #4b5563; }
.pinfo .it svg.fill { fill: currentColor; stroke: none; }
.pinfo .sl { color: #6b7280; margin: 0 9px; }
.pinfo .chip { background: #f3f4f6; border-radius: 4px; padding: 2px 8px; font-size: 12px; font-weight: 700; color: var(--text); }
.pinfo .warn { display: inline-flex; align-items: center; justify-content: center; width: 25px; height: 21px; border-radius: 3px; background: var(--red); }
.pinfo .warn svg { width: 14px; height: 14px; fill: #fff; stroke: none; }

/* study tab, diagnosis, block cards */
.content { padding: 18px 20px 60px 21px; }
.study { border-bottom: 1px solid #dee1e7; display: flex; }
.study-tab { display: inline-flex; align-items: center; gap: 12px; padding: 9px 16px 10px 22px; color: var(--text); font-size: 14px; border-bottom: 2px solid var(--blue); margin-bottom: -1px; }
.study-tab svg { width: 16px; height: 16px; color: var(--ink); }
.diag { margin-top: 19px; background: #fff; border: 1px solid #e4e7eb; border-radius: 6px; min-height: 42px; display: flex; align-items: center; gap: 10px; padding: 8px 18px; color: var(--text); font-size: 14px; box-shadow: 0 1px 2px rgba(0, 0, 0, .03); }
.diag svg { width: 17px; height: 17px; fill: var(--ink); stroke: none; }
.diag svg .w { stroke: #fff; stroke-width: 2.4; fill: none; }
.cards { margin-top: 19px; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 19px; align-items: start; }
.card { position: relative; background: var(--green); color: #fff; border-radius: 6px; padding: 19px 20px 20px; min-height: 110px; box-shadow: 0 1px 3px rgba(0, 0, 0, .16), 0 1px 2px rgba(0, 0, 0, .08); }
.card[data-blk] { cursor: pointer; }
.card[data-blk]:hover { filter: brightness(1.04); }
.card.sel { outline: 3px solid var(--blue); outline-offset: 2px; }
.card.visum { background: var(--red); }
.card.cur { background: var(--orange); }
.card-h { display: flex; align-items: center; gap: 10px; }
.card-t { flex: 1; min-width: 0; font-size: 16px; line-height: 24.5px; font-weight: 700; overflow-wrap: anywhere; }
.card-c { width: 22px; height: 22px; border-radius: 50%; background: rgba(0, 0, 0, .5); font: 700 11px/22px var(--f-body); text-align: center; flex: none; }
.card-d { font-size: 14px; line-height: 22px; margin-top: 1px; }
.card-n { font-size: 12px; margin-top: 5px; }
.card-pg { height: 2px; margin-top: 2px; background: linear-gradient(90deg, #4a84ce var(--p), rgba(255, 255, 255, .92) var(--p)); }
.card-tag { font-size: 12px; margin-top: 2px; color: rgba(255, 255, 255, .82); }
.card-x { display: block; margin: 8px auto -8px; border: 0; background: none; color: #fff; padding: 2px 8px; cursor: pointer; }
.card-x svg { width: 30px; height: 30px; stroke-width: 2.2; display: block; }
.card-x[aria-expanded="true"] svg { transform: rotate(180deg); }
.card-more { margin: 10px 0 0; padding: 8px 0 0 16px; border-top: 1px solid rgba(255, 255, 255, .35); font-size: 13px; line-height: 1.45; }

/* main column + right column */
.cols { margin-top: 20px; display: grid; grid-template-columns: minmax(0, 1fr) 378px; gap: 18px; align-items: start; }
.colm, .colr { display: grid; gap: 20px; min-width: 0; }
.tile { background: var(--surface); border-radius: 8px; box-shadow: var(--card-shadow); min-width: 0; scroll-margin-top: 110px; }
.tile-h { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; min-height: 58px; padding: 9px 20px; border-bottom: 1px solid #dfdfdf; }
.tile-h h2 { margin: 0; font-size: 18px; line-height: 1.3; font-weight: 600; color: var(--ink); display: flex; align-items: center; gap: 15px; }
.tile-h h2 svg { width: 19px; height: 19px; stroke-width: 1.7; }
.tile-h h2 svg.fill { fill: currentColor; stroke: none; }
.pdf-ic text { font: 700 7px var(--f-body); text-anchor: middle; fill: currentColor; stroke: none; }
.tile-h .info { font-size: 13px; color: var(--muted); }
.tile-h .right { margin-left: auto; display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ticons { display: inline-flex; gap: 6px; color: var(--ink); }
.ticons svg { width: 18px; height: 18px; stroke-width: 1.8; }
.noplan .arm, .noplan .seg, .noplan .info { display: none; }

/* Timeline (CATO day grid) */
.tl-b { padding: 20px 20px 22px; }
.tl-s { overflow-x: auto; scrollbar-width: auto; scrollbar-color: #6b7280 #e5e7eb; padding-bottom: 2px; }
.tlg { border-collapse: collapse; font-size: 14px; color: var(--ink); }
.tlg th, .tlg td { border: 1px solid var(--grid); padding: 9px 12px; text-align: center; vertical-align: middle; min-width: 54px; }
.tlg thead th { background: var(--pink); border-color: #fff #f9a8d4; height: 38px; font-weight: 600; padding: 6px 12px; }
.tlg thead th:first-child { background: #fff; border-color: var(--grid); }
.tlg .c0 { text-align: left; width: 128px; min-width: 128px; max-width: 128px; font-weight: 600; line-height: 1.55; padding: 10px 7px 12px; overflow-wrap: anywhere; }
.tlg .c0.lbl { font-weight: 400; padding-left: 20px; }
.tlg td .stk { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tlg td.we { background: #dddddd; }
.tlg tr.wd td, .tlg tr.dd td { height: 39px; padding: 6px 10px; }
.tlg tr.dd td { color: var(--text); }
.syr { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 5px; background: var(--syringe); }
.syr svg { width: 18px; height: 18px; stroke: #fff; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.cmi svg { width: 19px; height: 19px; display: block; fill: none; stroke: var(--ink); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tic { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; }
.tic svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tic svg.fill { fill: currentColor; stroke: none; }
.tic.blut { background: #fdecec; color: #ef4444; }
.tic.arzt { background: #e6f4f0; color: #059669; }
.tic.chemo, .tic.stat, .tic.kal { background: #e6f2ff; color: var(--blue); }
.tl-e { margin: 0; color: var(--muted); }

/* Labor */
.lab-links { gap: 12px; font-size: 14px; color: var(--text); }
.lab-links span { display: inline-flex; align-items: center; gap: 6px; }
.lab-links svg { width: 18px; height: 18px; stroke-width: 1.7; }
.lab-links svg.app2 { stroke: none; width: 20px; height: 20px; }
.lab-f { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px 20px; padding: 20px; }
.lab-f label { display: flex; align-items: center; gap: 20px; color: var(--text); font-size: 14px; }
.lab-f .inp, .lab-f .sel { position: relative; display: inline-flex; align-items: center; }
.lab-f input, .lab-f select { height: 40px; border: 1px solid var(--grid); border-radius: 6px; background: #fff; font: 14px var(--f-body); color: var(--text); }
.lab-f input { width: 240px; padding: 0 40px 0 14px; }
.lab-f input::placeholder { color: #6b7280; }
.lab-f .inp svg { position: absolute; right: 13px; width: 18px; height: 18px; color: #9ca3af; stroke-width: 1.6; pointer-events: none; }
.lab-f select { width: 82px; padding: 0 30px 0 13px; appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231f2937' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 14px center / 13px; }
.lab-t { overflow-x: auto; border-top: 1px solid var(--line); }
.labt { width: 100%; border-collapse: collapse; font-size: 14px; color: var(--text); white-space: nowrap; }
.labt th { text-align: left; font-weight: 600; color: var(--ink); padding: 10px 20px; line-height: 22px; border-bottom: 1px solid #9ca3af; vertical-align: middle; }
.labt td { padding: 8px 20px; height: 39px; border-bottom: 1px solid var(--grid); }
.labt tr.kw td { background: var(--sunk); font-weight: 600; color: var(--ink); }
.labt td.lo { color: var(--red); }
.labt td.no { padding: 18px 20px; color: var(--muted); }
.lab-p { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 20px 18px; font-size: 14px; color: var(--text); }
.lab-p .pg { display: flex; gap: 6px; }
.lab-p button { min-width: 34px; height: 34px; border: 1px solid var(--grid); background: #fff; border-radius: 6px; font: 14px var(--f-body); color: var(--text); cursor: pointer; }
.lab-p button[aria-current="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.lab-p button:disabled { opacity: .45; cursor: default; }

/* right column cards */
.rc { background: #fff; border-radius: 8px; box-shadow: var(--card-shadow); }
.rc-h { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 10px 20px; border: 0; border-bottom: 1px solid var(--line); background: none; border-radius: 8px 8px 0 0; font: 600 18px var(--f-body); color: var(--ink); text-align: left; }
button.rc-h { cursor: pointer; }
.rc-h svg { width: 19px; height: 19px; stroke-width: 1.7; }
.rc-h .chev { margin-left: auto; width: 20px; height: 20px; stroke-width: 1.8; }
.rc-b { min-height: 40px; }
.rc.closed .rc-b > * { display: none; }
.rc-l { list-style: none; margin: 0; padding: 12px 20px 16px; display: grid; gap: 10px; font-size: 14px; color: var(--text); }
.rc-l li { display: flex; gap: 10px; align-items: flex-start; }
.rc-l svg { width: 16px; height: 16px; margin-top: 2px; color: var(--muted); stroke-width: 1.8; }
.rc-l .d { margin-left: auto; color: var(--muted); font-size: 13px; white-space: nowrap; }
.rc-e { margin: 0; padding: 12px 20px 14px; color: var(--muted); font-size: 14px; }
.dec { list-style: none; margin: 0; padding: 22px 22px 22px 24px; position: relative; }
.dec li { position: relative; padding-left: 25px; padding-bottom: 20px; }
.dec li:last-child { padding-bottom: 0; }
.dec li::before { content: ""; position: absolute; left: -4px; top: 7px; width: 10px; height: 10px; border: 2px solid var(--blue); border-radius: 50%; background: #fff; box-sizing: border-box; z-index: 1; }
.dec li::after { content: ""; position: absolute; left: 0; top: 12px; bottom: -12px; width: 2px; background: var(--blue); }
.dec li:last-child::after { display: none; }
.dec .dd { font-size: 13px; color: var(--muted); }
.dec p { margin: 6px 0 0; font-size: 14px; line-height: 22px; color: var(--text); }
.tml { list-style: none; margin: 0; padding: 18px 8px 18px 20px; max-height: 392px; overflow-y: auto; display: grid; gap: 22px; scrollbar-width: thin; scrollbar-color: #6b7280 #e5e7eb; }
.tml li { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 0 18px; align-items: start; }
.tml .tic { width: 40px; height: 40px; }
.tml b { display: block; font-size: 15px; line-height: 22px; font-weight: 600; color: var(--ink); }
.tml .s2 { display: block; font-size: 13px; color: var(--muted); margin-top: 2px; }
.tml .nt { display: block; font-size: 14px; line-height: 22px; color: var(--text); margin-top: 2px; }
.tml .when { font-size: 13px; line-height: 20px; color: var(--muted); text-align: right; max-width: 92px; }
.totop { position: fixed; right: 30px; bottom: 26px; z-index: 14; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--grid); background: #fff; color: var(--ink); display: flex; align-items: center; justify-content: center; box-shadow: var(--card-shadow); cursor: pointer; }
.totop svg { width: 19px; height: 19px; stroke-width: 1.8; }

/* PDF viewer look for the "PDF (bisher)" and placeholder views */
.pdfimg { padding: 20px; display: grid; gap: 10px; }
.pdfv { border: 5px solid #e5e5e5; max-height: 720px; overflow: auto; background: #fff; scrollbar-color: #8b8b8b #fcfcfc; }
.pdfv img { display: block; width: 100%; max-width: 1140px; margin: 0 auto; background: #fff; }
.pdfimg p { margin: 0; font-size: 13px; color: var(--muted); text-align: center; }
.pdfph { min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #9ca3af; font-size: 14px; background: #fafafa; }
.pdfph svg { width: 54px; height: 54px; fill: none; stroke: currentColor; stroke-width: 1.2; stroke-linejoin: round; }

/* narrower screens */
@media (max-width: 1500px) { .cols { grid-template-columns: minmax(0, 1fr) 320px; } }
@media (max-width: 1100px) { .cols { grid-template-columns: minmax(0, 1fr); } .search { display: none; } }
@media (max-width: 900px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .navbtn { display: inline-flex; }
  .side { position: fixed; left: 0; top: var(--top-h); bottom: 0; width: 260px; height: auto; z-index: 14; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  body.nav-open .side { transform: none; }
  .top { padding: 0 12px 0 6px; }
  .top-r { gap: 16px; }
  .top-r .ti { display: none; }
  .phead { padding: 10px 16px; }
  .pbtns { margin-left: 0; gap: 10px; }
  .pinfo { position: static; padding: 8px 16px; row-gap: 4px; }
  .content { padding: 14px 12px 60px; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
  .totop { right: 14px; bottom: 14px; }
}

/* ===== the two plan tiles (same model and interactions as the click dummy) ===== */
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--note); outline-offset: 2px; }
.mono { font-family: var(--f-data); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 6px; padding: 6px 12px; font-size: 13px; }
.btn:hover:not(:disabled) { border-color: var(--ink); }
.btn.pri { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn.warn { border-color: var(--bad); color: var(--bad); }
.btn.sm { padding: 4px 9px; font-size: 12px; }


.seg { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 5px 11px; font-size: 12.5px; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--done-soft); color: var(--done-ink); font-weight: 600; }
.tile-h select { border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; background: var(--surface); font-size: 13px; }
.tile-b { min-width: 0; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 8px 16px 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { width: 16px; height: 11px; border-radius: 2px; box-sizing: border-box; display: inline-block; }
.lg.done { background: var(--done); } .lg.run { background: linear-gradient(90deg, var(--done) 50%, var(--done-soft) 50%); border: 1px solid var(--done); }
.lg.next { border: 2px solid var(--next); background: var(--next-soft); } .lg.planned { border: 1.5px dashed var(--plan); }
.lg.cancel { background: repeating-linear-gradient(45deg, var(--plan) 0 2px, transparent 2px 5px); opacity: .7; }
.lg.dia { width: 10px; height: 10px; transform: rotate(45deg); background: var(--done); margin: 0 3px; }
.lg.bdv, .lg.bcm { width: 14px; height: 14px; border-radius: 7px; } .lg.bdv { background: var(--dev); } .lg.bcm { background: var(--note); }
.scroll { overflow-x: auto; overscroll-behavior-x: contain; }

/* tile 1: time axis */
.chart { display: grid; grid-template-columns: 124px auto; position: relative; padding-bottom: 4px; }
.lc { position: sticky; left: 0; z-index: 3; background: var(--surface); border-right: 1px solid var(--line); padding: 0 12px; display: flex; align-items: center; font-size: 12px; font-weight: 600; color: var(--muted); }
.lc.lane { border-top: 1px solid var(--line); }
.tr { position: relative; }
.tr.lane { border-top: 1px solid var(--line); }
.tr.add { cursor: copy; }
.tr.add:hover { background: color-mix(in srgb, var(--sunk) 70%, transparent); }
.mtick { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); opacity: .7; pointer-events: none; }
.mlab { position: absolute; top: 4px; font-size: 11px; color: var(--muted); white-space: nowrap; pointer-events: none; }
.today { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1.5px solid var(--note); z-index: 2; pointer-events: none; }
.today-lab { position: absolute; font: 600 11px/1 var(--f-body); color: var(--note); background: var(--surface); padding: 3px 5px; border-radius: 3px; border: 1px solid var(--note); white-space: nowrap; z-index: 2; pointer-events: none; }
.el { position: absolute; border: 0; padding: 0; background: none; z-index: 1; }
.el .b { display: block; height: 24px; border-radius: 4px; font-size: 11.5px; font-weight: 600; line-height: 24px; padding: 0 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; box-sizing: border-box; }
.el .dt { position: absolute; left: 0; top: 27px; font: 400 10.5px/1 var(--f-data); color: var(--muted); white-space: nowrap; }
.el.s-done .b { background: var(--done); color: #fff; }
.el.s-run .b { background: linear-gradient(90deg, color-mix(in srgb, var(--done) 38%, var(--surface)) var(--p, 50%), var(--done-soft) var(--p, 50%)); color: var(--ink); border: 1.5px solid var(--done); line-height: 21px; }
.el.s-next .b { background: var(--next-soft); color: var(--next); border: 2px solid var(--next); line-height: 20px; }
.el.s-planned .b { background: var(--surface); color: var(--muted); border: 1.5px dashed var(--plan); line-height: 21px; }
.el.s-cancel .b { background: repeating-linear-gradient(45deg, var(--sunk) 0 3px, transparent 3px 6px); color: var(--muted); border: 1px solid var(--line); text-decoration: line-through; }
.el.tight .b { font-size: 10.5px; padding: 0 1px; letter-spacing: -.01em; }
.el.k-bar .b { text-align: left; padding-left: 8px; border-radius: 12px; }
.el.k-bar.open-end .b { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.el.k-pill .b { height: 20px; line-height: 18px; border-radius: 10px; font-weight: 500; font-size: 11px; padding: 0 8px; }
.el.k-pill.s-done .b { background: var(--done-soft); color: var(--done-ink); border: 1px solid transparent; }
.el.k-pill .b .mono { font-size: 10.5px; opacity: .85; }
.el.k-dia { display: flex; align-items: center; gap: 7px; height: 24px; }
.el.k-dia .dm { width: 14px; height: 14px; transform: rotate(45deg); border-radius: 2px; flex: none; margin-left: 3px; background: var(--done); }
.el.k-dia .dl { font-size: 11.5px; white-space: nowrap; }
.el.k-dia .dl b { font-weight: 600; }
.el:hover .b, .el:hover .dm { box-shadow: 0 0 0 2px color-mix(in srgb, var(--note) 35%, transparent); }
.el.sel .b, .el.sel .dm { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--note); }
.el.inblk .b { outline: 2px solid var(--note); outline-offset: 2px; }
.el.flash .b, .el.flash .dm, .ev.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px var(--surface), 0 0 0 6px var(--note); } 100% { box-shadow: none; } }
@media (prefers-reduced-motion: reduce) { .el.flash .b, .el.flash .dm, .ev.flash { animation: none; } }
.bd { position: absolute; top: -7px; min-width: 15px; height: 15px; border-radius: 8px; font: 700 9.5px/15px var(--f-body); text-align: center; color: #fff; padding: 0 3px; box-sizing: border-box; pointer-events: none; }
.bd.dv { left: -6px; background: var(--dev); }
.el.k-box .bd.dv { left: 6px; }
.bd.cm { right: -6px; background: var(--note); }
.arm { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 12.5px; color: var(--muted); }
.arm .ac { border: 1px solid var(--done); background: var(--done-soft); color: var(--done-ink); border-radius: 12px; padding: 2px 9px; font-size: 12px; font-weight: 600; }
.arm .ac:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--note) 35%, transparent); }
.arm .ac span { font-weight: 400; color: var(--muted); }
.tree { position: relative; }
.tl1 { position: absolute; pointer-events: none; }
.tl1.on { background: var(--done); }
.tl1.on.fut { background: repeating-linear-gradient(90deg, var(--done) 0 6px, transparent 6px 10px); }
.tl1.alt { background: var(--plan); opacity: .55; }
.tl1.v.on.fut { background: var(--done); }
.pn { position: absolute; height: 26px; border-radius: 4px; font: 600 12px/26px var(--f-body); padding: 0 9px; border: 0; white-space: nowrap; box-sizing: border-box; z-index: 1; }
.pn.s-done { background: var(--done); color: #fff; }
.pn.s-run { background: color-mix(in srgb, var(--done) 38%, var(--surface)); color: var(--ink); border: 2px solid var(--done); line-height: 22px; }
.pn.s-next { background: var(--next-soft); color: var(--next); border: 2px solid var(--next); line-height: 22px; }
.pn.s-planned { background: var(--surface); color: var(--muted); border: 1.5px dashed var(--plan); line-height: 23px; }
.pn .pd { position: absolute; left: 0; top: 30px; font: 400 10.5px/1 var(--f-data); color: var(--muted); }
.pn .now { position: absolute; left: 50%; top: -17px; transform: translateX(-50%); font: 600 10.5px/1 var(--f-body); color: var(--note); white-space: nowrap; }
.pn:hover, .pdm:hover, .oc.alt:hover, .more:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--note) 35%, transparent); }
.pa { position: absolute; height: 22px; line-height: 20px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); border-radius: 4px; font-size: 11.5px; padding: 0 8px; white-space: nowrap; box-sizing: border-box; z-index: 1; }
.oc { position: absolute; height: 22px; line-height: 20px; font-size: 11.5px; font-weight: 600; border-radius: 11px; padding: 0 9px; white-space: nowrap; border: 1px solid var(--line); background: var(--sunk); color: var(--muted); box-sizing: border-box; z-index: 1; }
.oc.on { background: var(--done-soft); color: var(--done-ink); border-color: var(--done); }
button.oc.alt { cursor: pointer; }
.pdm { position: absolute; width: 16px; height: 16px; transform: rotate(45deg); border: 0; padding: 0; border-radius: 2px; background: var(--done); z-index: 1; }
.pdm.alt { background: var(--surface); border: 2px solid var(--plan); }
.pdl { position: absolute; font-size: 10.5px; color: var(--muted); white-space: nowrap; transform: translateX(-50%); pointer-events: none; }
.more { position: absolute; height: 22px; font-size: 11.5px; border: 1px dashed var(--note); background: var(--surface); border-radius: 11px; padding: 0 9px; color: var(--note); white-space: nowrap; z-index: 1; }
.inblk-tag { position: absolute; font-size: 10.5px; color: var(--note); white-space: nowrap; pointer-events: none; }

/* tile 2: block grid */
.binfo { display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: baseline; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
.binfo b { font-size: 15px; }
.blkwrap { padding: 4px 0 8px; }
.bg { display: grid; grid-template-columns: 210px auto; }
.bl { position: sticky; left: 0; z-index: 3; background: var(--surface); border-right: 1px solid var(--line); padding: 0 12px; display: flex; flex-direction: column; justify-content: center; min-height: 32px; }
.bl b { font-size: 12.5px; font-weight: 600; }
.bl span { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bl.hd { font-size: 11px; color: var(--muted); font-weight: 600; }
.bt { position: relative; border-top: 1px solid var(--line); }
.bt.top { border-top: 0; }
.wk { position: absolute; top: 0; bottom: 0; background: var(--wkend); pointer-events: none; }
.dline { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); pointer-events: none; }
.dnum { position: absolute; top: 4px; font: 500 10.5px/1 var(--f-data); color: var(--muted); text-align: center; pointer-events: none; }
.dnum.wk1 { color: var(--ink); font-weight: 600; }
.ddate { position: absolute; top: 18px; font: 400 10px/1 var(--f-data); color: var(--muted); white-space: nowrap; pointer-events: none; }
.tcol { position: absolute; top: 0; bottom: 0; background: color-mix(in srgb, var(--note) 10%, transparent); border-left: 1.5px solid var(--note); pointer-events: none; }
.sub { position: absolute; top: 6px; height: 20px; border: 1px solid var(--ink); border-top-width: 0; border-radius: 0 0 3px 3px; background: transparent; font: 600 11.5px/1 var(--f-body); padding: 0; }
.sub .sl { position: absolute; left: 50%; top: -1px; transform: translateX(-50%); background: var(--surface); padding: 0 6px; white-space: nowrap; }
.sub:hover { border-color: var(--note); color: var(--note); }
.sub .bd { top: -6px; }
.ev { position: absolute; border: 0; padding: 0; background: none; z-index: 1; }
.ev .dot { display: block; width: 12px; height: 12px; border-radius: 50%; box-sizing: border-box; }
.ev .bar { display: block; height: 10px; border-radius: 5px; box-sizing: border-box; }
.ev .tp { display: flex; align-items: center; gap: 1px; }
.ev.s-done .dot, .ev.s-done .bar, .ev.s-done .tp i { background: var(--done); }
.ev.s-run .bar { background: linear-gradient(90deg, var(--done) var(--p, 50%), var(--done-soft) var(--p, 50%)); border: 1.5px solid var(--done); }
.ev.s-next .dot, .ev.s-next .bar { background: var(--next-soft); border: 2px solid var(--next); }
.ev.s-planned .dot, .ev.s-planned .bar, .ev.s-planned .tp i { background: var(--surface); border: 1.5px dashed var(--plan); }
.ev.s-cancel .dot { background: transparent; border: 1.5px solid var(--plan); position: relative; }
.ev.s-cancel .dot::after { content: "✕"; position: absolute; inset: -6px 0 0 -3px; font: 700 15px/1 var(--f-body); color: var(--bad); }
.ev.s-cancel .bar { background: repeating-linear-gradient(45deg, var(--plan) 0 2px, transparent 2px 5px); opacity: .7; }
.ev .tp i { display: block; border-radius: 2px; box-sizing: border-box; }
.ev .bd { top: -9px; }
.ev .bd.dv { left: -9px; } .ev .bd.cm { right: -9px; }
.ev:hover .dot, .ev:hover .bar, .ev:hover .tp { box-shadow: 0 0 0 2px color-mix(in srgb, var(--note) 40%, transparent); }
.ev.sel .dot, .ev.sel .bar, .ev.sel .tp { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--note); }
.bfoot { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
@media (max-width: 900px) { .bfoot { grid-template-columns: minmax(0, 1fr); } }
.tblw { overflow-x: auto; }
table.dt { border-collapse: collapse; width: 100%; min-width: 520px; font-size: 12.5px; }
.dt th, .dt td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.dt th { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.fn { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.fn b { color: var(--ink); }
.noschema { padding: 22px 16px; color: var(--muted); }

/* popover */
.pop { position: fixed; z-index: 20; width: 380px; max-width: calc(100vw - 24px); max-height: min(78vh, 640px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.pop-h { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px 8px; position: sticky; top: 0; background: var(--surface); z-index: 1; }
.pop-h h3 { margin: 0; font-size: 15px; line-height: 1.3; }
.pop-h .sub2 { font-size: 12px; color: var(--muted); }
.pop-h .x { margin-left: auto; border: 0; background: none; font-size: 18px; line-height: 1; color: var(--muted); padding: 2px 4px; }
.pop-b { padding: 0 14px 14px; display: grid; gap: 10px; }
.st { display: inline-block; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 10px; }
.st.done, .st.run { background: var(--done-soft); color: var(--done-ink); }
.st.next { background: var(--next-soft); color: var(--next); } .st.planned { background: var(--sunk); color: var(--muted); }
.st.cancel { background: var(--sunk); color: var(--muted); text-decoration: line-through; }
.kv { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 3px 10px; font-size: 13px; margin: 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.was { text-decoration: line-through; color: var(--muted); }
.box { border-radius: 6px; padding: 8px 10px; font-size: 13px; display: grid; gap: 4px; }
.box.tpl { background: var(--sunk); }
.box.tpl b { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.dvl { background: var(--dev-soft); }
.dvl .h { color: var(--dev); font-weight: 600; }
.cml { display: grid; gap: 6px; }
.cm { font-size: 13px; }
.cm .who { color: var(--note); font-weight: 600; } .cm .when { font: 400 11px var(--f-data); color: var(--muted); }
.acts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.acts .btn { padding: 8px 10px; text-align: center; }
.acts .btn.pri { grid-column: 1 / -1; }
.foot { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.lnk { border: 0; background: none; padding: 0; color: var(--note); font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; }
.lnk.red { color: var(--bad); }
.opts { display: grid; gap: 6px; }
.opt { display: grid; grid-template-columns: 20px minmax(0, 1fr); gap: 2px 8px; border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 13px; }
.opt.ch { border-color: var(--done); background: var(--done-soft); }
.opt.no { color: var(--muted); }
.opt .s { grid-column: 2; font-size: 12px; color: var(--muted); }
.f { display: grid; gap: 4px; }
.f > span, .f > label { font-size: 12px; font-weight: 600; color: var(--muted); }
.f input[type="date"], .f input[type="text"], .f select, .f textarea { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: var(--surface); font-size: 13px; min-width: 0; }
.f textarea { min-height: 58px; resize: vertical; }
.row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chk { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; }
.chk input { margin-top: 3px; }
.hint { font-size: 12px; color: var(--muted); }
.endbtns { display: flex; justify-content: flex-end; gap: 8px; }
details.hist summary { font-size: 12.5px; color: var(--muted); cursor: pointer; }
details.hist ul { margin: 6px 0 0; padding-left: 18px; font-size: 12.5px; display: grid; gap: 3px; }
@media (max-width: 720px) {
  .pop { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: auto; max-width: none; max-height: 82vh; border-radius: 12px 12px 0 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
}
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom, 0px)); z-index: 30; background: var(--ink); color: var(--bg); border-radius: 8px; padding: 9px 12px 9px 14px; display: flex; gap: 12px; align-items: center; font-size: 13px; box-shadow: var(--shadow); }
.toast button { border: 1px solid color-mix(in srgb, var(--bg) 45%, transparent); background: transparent; color: var(--bg); border-radius: 5px; padding: 3px 9px; font-size: 12.5px; }
