:root {
  color-scheme: light;
  --paper: #f1f1ec;
  --surface: #fbfbf7;
  --surface-alt: #f5f5ef;
  --ink: #20242a;
  --muted: #454b54;
  --line: #c8cdc5;
  --line-light: #d9dcd5;
  --slate: #26383a;
  --slate-deep: #1b2b2c;
  --slate-soft: #e5ebe5;
  --link: var(--ink);
  --calendar-heading: #edf0f2;
  --red: #9b3526;
  --red-paper: #f8ebe3;
  --today: #f8ece3;
  --accent-ink: #f4f6f7;
  --sidebar-muted: #c0cad3;
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 20px;
  --s5: 32px;
  --round: 3px;
  --text-font: "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
}
* { box-sizing: border-box; }
html { min-height: 100%; font-size: 16px; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1rem/1.55 var(--text-font); }
[hidden] { display: none !important; }
a { color: var(--link); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--link); outline-offset: 2px;
}
svg { display: inline-block; width: 16px; height: 16px; flex: none; vertical-align: middle; }
h1, h2, h3 { color: var(--ink); margin: 0; font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.5rem, 2.3vw, 1.95rem); }
h2 { font-size: 1rem; }
h3 { font-size: .94rem; }
p { margin: 0; }
small { font-size: .78rem; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tabular, .bad-date, .record-date { font-variant-numeric: tabular-nums; }

.shell { display: grid; grid-template-columns: 202px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: var(--slate-deep); color: var(--accent-ink); padding: 24px 14px 12px;
  position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex;
  flex-direction: column; overflow-y: auto; min-height: 0;
}
.wordmark { display: inline-flex; align-items: center; gap: var(--s2); align-self: flex-start; white-space: nowrap; color: inherit; text-decoration: none; font-weight: 700; }
.sidebar > .wordmark { margin: 0 0 var(--s4) var(--s2); }
.nav-group { margin-bottom: 20px; }
.nav-label { color: var(--sidebar-muted); font-size: .8125rem; margin: 0 0 5px var(--s2); }
.nav-link {
  min-height: 38px; padding: 7px var(--s2); display: flex; align-items: center; gap: var(--s2);
  color: var(--accent-ink); text-decoration: none; font-size: .875rem; border-radius: 2px;
}
.nav-link svg { color: var(--sidebar-muted); }
.nav-link:hover, .nav-link[aria-current=page] { background: #344746; color: #fff; }
.nav-link[aria-current=page] { font-weight: 700; }
.nav-link[aria-current=page] svg { color: currentColor; }
.sidebar :focus-visible { outline-color: var(--accent-ink); }
.profile {
  border-top: 1px solid #4e5d57; display: flex; align-items: center; padding: var(--s3) 0 0 var(--s2);
  gap: var(--s2); margin-top: auto; color: var(--accent-ink);
}
.profile .button { color: var(--accent-ink); }
.profile .button:hover { background: #344746; color: #fff; }
.profile-text { min-width: 0; flex: 1; display: grid; gap: 1px; }
.profile-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .84rem; }
.profile-text small { color: var(--sidebar-muted); font-size: .8125rem; }
.shell-main { min-width: 0; }
.topbar { display: none; }
.content-page { min-width: 0; max-width: 1950px; padding: var(--s5) 28px var(--s5); margin: 0 auto; font-size: .875rem; }
.page-heading {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  flex-wrap: wrap; margin: 0 0 var(--s4); min-width: 0;
}
.page-heading > div { min-width: 0; }
.actions, .record-actions { display: flex; flex-wrap: wrap; gap: var(--s2); align-items: center; }
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 36px; padding: 5px 11px;
  border: 1px solid #aeb6ae; border-radius: var(--round); background: var(--surface); color: var(--ink);
  font-size: .875rem; font-weight: 700; line-height: 1.3; text-align: center; text-decoration: none;
}
.button:hover:not(:disabled) { background: #eaeee6; border-color: #778b80; }
.button:disabled { color: var(--muted); background: var(--surface-alt); }
.button.primary { background: var(--slate); border-color: var(--slate); color: #fff; }
.button.primary:hover:not(:disabled) { background: #3d5252; border-color: #3d5252; }
.button.danger { color: var(--red); border-color: #c7a49b; }
.button.quiet { background: transparent; border-color: transparent; }
.button.icon-button { width: 35px; padding: 5px; }
.panel { border: 1px solid var(--line); background: var(--surface); min-width: 0; }
.panel-heading {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--s2);
  padding: var(--s3); min-height: 43px;
}
.panel-heading a { font-size: .81rem; }
.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); padding: var(--s2) var(--s3);
}
.toolbar .subtle:last-child { margin-inline-start: auto; }
.table-wrap { position: relative; overflow-x: auto; min-width: 0; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: .875rem; }
.data-table th, .data-table td { padding: var(--s2) var(--s3); text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line-light); }
.data-table th {
  font-weight: 700; font-size: .875rem; color: var(--ink); background: var(--surface-alt); white-space: nowrap;
  border-block: 1px solid var(--line);
}
.data-table tr:last-child td { border-bottom: 0; }
[data-dashboard-extra] tr:first-child td { border-top: 1px solid var(--line-light); }
.data-table tbody tr.selected { background: var(--slate-soft); }
.data-table tbody tr:hover { background: #f2f4ee; }
.data-table tbody tr.selected:hover { background: #e1e9e0; }
.row-link, .record-title { color: var(--link); font-weight: 700; text-decoration-thickness: 1px; }
.row-link:hover, .record-title:hover { text-decoration-thickness: 2px; }
.second-line { display: block; margin-top: 2px; }
.empty { color: var(--muted); padding: var(--s4) var(--s3); }
.empty.compact { padding: var(--s3); }
.subtle { color: var(--muted); }
.bad-date, .record-overdue { color: var(--red); font-weight: 700; }
.badge { display: inline-block; color: var(--ink); font-size: .8125rem; white-space: nowrap; }
.badge.active, .badge.done, .badge.waiting { font-weight: 700; }
.badge.done::before { content: "✓"; margin-inline-end: 3px; }
.badge.overdue { color: var(--red); font-weight: 700; }
.stack { min-width: 0; display: grid; gap: var(--s4); align-content: start; }
.aside-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(248px, 320px); gap: var(--s4); align-items: start; min-width: 0; }
.meta-grid {
  margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(126px, 1fr));
  gap: var(--s3); padding: var(--s3);
}
.meta-grid dt, .project-facts dt, .task-facts dt { color: var(--muted); font-size: .8125rem; margin: 0 0 2px; }
.meta-grid dd, .project-facts dd, .task-facts dd { margin: 0; overflow-wrap: anywhere; }
.breadcrumb { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; margin-bottom: var(--s2); color: var(--muted); font-size: .85rem; }
.tabs { display: flex; align-items: center; gap: var(--s3); padding-inline: var(--s3); border-bottom: 1px solid var(--line); }
.tabs > * { padding: var(--s2) 0; border: 0; border-bottom: 2px solid transparent; background: transparent; text-decoration: none; color: var(--muted); }
.tabs .active, .tabs [aria-selected=true] { border-bottom-color: var(--slate); color: var(--ink); font-weight: 700; }
.record-body { padding: var(--s3); }
.record-detail { min-width: 0; }
.record-note { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); }
.task-completion-note { margin-top: var(--s3); }
.task-completion-note h3 { margin-bottom: var(--s1); }
.record-date { white-space: nowrap; }
.record-name, .record-category, .login-id { overflow-wrap: anywhere; }
.record-category { display: block; color: var(--muted); font-size: .8125rem; }
.case-next-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px var(--s3); margin-top: 2px; }
.record-check { display: flex; align-items: center; gap: var(--s2); font-size: .85rem; }
.record-register { border-inline: 0; }
.record-register .panel-heading { padding-block: var(--s2); }
.record-register .panel-heading + .toolbar { padding-top: 0; }
.project-facts {
  margin: 0; padding: var(--s3) 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 1.5fr);
  gap: var(--s3) var(--s4); border-block: 1px solid var(--line);
}
.project-facts dd { font-weight: 700; }
.project-memo { min-width: 0; padding: var(--s3) var(--s4) var(--s4); }
.project-memo .panel-heading { padding: 0; margin-bottom: var(--s2); }
.project-memo h2 { font-size: 1.125rem; }
.project-memo .record-note { color: var(--ink); line-height: 1.7; }
.record-name { font-weight: 700; }
.task-facts { margin: 0 0 var(--s3); display: grid; gap: 0; }
.task-facts > div { display: grid; align-items: baseline; grid-template-columns: 96px minmax(0, 1fr); gap: var(--s2); padding-block: 5px; border-bottom: 1px solid var(--line-light); }
.task-facts > div:last-child { border-bottom: 0; }
.task-facts dt { margin: 0; }
.record-detail .record-body { padding-top: 0; }
.task-attachment, .record-detail .record-actions { margin-top: var(--s3); }
.record-date + .record-date { margin-top: 2px; }
.record-date-kind { color: var(--muted); font-size: .8125rem; display: inline-block; margin-inline-end: var(--s2); }
.settings-registers { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.metric-grid {
  margin: 0 0 var(--s4); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0;
  background: var(--surface); border-block: 1px solid var(--line);
}
.metric { display: grid; gap: var(--s1); padding: var(--s3); border-inline-end: 1px solid var(--line); }
.metric:last-child { border-inline-end: 0; }
.metric dt { color: var(--muted); font-size: .83rem; }
.metric dd { margin: 0; font-size: 1.55rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.metric dd small { color: var(--muted); font: .8rem var(--text-font); }
.metric.attention dd { color: var(--red); }

input:not([type=checkbox]):not([type=radio]), select, textarea {
  border: 1px solid #aab4aa; border-radius: var(--round); background-color: var(--surface); color: var(--ink);
  min-width: 0; max-width: 100%; min-height: 36px; padding: 5px var(--s2); font-size: .875rem;
}
input::placeholder, textarea::placeholder { color: var(--muted); }
textarea { resize: vertical; min-height: 64px; }
input[type=checkbox] { width: 16px; height: 16px; margin: 0; accent-color: var(--slate); }
select {
  appearance: none; padding-right: 25px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='none' viewBox='0 0 14 14'%3E%3Cpath d='m3.5 5.5 3.5 3.5 3.5-3.5' stroke='%23454b54' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 6px center;
}
.field { display: grid; gap: var(--s1); min-width: 0; color: var(--ink); font-size: .875rem; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; font-weight: 400; }
.field :disabled { color: var(--muted); background-color: var(--surface-alt) !important; cursor: default; }
.field .subtle { font-size: .78rem; font-weight: 400; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s3); }
.form-grid-stacked { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 521px) {
  .form-grid-stacked .field > :is(select, input[type=date]) { justify-self: start; width: 50%; }
}
.field-span { grid-column: 1 / -1; }
.checkbox { display: flex; align-items: center; gap: var(--s2); font-size: .87rem; }
.form-error { padding: var(--s2); color: var(--red); background: var(--red-paper); border-radius: var(--round); font-size: .83rem; }
dialog {
  border: 1px solid #9aa79b; padding: 0; width: min(620px, calc(100vw - 24px)); max-width: none;
  max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); border-radius: var(--round); color: var(--ink); background: var(--surface);
}
dialog::backdrop { background: #182a28a6; }
.dialog-form { display: flex; flex-direction: column; max-height: calc(100vh - 26px); max-height: calc(100dvh - 26px); }
.dialog-heading, .dialog-actions { display: flex; align-items: center; gap: var(--s2); padding: var(--s3); }
.dialog-heading { justify-content: space-between; border-bottom: 1px solid var(--line); }
.dialog-heading h2 { font-size: 1.19rem; }
.dialog-content { overflow-y: auto; padding: var(--s4); min-height: 0; }
.dialog-content > .field + .field { margin-top: var(--s3); }
.dialog-content > .record-note { margin-bottom: var(--s3); }
.dialog-actions { justify-content: flex-end; border-top: 1px solid var(--line); }
.dialog-form > .form-error { margin: 0 var(--s3) var(--s3); }

.calendar-panel { --project-width: 185px; --day-width: 129px; }
.calendar-controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); min-width: 0; padding: var(--s3);
}
.date-navigation { display: inline-flex; align-items: center; gap: var(--s1); }
.date-navigation .icon-button { flex: none; width: 36px; }
.calendar-filter-toggle.button { display: none; }
.calendar-filters { display: contents; }
.filter-label { display: inline-flex; align-items: center; gap: 5px; min-width: 0; color: var(--muted); font-size: .83rem; white-space: nowrap; }
.filter-label select { min-width: 4.5rem; }
.calendar-controls [data-project-owner], .calendar-controls [data-task-owner] { max-width: min(9rem, 28vw); text-overflow: ellipsis; }
.calendar-status-filter {
  position: relative; display: inline-flex; align-items: center; gap: 5px;
  color: var(--muted); font-size: .83rem; white-space: nowrap;
}
.calendar-status-trigger { justify-content: space-between; min-width: 5.5rem; font-weight: 400; padding-inline: var(--s2); }
.calendar-status-filter[data-status-filter=status] .calendar-status-trigger { min-width: 9rem; }
.calendar-status-trigger svg { transform: rotate(90deg); }
.calendar-status-trigger[aria-expanded=true] svg { transform: rotate(-90deg); }
.calendar-status-options {
  position: absolute; z-index: 2; inset-block-start: calc(100% + var(--s1)); inset-inline-end: 0;
  min-width: 100%; max-height: min(23rem, 55vh); overflow-y: auto; padding: var(--s1);
  border: 1px solid #aab4aa; border-radius: var(--round); background: var(--surface); box-shadow: 0 3px 8px #20242a26;
}
.calendar-status-options label {
  display: flex; align-items: center; gap: var(--s2); min-height: 36px; padding: 0 var(--s2);
  border-radius: var(--round); color: var(--ink); font-size: .875rem; cursor: pointer;
}
.calendar-status-options label:hover, .calendar-status-options label:focus-within { background: var(--surface-alt); }
.calendar-status-options .calendar-status-all {
  border-bottom: 1px solid var(--line-light); border-radius: var(--round) var(--round) 0 0; margin-bottom: var(--s1);
}
.calendar-status-options input { flex: none; cursor: pointer; }
.calendar-scroll { overflow-x: auto; border-block: 1px solid #aeb9ad; min-width: 0; scrollbar-color: #8c9e92 var(--surface-alt); }
.calendar-grid {
  border-spacing: 0; table-layout: fixed; width: max(100%, calc(var(--project-width) + var(--day-width) * 7));
  font-size: .875rem;
}
.calendar-grid .project-col { width: var(--project-width); }
.calendar-grid .date-col { width: var(--day-width); }
.calendar-grid th, .calendar-grid td { border-right: 1px solid var(--line-light); border-bottom: 1px solid var(--line); }
.calendar-grid tr > :last-child { border-right: 0; }
.calendar-grid tbody tr:last-child > * { border-bottom: 0; }
.calendar-grid thead th {
  background: var(--calendar-heading); color: var(--ink); height: 42px; white-space: nowrap; text-align: center; border-bottom: 1px solid #aeb9ad;
}
.calendar-grid thead time { font-size: .9375rem; font-weight: 700; }
.calendar-grid .project-fixed {
  position: sticky; z-index: 1; inset-inline-start: 0; background: var(--surface);
  padding: 9px var(--s3); text-align: left; vertical-align: top; border-right-color: #aeb9ad;
}
.calendar-grid thead .project-fixed { background: var(--calendar-heading); vertical-align: middle; }
.calendar-grid .project-name { color: var(--ink); display: block; font-size: .9375rem; font-weight: 700; text-decoration: underline; overflow-wrap: anywhere; }
.calendar-grid .project-name:hover { text-decoration-thickness: 2px; }
.project-client, .project-owner { display: block; font-size: .8125rem; font-weight: 500; margin-top: 3px; overflow-wrap: anywhere; }
.project-client > span:first-child, .project-owner > span:first-child { color: var(--muted); }
.project-value { display: inline-block; max-width: 100%; vertical-align: top; }
.date-head .weekday { font-size: .8125rem; font-weight: 500; }
.today-label {
  display: inline-block; vertical-align: middle; margin-inline-start: 3px; padding: 1px 4px;
  border-radius: var(--round); background: var(--red); color: #fff; font-size: .75rem; line-height: 1.4;
}
.calendar-grid .calendar-cell { position: relative; height: 76px; padding: 4px 6px; background: var(--surface); vertical-align: top; }
.calendar-cell:has(> .event) { padding-bottom: 24px; }
.calendar-cell-add {
  position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: transparent;
  -webkit-tap-highlight-color: transparent;
}
.calendar-cell-add:active { background: #26383a13; }
.calendar-cell-add:focus-visible { outline-offset: -2px; }
@media (hover: hover) {
  .calendar-cell-add:hover { background: #26383a0d; }
}
.calendar-grid .today-col { background: var(--today); }
.calendar-grid thead .today-col { background: #f2e0d4; }
.event {
  position: relative; display: block; color: var(--ink); padding: 6px 7px; text-decoration: none;
  background: #eaf0f4; border: 1px solid #c9d6de; border-radius: var(--round);
}
.event + .event { margin-top: 6px; }
.event.done-event { background: #f1f3ee; border-color: #d5ddd2; }
.event:hover { background: #dfeaf0; border-color: #a6b9c5; }
.event:focus-visible { outline-offset: -2px; }
.event:hover .event-title { text-decoration: underline; }
.event-title { display: block; font-size: .875rem; line-height: 1.45; margin-bottom: 3px; line-break: strict; overflow-wrap: anywhere; }
.event-owner { display: block; color: var(--muted); font-size: .8125rem; overflow-wrap: anywhere; }
.calendar-footer {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s1) var(--s4);
  color: var(--muted); font-size: .8125rem; padding: var(--s2) var(--s3); min-height: 37px;
}
.calendar-empty { padding: var(--s5) var(--s4); }
.calendar-empty p { color: var(--muted); margin-top: var(--s2); }

.auth-shell { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: var(--s4); }
.auth-panel {
  width: min(100%, 440px); min-width: 0; display: grid; gap: 26px;
  padding: clamp(22px, 5vw, 36px); background: #fff; border: 1px solid var(--line); border-radius: 6px;
}
.auth-panel h1 { font-size: 1.75rem; }
.auth-panel form { display: grid; gap: 16px; }
.auth-panel .field { gap: 6px; }
.auth-panel .field input { min-height: 46px; padding-inline: var(--s3); background: #fff; font-size: 1rem; }
.auth-panel form .button { width: 100%; min-height: 46px; margin-top: var(--s1); }
.initial { min-height: 100vh; display: grid; place-content: center; padding: var(--s4); }
.initial p { margin-bottom: var(--s3); }
.initial .button { justify-self: start; }
#feedback {
  display: none; position: fixed; z-index: 4; right: 14px; bottom: 14px; max-width: min(470px, calc(100vw - 28px));
  border: 1px solid #a8bbaa; border-radius: var(--round); background: var(--slate-soft);
  color: var(--ink); padding: var(--s2) var(--s3); font-size: .86rem;
}
#feedback.visible { display: block; }

@media (max-width: 1150px) {
  .shell { grid-template-columns: 184px minmax(0, 1fr); }
  .sidebar { padding-inline: var(--s3); }
  .nav-link { padding-inline: 5px; gap: 6px; }
  .content-page { padding-inline: var(--s4); }
  .calendar-panel { --project-width: 157px; --day-width: 122px; }
  .event { padding-inline: var(--s1); }
  .aside-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 820px) {
  .shell { display: block; }
  .sidebar {
    display: none; width: min(228px, calc(100vw - 56px)); position: fixed; inset: 0 auto 0 0;
    z-index: 3; box-shadow: 0 0 0 100vmax #23332e74;
  }
  .nav-open .sidebar { display: flex; }
  .nav-open #nav-toggle { position: relative; z-index: 4; margin-left: min(228px, calc(100vw - 56px)); }
  .nav-open .mobile-wordmark { display: none; }
  .topbar { border-bottom: 1px solid var(--line); background: var(--surface); display: flex; align-items: center; gap: var(--s2); padding: 4px var(--s3); min-height: 45px; }
  .mobile-wordmark { color: var(--ink); text-decoration: none; font-size: .9rem; font-weight: 700; }
  .content-page { padding: var(--s4) var(--s3); }
  .settings-registers { grid-template-columns: minmax(0, 1fr); }

  #editor {
    position: fixed; inset: 0; margin: auto;
    overflow: hidden;
  }
  .dialog-heading, .dialog-actions { flex: none; padding: var(--s2) var(--s3); }
  .dialog-heading .icon-button { flex: none; width: 44px; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-content { padding: var(--s3); overscroll-behavior-y: contain; }
  #editor :is(input:not([type=checkbox]):not([type=radio]), select, textarea) { font-size: 1rem; min-height: 44px; }
  #editor .dialog-content textarea { min-height: 64px; }
  #editor .dialog-heading .button, #editor .dialog-actions .button { min-height: 44px; }

  .calendar-page-heading { margin-bottom: var(--s3); gap: var(--s2); }
  .calendar-panel { --project-width: clamp(90px, 24vw, 116px); --day-width: clamp(68px, 14vw, 100px); }
  .calendar-controls {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "navigation filter"; gap: 6px; padding: var(--s2);
  }
  .calendar-controls :is(button, select), .calendar-status-options label { min-height: 44px; }
  .date-navigation { grid-area: navigation; justify-self: start; }
  .date-navigation .icon-button { width: 44px; }
  .date-navigation [data-now] { flex: none; padding-inline: var(--s2); white-space: nowrap; }
  .calendar-filter-toggle.button {
    grid-area: filter; display: inline-flex; position: relative; min-width: 44px;
    padding-inline: var(--s2); white-space: nowrap;
  }
  .calendar-filter-toggle[aria-expanded=true] { background: var(--slate-soft); }
  .calendar-filter-count {
    position: absolute; inset-block-start: -3px; inset-inline-end: -3px; pointer-events: none;
    min-width: 17px; padding-inline: 3px; border-radius: 9px;
    background: var(--slate); color: #fff; font-size: .6875rem; line-height: 17px;
  }
  .calendar-filter-toggle[aria-expanded=false] + .calendar-filters { display: none; }
  .calendar-filters {
    grid-column: 1 / -1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--s2); border-top: 1px solid var(--line-light); padding-top: var(--s2); margin-top: 2px;
  }
  .calendar-controls :is(.filter-label, .calendar-status-filter) {
    display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s1); white-space: normal;
  }
  .calendar-controls :is([data-project-owner], [data-task-owner], .calendar-status-trigger) {
    width: 100%; min-width: 0; max-width: none;
  }
  .calendar-status-filter[data-status-filter=status] .calendar-status-trigger { min-width: 0; }
  .calendar-status-trigger [data-filter-value] { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .calendar-status-options { inset-inline: 0; min-width: 0; }
  .calendar-grid thead th { height: 42px; }
  .calendar-grid .date-head { padding-inline: 0; }
  .calendar-grid thead time { display: block; font-size: .8125rem; line-height: 1.25; }
  .date-head .date-context { display: flex; align-items: center; justify-content: center; }
  .date-head .weekday { font-size: .75rem; }
  .date-head .today-label { margin-inline-start: 0; font-size: .625rem; line-height: 1.2; }
  .calendar-grid .calendar-cell { padding-inline: 3px; }
  .event { padding: 4px 3px; }
  .event-title { font-size: .8125rem; line-height: 1.4; }
  .event-owner { font-size: .75rem; }
}
@media (max-width: 520px) {
  .content-page { padding: var(--s3) var(--s2) var(--s4); }
  .calendar-grid .project-fixed { padding-inline: var(--s1); }
  .calendar-grid .project-name { font-size: .87rem; }
  .project-client, .project-owner { font-size: .75rem; }
  .project-client > span:first-child, .project-owner > span:first-child { display: block; font-size: .6875rem; }
  .form-grid { grid-template-columns: 1fr; }
  .data-table { min-width: 480px; }
  .project-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .project-memo { padding-inline: var(--s3); }
}
@media (pointer: coarse) {
  .nav-link, .calendar-controls button, .calendar-controls select, .calendar-status-options label { min-height: 44px; }
  .date-navigation .icon-button { width: 44px; }
  .calendar-cell:has(> .event) { padding-bottom: 44px; }
}

.chat-nav-count, .chat-tab-unread, .chat-case-unread, .chat-notification-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.35em;
  padding: 0 5px;
  border-radius: 3px;
  background: var(--red-paper);
  color: var(--red);
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.6;
}
.nav-link[data-nav=notifications] { align-items: flex-start; }
.nav-link[data-nav=notifications] > svg { margin-top: 3px; }
.sidebar-notification-content, .sidebar-notification-counts { display: grid; min-width: 0; }
.sidebar-notification-content { flex: 1; gap: var(--s1); }
.sidebar-notification-counts { gap: 2px; color: var(--sidebar-muted); font-size: .75rem; font-weight: 400; }
.sidebar-notification-counts > span { display: flex; justify-content: space-between; align-items: center; gap: var(--s1); }
.sidebar-notification-counts .chat-nav-count { flex: none; font-variant-numeric: tabular-nums; }
.sidebar-notification-counts [data-sidebar-message-count] { background: var(--calendar-heading); color: var(--ink); }
.sidebar-notification-counts .chat-nav-count.is-zero { background: #344746; color: var(--sidebar-muted); }
.chat-case-unread { display: table; margin-top: 3px; text-decoration: underline; text-underline-offset: 2px; }
.mobile-notifications { margin-left: auto; position: relative; }
.mobile-notifications .chat-nav-count { position: absolute; top: -2px; right: -4px; font-size: .7rem; }

.project-tabs { display: flex; flex-wrap: wrap; gap: var(--s4); border-bottom: 1px solid var(--line); }
.project-tabs a {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  min-height: 42px;
  padding: 6px 2px;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
}
.project-tabs a:hover { color: var(--ink); }
.project-tabs a[aria-current=page] { border-bottom-color: var(--slate); color: var(--ink); font-weight: 700; }

.project-chat .panel-heading { align-items: flex-start; padding: var(--s3); }
.project-chat .panel-heading h2 { margin-top: 4px; }
.chat-members { position: relative; max-width: 100%; }
.chat-members summary {
  padding: 4px var(--s2);
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--round);
  background: var(--surface);
  cursor: pointer;
  white-space: nowrap;
}
.chat-members[open] .chat-members-content {
  position: absolute;
  z-index: 4;
  right: 0;
  top: calc(100% + var(--s1));
  width: min(305px, calc(100vw - 42px));
  max-height: min(390px, 50dvh);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 4px 14px #1427261c;
}
.chat-member-list, .chat-messages, .chat-mention-options ul, .chat-edit-mention-options ul, .chat-notification-list { padding: 0; margin: 0; list-style: none; }
.chat-member-list > li + li { border-top: 1px solid var(--line-light); }
.chat-member-list > li > span, .chat-member-option { padding: var(--s2) var(--s3); }
.chat-member-list > li > span { display: block; }
.chat-member-option { display: flex; align-items: center; gap: var(--s2); min-height: 36px; cursor: pointer; }
.chat-member-option input { flex: none; }
.chat-member-option:has(input:disabled) { cursor: default; }
.chat-member-option:has(input:not(:disabled)):hover { background: var(--surface-alt); }
.chat-member-list span { overflow-wrap: anywhere; }

.chat-conversation { position: relative; min-width: 0; }
.chat-scroll {
  max-height: 570px;
  height: clamp(235px, 50dvh, 570px);
  overflow: auto;
  overflow-anchor: none;
  scrollbar-gutter: stable;
}
.chat-older { padding: var(--s2) var(--s3); text-align: center; }
.chat-messages { padding-inline: var(--s3); }
.chat-message { padding: var(--s3) var(--s2); min-width: 0; border-bottom: 1px solid var(--line-light); }
.chat-message:last-child { border-bottom: 0; }
.chat-message.is-target { background: var(--today); outline-offset: -2px; }
.chat-message-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 3px var(--s2); margin-bottom: var(--s1); min-width: 0; }
.chat-message-meta strong { min-width: 0; overflow-wrap: anywhere; }
.chat-message-meta time { color: var(--muted); font-size: .8125rem; font-variant-numeric: tabular-nums; }
.chat-message-actions { display: inline-flex; gap: var(--s1); margin-inline-start: auto; }
.chat-message-actions button { min-height: 30px; padding: 2px 6px; color: var(--muted); font-size: .8125rem; }
.chat-message-edited { font-size: .75rem; }
.chat-message-text { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.7; }
.chat-jump { position: absolute; z-index: 1; right: var(--s3); bottom: calc(var(--chat-composer-height, 92px) + var(--s2)); }
.chat-jump button { box-shadow: 0 2px 8px #1427261a; }

.chat-composer {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--s2);
  padding: var(--s3);
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.chat-composer textarea { width: 100%; resize: vertical; min-height: 54px; }
.chat-composer-bottom { display: flex; align-items: flex-end; gap: var(--s1); grid-column: 2; grid-row: 1; }
.chat-composer-bottom button { white-space: nowrap; }
.chat-send-error { grid-column: 1 / -1; }
.chat-mention-options {
  position: absolute;
  inset-inline: var(--s3);
  bottom: calc(100% - 1px);
  z-index: 3;
  max-height: min(260px, 45dvh);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 -2px 12px #1427261c;
}
.chat-edit-mention-options { max-height: min(220px, 32dvh); overflow: auto; margin-top: var(--s2); border: 1px solid var(--line); }
.chat-edit-legacy { margin-top: var(--s3); }
.chat-edit-legacy .chat-member-list > li { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); }
.chat-mention-label { padding: 5px var(--s2); color: var(--muted); font-size: .8125rem; }
.chat-mention-options button, .chat-edit-mention-options button {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: 5px var(--s2);
  background: transparent;
  border: 0;
  border-top: 1px solid var(--line-light);
  color: var(--ink);
  text-align: left;
}
.chat-mention-options button:hover, .chat-mention-options button:focus-visible,
.chat-edit-mention-options button:hover, .chat-edit-mention-options button:focus-visible { background: var(--slate-soft); }
.chat-load-error, .chat-send-error { color: var(--red); font-size: .8125rem; }
.chat-load-error { padding: var(--s2) var(--s3); }

.chat-notification-list .chat-notification {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s3);
}
.chat-notification + .chat-notification { border-top: 1px solid var(--line-light); }
.chat-notification > a { display: grid; flex: 1; gap: 1px; min-width: 0; text-decoration: none; color: var(--ink); overflow-wrap: anywhere; }
.chat-notification > a:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.chat-notification > a > span, .chat-notification time, .chat-notification-status { color: var(--muted); font-size: .8125rem; }
.chat-notification.is-unread { background: var(--today); }
.chat-notification > button { flex: none; white-space: nowrap; }
.chat-notification > a > .chat-notification-preview {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  white-space: pre-line;
  color: var(--ink);
}
.chat-notification-pages {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--s2);
  border-top: 1px solid var(--line-light);
  padding: var(--s2) var(--s3);
}
.chat-notification-tabs { flex-wrap: wrap; row-gap: 0; }
.chat-notification-tabs button { display: inline-flex; align-items: center; gap: var(--s1); white-space: nowrap; }
.chat-unread-actions {
  display: flex;
  justify-content: flex-end;
  border-bottom: 1px solid var(--line-light);
  padding: var(--s2) var(--s3);
}
.push-settings p { margin-top: var(--s2); }
.push-settings .button { margin-top: var(--s3); }

@media (max-width: 520px) {
  .project-chat .panel-heading, .chat-composer { padding: var(--s2); }
  .project-chat .panel-heading { position: relative; align-items: center; }
  .project-chat .panel-heading h2 { margin-top: 0; }
  .chat-members { position: static; }
  .chat-members summary { min-height: 44px; padding-block: 10px; }
  .chat-members[open] .chat-members-content {
    inset-inline: var(--s2); width: min(305px, calc(100% - 16px)); margin-inline: auto;
  }
  .chat-scroll { height: clamp(195px, 46dvh, 420px); }
  .chat-messages { padding-inline: var(--s1); }
  .chat-message { padding-inline: var(--s2); }
  .chat-composer textarea { font-size: 1rem; }
  .chat-composer-bottom button { min-height: 42px; padding-inline: 6px; }
}
@media (pointer: coarse) {
  .project-tabs a, .chat-member-option, .chat-mention-options button, .chat-edit-mention-options button,
  .chat-message-actions button, .chat-notification > button, .chat-notification-tabs button,
  .chat-notification-pages button, .chat-unread-actions button { min-height: 44px; }
}

