:root {
  color-scheme: dark;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #111526;
  color: #f4f5ff;
  --panel: #191f34;
  --line: #343e5a;
  --muted: #b4c0dc;
  --violet: #d5c5ff;
  --mint: #99e7cd;
  --rose: #ffb9c3;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
main, .top { max-width: 1120px; margin: auto; padding-inline: max(1rem, env(safe-area-inset-left)); }
main { padding-bottom: calc(1.5rem + env(safe-area-inset-bottom)); }
.top { display: flex; justify-content: space-between; align-items: center; padding-top: max(1rem, env(safe-area-inset-top)); padding-bottom: 1rem; }
.brand { display: flex; align-items: center; gap: .7rem; }
.brand img { width: 46px; height: 46px; border-radius: 12px; }
.brand strong { font-size: 1.2rem; font-weight: 750; }
.brand span, .muted, .toolbar span, small { display: block; color: var(--muted); }
.brand span, .toolbar span, small { font-size: .88rem; }
button, input { font: inherit; color: inherit; min-height: 44px; }
button { cursor: pointer; padding: .55rem .8rem; border-radius: 11px; background: #28344f; border: 1px solid transparent; font-weight: 650; }
button:hover, button:focus-visible, input:focus-visible { outline: 2px solid var(--violet); outline-offset: 2px; }
button:disabled { opacity: .55; }
.quiet { background: transparent; border-color: var(--line); }
.primary, .tabs button[aria-pressed=true] { background: var(--violet); color: #251442; }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; margin: 0 0 .5rem; }
.tabs button { padding-inline: .3rem; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .5rem; }
.live-notice { position: fixed; z-index: 5; top: calc(env(safe-area-inset-top) + .75rem); left: 50%; transform: translateX(-50%); max-width: calc(100% - 2rem); width: max-content; background: #d4f7eb; color: #102e27; border-radius: 12px; padding: .65rem 1rem; font-weight: 700; box-shadow: 0 5px 22px #0006; pointer-events: none; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 1rem; margin-bottom: .8rem; }
.login { max-width: 28rem; margin: 8vh auto 0; display: grid; gap: .6rem; }
input { min-width: 0; padding: .55rem; border: 1px solid var(--line); border-radius: 8px; background: #101628; }
input[type=date] { width: 10rem; }
h1, h2, p { margin: 0 0 .5rem; }
h1 { font-size: 1.55rem; }
h2 { font-size: 1.1rem; }
.caption { font-size: .9rem; color: var(--muted); }
.connection-error:not(:empty), #login-message:not(:empty) { color: var(--rose); margin: .5rem 0; }
.hero, .columns { display: grid; gap: .7rem; }
.hero { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.hero .card { padding: .7rem; }
.stat { color: var(--mint); font-size: clamp(1.35rem, 5vw, 2rem); font-weight: 750; }
.stat small { font-weight: 500; margin-top: .2rem; }
.line { display: flex; align-items: baseline; justify-content: space-between; gap: .55rem; border-top: 1px solid var(--line); padding: .55rem 0; }
.line:first-of-type { margin-top: .45rem; }
.line:last-child { padding-bottom: 0; }
.line strong { overflow-wrap: anywhere; }
.line small { margin-top: .15rem; }
.amount { color: var(--mint); font-variant-numeric: tabular-nums; text-align: right; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .7rem; }
table { border-collapse: collapse; width: 100%; font-size: clamp(.82rem, 3.6vw, 1rem); font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: .55rem .12rem; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { text-align: left; }
th { color: var(--muted); font-weight: 600; }
.notebook-sheet { background: #fff; color: #172846; border: 1px solid #dbe3ef; border-radius: 12px; padding: clamp(.85rem, 3vw, 1.75rem); margin-top: .65rem; }
.notebook-title { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.notebook-title h3 { font-size: 1.18rem; margin: 0 0 .45rem; }
.notebook-title span, .notebook-row time, .notebook-row.small { color: #506580; font-size: .83rem; }
.notebook-rows { margin: .55rem 0 .85rem; }
.notebook-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .4rem; padding: .42rem 0; align-items: baseline; border-bottom: 1px solid #e4eaf4; break-inside: avoid; }
.notebook-row div { white-space: pre-line; overflow-wrap: anywhere; }
.notebook-extra, .notebook-room { margin-inline-start: .42rem; }
.notebook-room { display: inline-block; font-size: .84rem; }
.notebook-balance { font-size: 1.04rem; font-weight: 650; margin: 0; }
.calendar-buttons { display: flex; gap: .35rem; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .65rem; font-size: .82rem; }
.calendar-legend span { padding: .3rem .55rem; border: 1px solid var(--line); border-radius: 6px; }
.inside { background: #723446; }
.left { background: #205447; }
.planned { background: #3d3a64; }
.free { background: #10182f; }
.calendar-scroll { overflow: auto; max-height: min(68vh, 43rem); border: 1px solid var(--line); border-radius: 9px; }
.room-grid { display: table; width: 100%; min-width: 40rem; border-collapse: separate; border-spacing: 0; table-layout: fixed; background: #10182f; }
.room-grid thead { display: table-header-group; position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
.room-grid tbody { display: table-row-group; }
.room-grid tr { display: table-row; border: 0; }
.room-grid th, .room-grid td { display: table-cell; border: 0; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; padding: .16rem; height: 2rem; }
.room-grid td::before { display: none; }
.room-grid th { position: sticky; top: 0; z-index: 2; background: #253150; color: #f4f5ff; }
.room-grid th:first-child { width: 3.45rem; left: 0; z-index: 3; }
.room-grid tbody th { top: auto; background: #1c2845; }
.room-grid .today { background: #352f56; }
.room-grid .stay { display: block; width: 100%; min-height: 1.75rem; padding: .15rem .3rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-radius: 4px; font-size: .82rem; }
.room-detail { max-width: min(27rem, calc(100% - 2rem)); border: 1px solid var(--line); border-radius: 14px; padding: 1rem; background: var(--panel); color: #fff; }
.room-detail::backdrop { background: #0007; }
@media (min-width: 750px) { .columns { grid-template-columns: repeat(2, minmax(0, 1fr)); } .span-all { grid-column: 1 / -1; } .notebook-long { columns: 2; column-gap: 1.25rem; } }
@media (max-width: 570px) {
  table, tbody { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  tbody tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--line); }
  tbody th { grid-column: 1 / -1; color: var(--violet); font-size: .95rem; }
  tbody th, tbody td { border: 0; }
  tbody td { text-align: left; font-size: .95rem; overflow-wrap: anywhere; }
  tbody td::before { display: block; content: attr(data-title); color: var(--muted); font-size: .83rem; }
}
