@font-face {
  font-family: Manrope;
  src: url("fonts/Manrope-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
}

@font-face {
  font-family: Manrope;
  src: url("fonts/Manrope-SemiBold.woff2") format("woff2");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: Manrope;
  src: url("fonts/Manrope-Bold.woff2") format("woff2");
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
}

:root {
  --bg: #f7f7f7;
  --surface: #ffffff;
  --surface-soft: #f1f1f1;
  --surface-strong: #e8e8e8;
  --text: #212121;
  --muted: #626262;
  --line: #dedede;
  --accent: #e1251b;
  --accent-strong: #b21d15;
  --accent-soft: #fbcfc8;
  --danger: #b42318;
  --danger-soft: #fee4e2;
  --warning: #a15c07;
  --warning-soft: #fff1d6;
  --success: #137a3f;
  --success-soft: #def7e8;
  --focus: #b21d15;
  --shadow: 0 18px 44px rgba(33, 33, 33, 0.12);
  --radius: 8px;
  --sidebar-width: 228px;
  --topbar-height: 76px;
  --tag-yellow: #d9a700;
  --tag-purple: #7a3db8;
  --tag-blue: #1769d1;
  --tag-orange: #d76712;
  --tag-red: #cf2e2e;
  --tag-green: #138a45;
  --tag-black: #2f3640;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  color: var(--text);
  font-family:
    Manrope, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  font-size: 16px;
  line-height: 1.45;
  background: var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.64;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.app-shell {
  display: block;
  min-height: 100vh;
}

.access-gate {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background: #212121;
}

.access-card {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 24px;
  background: var(--surface);
  border: 1px solid rgba(215, 224, 234, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.access-card h1 {
  margin: 0;
  font-size: 1.55rem;
  line-height: 1.1;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  width: var(--sidebar-width);
  min-height: 100vh;
  overflow-y: auto;
  padding: 22px 18px;
  color: #f8fafc;
  background: #212121;
}

.brand-block {
  display: flex;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.brand-block h1,
.topbar-title h2,
.modal-header h2,
.section-title h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand-block h1 {
  font-size: 1.25rem;
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 4px;
  color: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
  opacity: 0.72;
}

.nav-list,
.mobile-nav-drawer {
  display: grid;
  gap: 6px;
}

.nav-list {
  margin-top: 24px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: var(--radius);
}

.nav-item svg {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
}

.nav-item:hover,
.nav-item.is-active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.12);
}

.nav-item.is-active {
  box-shadow: none;
}

.sidebar-footer {
  display: grid;
  gap: 12px;
  margin-top: auto;
  padding-top: 20px;
}

.sync-label {
  margin: 0;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.86rem;
}

.main-shell {
  min-width: 0;
  margin-left: var(--sidebar-width);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 12;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--topbar-height);
  gap: 16px;
  padding: 14px clamp(16px, 3vw, 34px);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.topbar-title h2 {
  font-size: 1.65rem;
}

.topbar-actions,
.modal-actions,
.date-controls,
.filter-controls,
.card-actions,
.item-meta,
.badge-row,
.quick-metrics,
.period-heading {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-actions {
  justify-content: flex-end;
}

.primary-button,
.secondary-button,
.danger-button,
.text-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  gap: 8px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 600;
  text-decoration: none;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease,
    transform 160ms ease;
}

.primary-button {
  padding: 0 16px;
  color: #ffffff;
  background: var(--accent);
  border-color: var(--accent);
}

.primary-button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.secondary-button {
  padding: 0 14px;
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
}

.secondary-button:hover {
  border-color: #b7c4d4;
  background: #f9fbfd;
}

.danger-button {
  padding: 0 16px;
  color: #ffffff;
  background: var(--danger);
  border-color: var(--danger);
}

.danger-button:hover {
  background: #8f1d14;
  border-color: #8f1d14;
}

.text-button {
  min-height: 36px;
  padding: 0;
  color: var(--accent-strong);
  background: transparent;
  border: 0;
}

.sidebar .text-button {
  justify-content: flex-start;
  color: #fbcfc8;
}

.icon-button {
  width: 40px;
  height: 40px;
  color: var(--text);
  background: var(--surface);
  border-color: var(--line);
}

.icon-button:hover,
.scope-option:hover,
.item-card:hover {
  transform: none;
}

.primary-button svg,
.secondary-button svg,
.danger-button svg,
.text-button svg,
.icon-button svg,
.admin-banner svg {
  width: 18px;
  height: 18px;
}

.mobile-only,
.mobile-nav-drawer {
  display: none;
}

.control-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(16px, 3vw, 34px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.date-input,
.field input,
.field select,
.field textarea,
.filter-controls input,
.filter-controls select {
  width: 100%;
  min-height: 40px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid #bfccda;
  border-radius: var(--radius);
}

.date-input,
.field input,
.field select,
.filter-controls input,
.filter-controls select {
  padding: 0 11px;
}

.field textarea {
  min-height: 96px;
  padding: 10px 11px;
  resize: vertical;
}

.filter-controls {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.filter-controls label {
  display: grid;
  gap: 4px;
  min-width: 152px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.filter-controls .search-filter {
  min-width: min(260px, 100%);
  flex: 1 1 260px;
}

.admin-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px clamp(16px, 3vw, 34px) 0;
  padding: 10px 12px;
  color: #084c3d;
  background: var(--success-soft);
  border: 1px solid #a5e7bd;
  border-radius: var(--radius);
}

.view-root {
  display: grid;
  gap: 22px;
  padding: 22px clamp(16px, 3vw, 34px) 96px;
}

.section {
  display: grid;
  gap: 14px;
}

.section-panel {
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.section-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.section-title h2 {
  font-size: 1.05rem;
}

.section-title p {
  margin: 3px 0 0;
  color: var(--muted);
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pending-section {
  gap: 0;
}

.collapsible-section {
  gap: 0;
}

.collapsible-section.section-panel {
  padding-top: 0;
  border-top: 0;
}

.pending-summary,
.section-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 26px;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 0;
  font-weight: 850;
}

.pending-summary {
  background: transparent;
}

.section-summary {
  min-height: 28px;
}

.pending-summary span,
.section-summary-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.section-summary-title > span {
  display: grid;
  gap: 1px;
  text-align: left;
}

.section-heading-line {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
}

.section-count {
  color: var(--muted);
  font-size: 0.94em;
  font-weight: 750;
}

.section-summary-title small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.pending-summary svg,
.section-summary svg {
  width: 17px;
  height: 17px;
}

.pending-list {
  margin-top: 8px;
  margin-left: 0;
  width: 100%;
  background: var(--surface);
  border-color: var(--line);
}

.compact-empty {
  padding: 12px;
}

.nested-day-list {
  gap: 14px;
  margin-top: 10px;
  margin-left: 0;
  width: 100%;
}

.collapsible-section > .item-list {
  margin-left: 0;
  width: 100%;
  border-top: 0;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.empty-state {
  padding: 24px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed #bac7d8;
  border-radius: var(--radius);
}

.quick-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  display: grid;
  min-height: 54px;
  align-content: center;
  gap: 1px;
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.metric strong {
  font-size: 1.2rem;
  line-height: 1;
  font-weight: 850;
}

.metric span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.item-list,
.agenda-list,
.month-mobile-list,
.history-list {
  display: grid;
  gap: 10px;
}

.item-list {
  gap: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.item-card {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 8px 10px;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-left-color: var(--tag-black);
  border-radius: 0;
  box-shadow: none;
  transition:
    background 160ms ease,
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.item-card:last-child {
  border-bottom: 0;
}

.item-card:hover {
  background: #f8fafc;
  border-color: var(--line);
  box-shadow: none;
}

.item-card[data-tag-color="yellow"] {
  border-left-color: var(--tag-yellow);
}

.item-card[data-tag-color="purple"] {
  border-left-color: var(--tag-purple);
}

.item-card[data-tag-color="blue"] {
  border-left-color: var(--tag-blue);
}

.item-card[data-tag-color="orange"] {
  border-left-color: var(--tag-orange);
}

.item-card[data-tag-color="red"] {
  border-left-color: var(--tag-red);
}

.item-card[data-tag-color="green"] {
  border-left-color: var(--tag-green);
}

.item-card[data-tag-color="black"] {
  border-left-color: var(--tag-black);
}

.item-card-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.card-toggle {
  display: grid;
  gap: 4px;
  min-width: 0;
  width: 100%;
  padding: 0;
  color: inherit;
  text-align: left;
  background: transparent;
  border: 0;
}

.item-main-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.item-title-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.item-tag-emoji,
.month-chip-emoji {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 1.25em;
  width: 1.25em;
  line-height: 1;
  text-align: center;
}

.item-sequence {
  flex: 0 0 auto;
  width: auto;
  min-width: 0;
  color: #64748b;
  font-size: 0.96rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1.25;
  text-align: left;
}

.item-title-row h3 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  font-size: 0.96rem;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge-row {
  flex-wrap: wrap;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 21px;
  padding: 0 7px;
  color: #253246;
  font-size: 0.7rem;
  font-weight: 800;
  background: #edf2f7;
  border: 1px solid #d7e0ea;
  border-radius: 999px;
}

.badge-danger {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #ffbdb7;
}

.badge-warning {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #ffd58a;
}

.badge-success {
  color: var(--success);
  background: var(--success-soft);
  border-color: #b7e8c8;
}

.priority-high {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: #ffbdb7;
}

.priority-medium {
  color: var(--warning);
  background: var(--warning-soft);
  border-color: #ffd58a;
}

.priority-low {
  color: var(--success);
  background: var(--success-soft);
  border-color: #b7e8c8;
}

.item-meta {
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.item-meta-right {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  gap: 6px;
  min-width: max-content;
  color: var(--muted);
  font-size: 0.88rem;
}

.item-context-mini {
  min-width: 0;
  color: var(--muted);
  font-weight: 400;
  white-space: nowrap;
}

.more-info-mini {
  color: #52647a;
  font-weight: 700;
}

.meta-dot {
  color: #94a3b8;
  font-weight: 500;
}

.responsible-mini {
  color: var(--muted);
  font-weight: 400;
}

.date-mini {
  color: var(--muted);
  font-weight: 400;
}

.time-mini {
  color: var(--focus);
  font-weight: 800;
}

.meta-separator {
  color: #c0c7d2;
  font-weight: 500;
}

.item-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.item-meta svg,
.detail-line svg {
  width: 15px;
  height: 15px;
}

.card-actions {
  justify-content: flex-end;
  gap: 4px;
}

.card-actions .icon-button {
  width: 28px;
  height: 28px;
  min-height: 28px;
}

.detail-content,
.detail-grid {
  display: grid;
  gap: 9px;
}

.detail-hero {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.detail-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: #314157;
  overflow-wrap: anywhere;
}

.detail-line strong {
  color: var(--text);
}

.link-button {
  justify-self: start;
}

.link-inputs {
  display: grid;
  gap: 9px;
}

.link-inputs label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.detail-link-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.weekday-cell,
.month-day {
  min-width: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.weekday-cell:nth-child(7n),
.month-day:nth-child(7n) {
  border-right: 0;
}

.weekday-cell {
  padding: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-align: center;
  background: var(--surface-soft);
}

.month-day {
  min-height: 142px;
  padding: 9px;
  background: #ffffff;
}

.month-day.is-outside {
  background: #f8fafc;
}

.month-day.is-today {
  box-shadow: inset 0 0 0 2px rgba(8, 120, 111, 0.36);
}

.day-number {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 24px;
  color: var(--muted);
  font-weight: 850;
}

.month-chip-list {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.month-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  min-height: 30px;
  padding: 5px 7px;
  overflow: hidden;
  color: var(--text);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: #f4f7fb;
  border: 1px solid #dce5ef;
  border-left: 4px solid var(--tag-black);
  border-radius: 6px;
}

.month-chip-sequence {
  flex: 0 0 auto;
  color: #64748b;
  font-size: 0.78rem;
  font-weight: 600;
}

.month-chip-emoji {
  font-size: 0.86rem;
}

.month-chip span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.month-chip[data-tag-color="yellow"] {
  border-left-color: var(--tag-yellow);
}

.month-chip[data-tag-color="purple"] {
  border-left-color: var(--tag-purple);
}

.month-chip[data-tag-color="blue"] {
  border-left-color: var(--tag-blue);
}

.month-chip[data-tag-color="orange"] {
  border-left-color: var(--tag-orange);
}

.month-chip[data-tag-color="red"] {
  border-left-color: var(--tag-red);
}

.month-chip[data-tag-color="green"] {
  border-left-color: var(--tag-green);
}

.month-chip[data-tag-color="black"] {
  border-left-color: var(--tag-black);
}

.week-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(170px, 1fr));
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.week-column .item-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px;
}

.week-column .item-card-header {
  grid-template-columns: minmax(0, 1fr);
  gap: 6px 7px;
  align-items: start;
}

.week-column .card-toggle {
  grid-area: main;
}

.week-column .card-actions {
  grid-area: actions;
  justify-content: start;
}

.week-column .item-main-line {
  align-items: flex-start;
  flex-direction: column;
  gap: 3px;
}

.week-column .item-title-row {
  align-items: flex-start;
  width: 100%;
}

.week-column .item-title-row h3 {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: normal;
  word-break: normal;
  white-space: normal;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.week-column .badge-row,
.week-column .item-meta:not(.item-meta-right) {
  display: none;
}

.week-column .item-meta-right {
  justify-content: flex-start;
  min-width: 0;
  flex-wrap: wrap;
  gap: 2px 5px;
  font-size: 0.78rem;
}

.week-column .responsible-mini {
  max-width: 52px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.week-column,
.day-panel,
.history-item {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.agenda-day {
  display: grid;
  align-content: start;
  gap: 0;
}

.week-column h3,
.agenda-day h3,
.day-panel h3 {
  margin: 0;
  font-size: 0.92rem;
  letter-spacing: 0;
}

.agenda-day h3,
.period-heading h3 {
  margin: 0;
}

.period-heading {
  justify-content: space-between;
  padding-bottom: 0;
}

.day-item-list {
  margin-top: 3px;
  margin-left: 0;
  width: 100%;
}

.day-empty {
  margin: 4px 0 0;
}

.history-item {
  gap: 8px;
}

.history-restore-button {
  justify-self: start;
}

.history-item pre {
  max-height: 180px;
  margin: 0;
  overflow: auto;
  padding: 10px;
  color: #253246;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 80;
  display: grid;
  width: min(420px, calc(100vw - 32px));
  gap: 10px;
  pointer-events: none;
}

.toast {
  padding: 12px 14px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  pointer-events: auto;
}

.toast.is-error {
  border-left-color: var(--danger);
}

.toast.is-success {
  border-left-color: var(--success);
}

.fab {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  display: none;
  width: 58px;
  height: 58px;
  color: #ffffff;
  background: var(--accent);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 5px 16px rgba(33, 33, 33, 0.18);
}

.fab svg {
  width: 25px;
  height: 25px;
}

.modal {
  width: min(860px, calc(100vw - 28px));
  max-height: calc(100vh - 32px);
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
}

.modal::backdrop {
  background: rgba(33, 33, 33, 0.48);
  backdrop-filter: blur(5px);
}

.modal-panel {
  display: grid;
  gap: 18px;
  max-height: calc(100vh - 32px);
  padding: 22px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.modal-panel-small {
  width: min(480px, calc(100vw - 28px));
}

.modal-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.form-grid,
.recurrence-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.field-wide {
  grid-column: 1 / -1;
}

.fieldset {
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.responsible-field {
  gap: 10px;
}

.responsible-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.responsible-options .choice-row {
  position: relative;
  justify-content: center;
  min-height: 42px;
  padding: 0 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.responsible-options .choice-row input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  opacity: 0;
}

.responsible-options .choice-row span {
  position: relative;
  z-index: 1;
}

.responsible-options .choice-row:has(input:checked) {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: #6ecfbd;
  box-shadow: inset 0 0 0 1px rgba(8, 120, 111, 0.2);
}

.responsible-options .choice-row:has(input:focus-visible) {
  outline: 2px solid var(--text);
  outline-offset: 2px;
}

.responsible-people-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 7px;
  margin: 0;
  padding: 0;
  border: 0;
}

.responsible-people-picker[hidden] {
  display: none;
}

.responsible-person-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 7px 10px;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 650;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.responsible-person-option:has(input:checked) {
  color: var(--accent-strong);
  background: var(--accent-soft);
  border-color: #6ecfbd;
}

.responsible-person-option input {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
  min-height: 17px;
  margin: 0;
  accent-color: var(--accent);
}

.fieldset legend,
.weekday-picker legend {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 850;
}

.choice-row,
.switch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  color: var(--text);
  font-weight: 700;
}

.recurrence-box {
  display: grid;
  gap: 14px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.recurrence-end-fieldset {
  gap: 0;
}

.recurrence-end-options {
  display: grid;
  gap: 0;
}

.recurrence-end-option {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 260px);
  gap: 14px;
  align-items: center;
  min-height: 54px;
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
}

.recurrence-end-option:last-child {
  border-bottom: 0;
}

.recurrence-end-option-simple .choice-row {
  grid-column: 1 / -1;
}

.recurrence-end-option .choice-row {
  min-width: 0;
  min-height: 40px;
}

.recurrence-end-option .choice-row input[type="radio"] {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 0;
  accent-color: var(--accent);
}

.recurrence-end-option > input {
  min-width: 0;
}

.weekday-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.monthly-pattern {
  display: grid;
  gap: 12px;
}

.monthly-position-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.recurrence-adjustment-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

.recurrence-adjustment-option[hidden] {
  display: none;
}

.recurrence-adjustment-option input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  min-height: 18px;
  margin: 2px 0 0;
  accent-color: var(--accent);
}

.recurrence-adjustment-option span {
  display: grid;
  gap: 3px;
}

.recurrence-adjustment-option strong {
  font-size: 0.9rem;
}

.recurrence-adjustment-option small {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.35;
}

.weekday-picker label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  color: var(--text);
  font-weight: 800;
}

.form-error {
  margin: 0;
  padding: 10px 12px;
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #ffbdb7;
  border-radius: var(--radius);
}

.confirm-message {
  margin: 0;
  color: #314157;
}

.scope-options {
  display: grid;
  gap: 10px;
}

.scope-option {
  display: grid;
  gap: 4px;
  width: 100%;
  min-height: 72px;
  padding: 13px;
  color: var(--text);
  text-align: left;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.scope-option span {
  color: var(--muted);
}

.loading-bar {
  height: 3px;
  overflow: hidden;
  background: var(--surface-strong);
  border-radius: 999px;
}

.loading-bar::before {
  display: block;
  width: 45%;
  height: 100%;
  content: "";
  background: var(--accent);
  border-radius: 999px;
  animation: loading-slide 980ms infinite ease-in-out;
}

@keyframes loading-slide {
  0% {
    transform: translateX(-110%);
  }
  100% {
    transform: translateX(240%);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1060px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .main-shell {
    margin-left: 0;
  }

  .topbar {
    display: none;
  }

  .mobile-nav-drawer {
    position: sticky;
    top: 0;
    z-index: 24;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 4px;
    padding: 8px 14px 7px;
    color: var(--text);
    background: #212121;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .mobile-nav-brand {
    grid-column: 1 / -1;
    justify-self: stretch;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    margin-bottom: 8px;
    padding: 7px 12px;
    color: #ffffff;
    font-size: 1.04rem;
    font-weight: 900;
    letter-spacing: 0;
    text-align: center;
    background: rgba(255, 255, 255, 0.12);
    border: 0;
    border-radius: var(--radius);
    box-shadow: none;
  }

  .mobile-nav-drawer .nav-item {
    justify-content: center;
    min-height: 28px;
    gap: 5px;
    padding: 3px 5px;
    color: #f8fafc;
    font-size: 0.74rem;
    font-weight: 800;
    text-align: center;
  }

  .mobile-nav-drawer .nav-item svg {
    width: 14px;
    height: 14px;
  }

  .mobile-nav-drawer .nav-item span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-nav-drawer .nav-item.is-active {
    box-shadow: none;
  }

  .control-strip {
    align-items: stretch;
    flex-direction: column;
  }

  .filter-controls {
    justify-content: stretch;
  }

  .filter-controls label {
    flex: 1 1 170px;
  }

  .quick-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }

  .week-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  :root {
    --topbar-height: 0px;
  }

  body {
    font-size: 15px;
  }

  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .date-controls {
    flex-wrap: wrap;
  }

  .date-input {
    flex: 1 1 180px;
  }

  .view-root {
    padding: 18px 14px 98px;
  }

  .quick-metrics {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .metric {
    min-height: 50px;
    padding: 7px 9px;
  }

  .metric strong {
    font-size: 1.12rem;
  }

  .section-title {
    align-items: start;
    flex-direction: column;
    gap: 4px;
  }

  .item-card-header {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .item-main-line {
    display: grid;
    grid-template-columns: 1.25em auto minmax(0, 1fr);
    gap: 3px 5px;
    align-items: center;
  }

  .item-meta-right {
    grid-column: 3;
    grid-row: 2;
    justify-content: flex-start;
    max-width: none;
    min-width: 0;
    flex-wrap: nowrap;
    gap: 4px;
    overflow: hidden;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .responsible-mini {
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .item-context-mini {
    flex: 0 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .item-title-row {
    display: contents;
  }

  .card-actions {
    display: none;
  }

  .card-actions .icon-button {
    width: 32px;
    height: 32px;
    min-height: 32px;
  }

  .month-grid {
    display: none;
  }

  .month-mobile-list {
    display: grid;
  }

  .form-grid,
  .recurrence-fields {
    grid-template-columns: 1fr;
  }

  .monthly-position-fields {
    grid-template-columns: 1fr;
  }

  .recurrence-end-option {
    grid-template-columns: 1fr;
    gap: 4px;
    align-items: stretch;
    padding: 8px 0;
  }

  .recurrence-end-option > input {
    width: calc(100% - 26px);
    margin-left: 26px;
  }

  .modal-panel {
    padding: 18px;
  }

  .modal-actions {
    align-items: stretch;
    flex-direction: column-reverse;
  }

  .modal-actions button {
    width: 100%;
  }

  .fab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

@media (min-width: 721px) {
  .month-mobile-list {
    display: none;
  }
}

/* Shared density and contrast, without changing calendar layouts. */
.control-strip {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px 24px;
  padding-block: 16px;
}
.filter-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-column: 1 / -1;
  gap: 12px;
}
.filter-controls .search-filter {
  grid-column: 1 / -1;
}
.filter-controls label {
  min-width: 0;
  font-size: 0.875rem;
  font-weight: 600;
}
.search-filter { min-width: 0; }
.search-filter input { font-weight: 400; }
.filter-toggle { justify-self: end; }
.filter-toggle[aria-expanded="true"] {
  background: var(--accent-soft);
  border-color: var(--accent-soft);
}
.filter-controls:not(.is-expanded) > label:not(.search-filter) { display: none; }
.filter-count, #filterCount {
  min-width: 20px;
  padding-inline: 4px;
  color: var(--text);
  background: var(--accent-soft);
  border-radius: 4px;
  font-size: 0.8rem;
}
.date-controls { min-width: 0; gap: 6px; }
.date-input { width: 160px; flex: 0 1 160px; min-width: 0; }
.date-controls .icon-button { flex: 0 0 40px; }
.date-controls .text-button { padding-inline: 6px; }
.filter-controls input, .filter-controls select,
.field input, .field select, .field textarea, .date-input {
  border-color: #b8b8b8;
  font-size: 16px;
  font-weight: 400;
}
.field { font-size: 0.875rem; font-weight: 600; }
.field input:not([type="checkbox"]):not([type="radio"]),
.field select { min-height: 44px; }
.field input:focus, .field select:focus, .field textarea:focus,
.filter-controls input:focus, .filter-controls select:focus {
  border-color: var(--text);
}
.nav-item { font-size: 0.875rem; font-weight: 600; }
.nav-item.is-active { color: var(--text); background: var(--accent-soft); }
.mobile-brand-heading { grid-column: 1 / -1; margin: 0; font-size: inherit; }
.mobile-brand-heading .mobile-nav-brand { width: 100%; }
.sidebar .eyebrow { font-size: 0.75rem; opacity: 1; color: #cccccc; }
.collapse-heading { margin: 0; font: inherit; }
.brand-block h1 { font-size: 1.5rem; }
.quick-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.metric {
  padding: 8px 12px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  gap: 2px;
}
.metric:first-child { border-color: #d8aaa5; }
.metric:first-child strong { color: #a51d16; }
.metric strong { font-size: 1.3rem; font-weight: 700; }
.metric span { font-size: 0.8125rem; font-weight: 600; }
.section-summary, .pending-summary { min-height: 36px; font-weight: 700; }
.nested-day-list { margin-top: 16px; gap: 20px; }
.section-count { font-weight: 400; }
.item-card { padding: 8px 10px; }
.item-card:hover { background: #fafafa; }
.item-title-row h3, .item-sequence { font-size: 0.9375rem; line-height: 1.35; }
.item-sequence { color: var(--muted); }
.item-meta-right { font-size: 0.875rem; }
.item-context-mini, .responsible-mini, .date-mini { color: var(--muted); }
.more-info-mini { color: #454545; font-weight: 600; }
.meta-separator, .meta-dot { color: #777777; }
.time-mini { color: #a51d16; font-weight: 700; flex-shrink: 0; }
.month-day.is-today { box-shadow: inset 0 0 0 2px var(--accent); }
.month-day.is-today .day-number { color: var(--accent-strong); }
.month-day.is-outside { background: #f7f7f7; }
.month-chip { background: #fafafa; border-color: var(--line); border-left-width: 1px; font-size: 0.875rem; }
.month-chip-sequence { font-size: inherit; font-weight: 400; color: var(--muted); }
.month-chip-content { display: grid; min-width: 0; gap: 2px; }
.month-chip-content > span { overflow: hidden; text-overflow: ellipsis; }
.month-chip-content small { color: var(--muted); font-size: 0.75rem; }
.card-actions .icon-button {
  width: 32px;
  height: 32px;
  min-height: 32px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
}
.card-actions .icon-button:hover { background: var(--surface-soft); color: var(--text); }
.admin-banner { background: #fff4f1; border-color: var(--accent-soft); color: var(--text); }
.badge { color: var(--text); background: var(--surface-soft); border-color: var(--line); font-weight: 600; }
.priority-high { color: var(--danger); background: var(--danger-soft); }
.priority-medium { color: var(--warning); background: var(--warning-soft); }
.priority-low { color: var(--success); background: var(--success-soft); }
.modal { width: min(780px, calc(100vw - 28px)); }
.modal:has(.modal-panel-small) { width: min(480px, calc(100vw - 28px)); }
.modal, .modal-panel { max-height: calc(100dvh - 32px); }
.modal-panel-small { width: 100%; }
.modal-panel { padding: 24px; gap: 24px; overscroll-behavior: contain; }
.modal-header h2 { font-size: 1.375rem; line-height: 1.4; overflow-wrap: anywhere; }
.modal-header .icon-button { flex: 0 0 40px; }
.modal-actions {
  position: sticky;
  bottom: -24px;
  z-index: 2;
  justify-content: flex-end;
  padding: 16px 0;
  margin-bottom: -24px;
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.modal-actions button { min-height: 44px; }
.detail-line { color: #454545; line-height: 1.65; }
.detail-line svg { flex: 0 0 18px; margin-top: 4px; }
.detail-line strong { font-weight: 600; }
.recurrence-box { background: #fafafa; }
.responsible-options .choice-row:has(input:checked),
.responsible-person-option:has(input:checked) {
  color: var(--text);
  background: #fff0ed;
  border-color: #c3473e;
  box-shadow: none;
}
.choice-row, .switch-row, .weekday-picker label { font-weight: 600; }
.switch-row input, .weekday-picker input {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}
.responsible-person-option { min-height: 44px; }
.toast { font-size: 0.875rem; }
.sync-label[data-status="error"] { color: #fbcfc8; }
.sync-label[data-status="busy"] { color: #ffffff; }
.loading-skeleton { display: grid; gap: 12px; padding-block: 12px; }
.loading-skeleton span { height: 48px; border-radius: 4px; background: var(--surface-strong); animation: skeleton-pulse 1.4s ease-in-out infinite alternate; }
.loading-skeleton span:first-child { width: 40%; height: 24px; margin-bottom: 12px; }
@keyframes skeleton-pulse { to { opacity: 0.45; } }
@media (min-width: 1061px) {
  .filter-controls { grid-template-columns: minmax(240px, 1fr) repeat(4, minmax(130px, 0.7fr)); }
  .filter-controls .search-filter { grid-column: auto; }
  .filter-controls:not(.is-expanded) > label:not(.search-filter) { display: grid; }
  .filter-toggle { display: none; }
  .control-strip { grid-template-columns: 1fr; }
  .filter-controls { grid-column: auto; }
}
@media (min-width: 1061px) and (max-width: 1350px) {
  .control-strip { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .date-controls { grid-column: 1 / 3; grid-row: 1; }
  .filter-controls { display: contents; }
  .filter-controls .search-filter { grid-column: 3 / 5; grid-row: 1; }
  .item-meta-right { max-width: 52%; min-width: 0; }
  .item-context-mini, .responsible-mini { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media (max-width: 1060px) {
  .mobile-nav-drawer { padding-top: max(8px, env(safe-area-inset-top)); }
  .mobile-nav-brand { font-size: 1.125rem; font-weight: 700; margin-bottom: 6px; }
  .mobile-nav-drawer .nav-item { min-height: 36px; font-size: 0.8125rem; font-weight: 600; }
  .mobile-nav-drawer .nav-item.is-active { color: var(--text); }
  .mobile-nav-drawer .nav-item span { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
  .control-strip { gap: 12px; padding: 14px; }
  .search-filter > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .filter-controls { gap: 12px; grid-template-columns: 1fr 1fr; }
  .filter-controls .search-filter { grid-column: 1 / -1; }
  .date-controls { flex-wrap: nowrap; }
  .date-controls .text-button { display: none; }
  .date-input { flex: 1 1 auto; width: 100%; }
  .fab { display: inline-flex; align-items: center; justify-content: center; bottom: max(18px, env(safe-area-inset-bottom)); }
}
@media (max-width: 720px) {
  body { font-size: 16px; }
  .view-root { gap: 20px; }
  .metric { padding: 7px 9px; }
  .metric span { font-size: 0.75rem; }
  .metric strong { font-size: 1.2rem; }
  .item-card { padding: 7px 10px; }
  .item-meta-right {
    max-width: 100%;
    overflow: hidden;
    white-space: nowrap;
    flex-wrap: nowrap;
    gap: 2px 5px;
    font-size: 0.8125rem;
  }
  .item-context-mini { overflow: hidden; text-overflow: ellipsis; flex: 0 1 auto; }
  .responsible-mini { max-width: 38%; min-width: 28px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .item-title-row h3, .item-sequence { font-size: 0.9375rem; }
  .item-main-line { gap: 2px 5px; }
  .modal-panel { padding: 18px; }
  .modal-actions { bottom: -18px; margin-bottom: -18px; flex-direction: row; }
  .modal-actions button { width: auto; flex: 1; }
  .toast-host { bottom: 88px; right: 14px; }
}
@media (max-width: 360px) {
  .mobile-nav-drawer { padding-inline: 10px; }
  .mobile-nav-drawer .nav-item { font-size: 0.75rem; gap: 3px; }
  .mobile-nav-drawer .nav-item svg { display: none; }
  .control-strip { column-gap: 8px; }
  .filter-toggle { padding-inline: 8px; }
  .date-controls .icon-button { width: 30px; flex-basis: 30px; }
}
