:root {
  color-scheme: light;
  --ink: #16202a;
  --muted: #637083;
  --subtle: #e3e8ef;
  --subtle-strong: #d4dde8;
  --surface: #ffffff;
  --surface-strong: #f6f8fb;
  --canvas: #eef3f6;
  --brand: #0f766e;
  --brand-dark: #0d4f4b;
  --fire: #d9480f;
  --sky: #2563eb;
  --gold: #c98b0b;
  --sakura: #d6336c;
  --lavender: #7c3aed;
  --shadow: 0 10px 30px rgba(22, 32, 42, 0.08);
  --shadow-soft: 0 8px 20px rgba(22, 32, 42, 0.06);
  --radius: 8px;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Yu Gothic UI", "Meiryo", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.5;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--sky);
}

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

.app-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: center;
  padding: 22px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--subtle);
}

.brand {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.brand-art {
  width: 168px;
  height: 74px;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--subtle);
  box-shadow: var(--shadow-soft);
}

.brand-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: 36px;
  line-height: 1.12;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 18px;
  letter-spacing: 0;
}

.coverage-text {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.summary-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(84px, 1fr));
  gap: 8px;
  min-width: 390px;
}

.stat {
  position: relative;
  overflow: hidden;
  padding: 10px 12px;
  background: var(--surface-strong);
  border: 1px solid var(--subtle);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.stat::before {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: var(--brand);
}

.stat:nth-child(2)::before {
  background: var(--sky);
}

.stat:nth-child(3)::before {
  background: var(--gold);
}

.stat:nth-child(4)::before {
  background: var(--fire);
}

.stat b {
  display: block;
  font-size: 22px;
  line-height: 1.1;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.beta-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 24px;
  background: #fbfcfd;
  border-bottom: 1px solid var(--subtle);
}

.beta-banner-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
  color: #334155;
  font-size: 13px;
}

.beta-banner-copy strong {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  color: var(--brand-dark);
  background: #e8f7ef;
  border: 1px solid #b7e1c8;
  border-radius: 999px;
  font-size: 12px;
}

.beta-banner-copy span {
  min-width: 0;
}

.beta-feedback-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 24px 24px;
  color: var(--muted);
  font-size: 12px;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.site-footer a {
  color: var(--brand-dark);
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.legal-page {
  min-height: 100vh;
  background: var(--background);
}

.legal-main {
  width: min(880px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 48px;
}

.legal-main h1 {
  margin-bottom: 8px;
}

.legal-updated {
  margin: 0 0 28px;
  color: var(--muted);
  font-size: 14px;
}

.legal-section {
  padding: 20px 0;
  border-top: 1px solid var(--subtle);
}

.legal-section h2 {
  margin: 0 0 10px;
  font-size: 20px;
}

.legal-section p,
.legal-section li {
  color: var(--text);
  line-height: 1.75;
}

.legal-section ul {
  margin: 10px 0 0;
  padding-left: 1.3em;
}

.legal-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 16px;
  align-items: start;
  padding: 16px;
}

.filter-panel,
.calendar-panel,
.detail-panel {
  background: var(--surface);
  border: 1px solid var(--subtle);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.filter-panel {
  align-self: start;
  grid-column: 1 / -1;
  grid-row: 1;
  padding: 14px 16px;
}

.calendar-panel {
  grid-column: 1;
  grid-row: 2;
}

.detail-panel {
  grid-column: 2;
  grid-row: 2;
}

.filter-head,
.calendar-toolbar,
.month-controls {
  display: flex;
  align-items: center;
}

.filter-head,
.calendar-toolbar {
  justify-content: space-between;
  gap: 12px;
}

.filter-actions {
  display: flex;
  gap: 6px;
}

.filter-body {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) minmax(150px, 0.8fr) minmax(170px, 0.9fr) minmax(280px, 1.3fr) minmax(170px, 0.8fr);
  gap: 12px;
  align-items: end;
  min-width: 0;
  overflow-x: visible;
}

.filter-toggle {
  display: none;
}

.active-filter-summary {
  display: none;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field {
  display: grid;
  gap: 6px;
  margin-top: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.field input,
.field select {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--subtle);
  border-radius: var(--radius);
}

.field input:focus,
.field select:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  border-color: var(--brand);
}

.status-filter {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px 12px;
  align-self: stretch;
  align-content: center;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--subtle);
  border-radius: var(--radius);
}

.status-filter legend {
  padding: 0 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.status-filter label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 14px;
}

.status-filter input {
  margin-top: 3px;
}

.status-label {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.status-label strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.2;
}

.status-label small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

.flag-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  margin-top: 0;
  padding: 10px 12px;
  color: var(--ink);
  background: #fffaf0;
  border: 1px solid #f5d59b;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 800;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  grid-column: 1 / -1;
  gap: 10px 18px;
  margin-top: 0;
  padding-top: 12px;
  border-top: 1px solid var(--subtle);
  color: var(--muted);
  font-size: 12px;
}

.legend-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.legend-group strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1;
}

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

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.confirmed,
.event-chip.confirmed,
.status-pill.confirmed,
.month-event-row.confirmed,
.status-review.confirmed,
.day-event-dot.confirmed {
  --status-color: var(--brand);
}

.status-dot.tentative,
.event-chip.tentative,
.status-pill.tentative,
.month-event-row.tentative,
.status-review.tentative,
.day-event-dot.tentative {
  --status-color: var(--gold);
}

.status-dot.estimated,
.event-chip.estimated,
.status-pill.estimated,
.month-event-row.estimated,
.status-review.estimated,
.day-event-dot.estimated {
  --status-color: var(--fire);
}

.status-dot {
  background: var(--status-color);
}

.area-coast {
  --area-color: #2563eb;
}

.area-middle {
  --area-color: #0f766e;
}

.area-aizu {
  --area-color: #7c3aed;
}

.area-all {
  --area-color: #64748b;
}

.area-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  background: var(--area-color);
}

.attention-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(201, 139, 11, 0.14);
}

.ghost-button,
.icon-button,
.text-button {
  min-width: 40px;
  min-height: 40px;
  border: 1px solid var(--subtle);
  border-radius: var(--radius);
  background: var(--surface-strong);
  color: var(--ink);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.ghost-button:hover,
.icon-button:hover,
.text-button:hover {
  border-color: var(--brand);
  background: #fff;
  color: var(--brand-dark);
}

.ghost-button:active,
.icon-button:active,
.text-button:active {
  transform: translateY(1px);
}

.icon-button {
  font-size: 26px;
  line-height: 1;
}

.text-button {
  padding: 0 14px;
  font-weight: 700;
}

.compact-button {
  min-width: 0;
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.calendar-panel {
  min-width: 0;
  padding: 16px;
  overflow: hidden;
}

.month-controls {
  gap: 10px;
}

.calendar-actions {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
}

.calendar-help {
  position: relative;
}

.calendar-help summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  color: var(--brand-dark);
  background: #eefaf7;
  border: 1px solid color-mix(in srgb, var(--brand) 28%, white);
  border-radius: 50%;
  font-size: 15px;
  font-weight: 900;
  list-style: none;
  cursor: pointer;
}

.calendar-help summary::-webkit-details-marker {
  display: none;
}

.calendar-help-panel {
  position: absolute;
  z-index: 10;
  top: calc(100% + 8px);
  right: 0;
  width: min(300px, calc(100vw - 32px));
  padding: 12px;
  background: #fff;
  border: 1px solid var(--subtle-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.calendar-help-panel p {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  color: #334155;
  font-size: 12px;
  line-height: 1.45;
}

.calendar-help-panel p + p {
  margin-top: 7px;
}

.calendar-help-panel strong {
  color: var(--ink);
}

#monthTitle {
  width: 220px;
  text-align: center;
  font-size: 22px;
}

.date-filter-bar {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--subtle);
  border-radius: var(--radius);
}

.date-filter-bar[hidden] {
  display: none;
}

.date-filter-head,
.date-filter-head div {
  display: flex;
  align-items: center;
}

.date-filter-head {
  justify-content: space-between;
  gap: 12px;
}

.date-filter-head div {
  flex-wrap: wrap;
  gap: 8px;
}

.date-filter-head strong {
  font-size: 15px;
}

.date-filter-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.date-filter-head .shelf-count {
  color: #475569;
  background: #e8eef5;
  border: 1px solid var(--subtle);
  border-radius: 999px;
  padding: 2px 8px;
}

.date-filter-events {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}

.date-filter-event {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--subtle);
  border-radius: var(--radius);
  text-align: left;
}

.date-filter-event:hover,
.date-filter-event.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.date-filter-icon {
  font-size: 17px;
  line-height: 1;
}

.date-filter-main {
  min-width: 0;
}

.date-filter-main strong,
.date-filter-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.date-filter-main small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.date-filter-main .area-dot {
  margin-right: 4px;
}

.compact-empty {
  padding: 12px;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekday-row {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.weekday-row span {
  padding: 8px 0;
}

.calendar-grid {
  border-top: 1px solid var(--subtle);
  border-left: 1px solid var(--subtle);
  overflow: hidden;
  border-radius: var(--radius);
}

.day-cell {
  position: relative;
  display: grid;
  grid-template-rows: auto 1fr;
  min-height: 142px;
  padding: 8px;
  background: #fff;
  border-right: 1px solid var(--subtle);
  border-bottom: 1px solid var(--subtle);
  cursor: pointer;
  overflow: hidden;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}

.day-cell:hover {
  background: #fbfefd;
}

.day-cell.has-events {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfc 100%);
}

.day-cell.outside-month {
  background: #f8fafc;
  color: #98a2b3;
}

.day-cell.today {
  background: #ecfdf5;
  box-shadow: inset 0 0 0 2px var(--brand), 0 0 0 2px rgba(15, 118, 110, 0.08);
}

.day-cell.today::after {
  content: "今日";
  position: absolute;
  top: 9px;
  right: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 20px;
  padding: 0 7px;
  color: var(--brand-dark);
  background: #ccfbf1;
  border: 1px solid rgba(15, 118, 110, 0.26);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
}

.day-cell.today.selected-date {
  box-shadow: inset 0 0 0 2px var(--brand-dark), inset 0 0 0 4px rgba(15, 118, 110, 0.16);
}

.day-cell.selected-date {
  background: #f0fdfa;
  box-shadow: inset 0 0 0 2px var(--brand-dark);
}

.day-cell.past-month-day {
  background: #fbfcfd;
}

.day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-bottom: 6px;
  color: inherit;
  background: transparent;
  border: 0;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
}

.today .day-number {
  color: #fff;
  background: var(--brand);
}

.day-events {
  display: grid;
  gap: 5px;
  align-content: start;
  min-width: 0;
}

.day-mobile-summary {
  display: none;
}

.day-ongoing-hint {
  position: absolute;
  right: 12px;
  bottom: 5px;
  left: 12px;
  height: 2px;
  border-radius: 999px;
  background: repeating-linear-gradient(90deg, rgba(100, 116, 139, 0.34) 0 7px, transparent 7px 11px);
  pointer-events: none;
}

.day-ongoing-label {
  position: absolute;
  right: 8px;
  bottom: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 18px;
  padding: 0 6px;
  color: #475569;
  background: rgba(248, 250, 252, 0.92);
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  pointer-events: none;
}

.event-chip {
  display: grid;
  grid-template-columns: 3px minmax(0, 1fr);
  gap: 6px;
  align-items: stretch;
  width: 100%;
  min-height: 34px;
  padding: 0;
  color: var(--ink);
  background: color-mix(in srgb, var(--area-color) 5%, white);
  border: 1px solid var(--subtle);
  border-radius: var(--radius);
  overflow: hidden;
  text-align: left;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.event-chip::before {
  content: "";
  background: var(--status-color);
}

.event-chip:hover,
.event-chip.selected {
  border-color: var(--status-color);
  background: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--status-color) 18%, transparent);
}

.event-chip.past-event {
  opacity: 0.48;
}

.chip-body {
  min-width: 0;
  overflow: hidden;
  padding: 5px 6px 6px 0;
}

.chip-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 3px;
  align-items: center;
  overflow: hidden;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.28;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-category-icon {
  font-size: 11px;
  line-height: 1;
}

.chip-title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-meta {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 4px;
  align-items: center;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.2;
}

.chip-area-badge {
  min-width: 17px;
  padding: 0 4px;
  color: var(--area-color);
  background: color-mix(in srgb, var(--area-color) 11%, white);
  border: 1px solid color-mix(in srgb, var(--area-color) 30%, white);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
}

.chip-place {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-attention {
  min-width: 32px;
  padding: 0 4px;
  color: #7c2d12;
  background: #fff3e6;
  border: 1px solid #fed7aa;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
}

.more-count {
  width: 100%;
  margin-top: 3px;
  padding: 4px 6px;
  color: var(--brand-dark);
  background: #eefaf7;
  border: 1px dashed color-mix(in srgb, var(--brand) 42%, white);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.more-count:hover {
  color: var(--brand-dark);
  border-color: var(--brand);
  background: #fff;
}

.month-list {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.month-section {
  display: grid;
  gap: 8px;
}

.month-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.selected-date-head {
  align-items: flex-start;
}

.selected-date-title {
  min-width: 0;
}

.selected-date-title h3 {
  margin-bottom: 2px;
}

.month-section-head h3 {
  margin: 0;
  font-size: 14px;
}

.month-section-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.month-section-list {
  display: grid;
  gap: 8px;
}

.ongoing-shelf {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--subtle-strong);
  border-radius: var(--radius);
}

.ongoing-shelf[open] {
  background: #fbfefd;
}

.ongoing-shelf summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #334155;
  font-size: 14px;
  font-weight: 800;
  list-style: none;
  cursor: pointer;
}

.ongoing-shelf summary::-webkit-details-marker {
  display: none;
}

.ongoing-shelf summary::before {
  content: "▸";
  color: var(--brand);
  font-size: 14px;
  transform: translateY(-1px);
}

.ongoing-shelf[open] summary::before {
  content: "▾";
}

.ongoing-shelf summary span {
  flex: 1;
}

.ongoing-shelf summary strong {
  color: var(--muted);
  font-size: 12px;
}

.ongoing-shelf .month-section-list {
  margin-top: 8px;
}

.ongoing-shelf .shelf-events {
  margin-top: 8px;
}

.compact-shelf {
  margin-top: 2px;
  padding: 8px;
}

.compact-shelf .month-event-row {
  grid-template-columns: 76px minmax(0, 1fr);
  padding: 8px 10px;
}

.compact-shelf .month-event-row .attention-pill {
  grid-column: 2;
  justify-self: start;
}

.month-event-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--area-color) 4%, white);
  border: 1px solid var(--subtle);
  border-left: 4px solid var(--status-color);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.86) inset;
  cursor: pointer;
}

.ongoing-row {
  background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--area-color) 5%, white), color-mix(in srgb, var(--area-color) 5%, white) 8px, #fff 8px, #fff 16px);
  border-style: solid;
}

.month-event-row.past-event {
  opacity: 0.55;
}

.month-event-row.selected {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

.month-event-row:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.28);
  outline-offset: 2px;
}

.month-date {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.month-title {
  min-width: 0;
}

.month-title button,
.month-row-title {
  display: flex;
  align-items: center;
  gap: 5px;
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: transparent;
  border: 0;
  font-weight: 800;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-title button span:last-child,
.month-row-title span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-category-icon {
  flex: 0 0 auto;
  font-size: 14px;
  line-height: 1;
}

.month-sub {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-sub .area-dot {
  flex: 0 0 auto;
}

.attention-pill,
.status-pill,
.category-pill,
.area-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.attention-pill {
  color: #7c2d12;
  background: #fff3e6;
  border: 1px solid #fed7aa;
}

.status-pill {
  color: var(--status-color);
  background: color-mix(in srgb, var(--status-color) 12%, white);
  border: 1px solid color-mix(in srgb, var(--status-color) 35%, white);
}

.category-pill {
  color: #334155;
  background: #e8eef5;
}

.area-pill {
  color: var(--area-color);
  background: color-mix(in srgb, var(--area-color) 10%, white);
  border: 1px solid color-mix(in srgb, var(--area-color) 32%, white);
}

.detail-panel {
  align-self: start;
  max-height: calc(100vh - 32px);
  padding: 18px;
  position: sticky;
  top: 16px;
  overflow: auto;
  scroll-margin-top: 16px;
}

.mobile-inline-detail {
  display: none;
}

.detail-kicker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.detail-title {
  margin-bottom: 8px;
  font-size: 23px;
  line-height: 1.25;
}

.detail-date {
  margin-bottom: 12px;
  color: var(--brand-dark);
  font-weight: 800;
}

.detail-description {
  color: #334155;
}

.status-review {
  display: grid;
  gap: 4px;
  margin: 14px 0;
  padding: 12px;
  color: #334155;
  background: color-mix(in srgb, var(--status-color) 8%, white);
  border: 1px solid color-mix(in srgb, var(--status-color) 35%, white);
  border-left: 4px solid var(--status-color);
  border-radius: var(--radius);
  font-size: 13px;
}

.status-review strong {
  color: var(--status-color);
  font-size: 14px;
}

.status-review small {
  color: var(--muted);
  font-weight: 700;
}

.detail-meta {
  display: grid;
  gap: 8px;
  margin: 16px 0;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--subtle);
  border-radius: var(--radius);
}

.meta-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 10px;
  font-size: 14px;
}

.meta-row span:first-child {
  color: var(--muted);
  font-weight: 800;
}

.score-grid {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.feature-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 16px;
}

.feature-tags span {
  padding: 4px 8px;
  color: #334155;
  background: #eef3f8;
  border: 1px solid #d7e0ea;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.score-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 28px;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.score-bar {
  height: 8px;
  overflow: hidden;
  background: #edf2f7;
  border-radius: 999px;
}

.score-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--brand), var(--gold), var(--fire));
}

.notice {
  margin: 14px 0;
  padding: 12px;
  color: #7c2d12;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  font-size: 13px;
}

.detail-feedback {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 16px 0;
  padding: 10px 12px;
  color: #334155;
  background: #f8fafc;
  border: 1px solid var(--subtle);
  border-radius: var(--radius);
  font-size: 13px;
}

.detail-feedback a {
  flex: 0 0 auto;
  padding: 6px 10px;
  color: var(--brand-dark);
  background: #fff;
  border: 1px solid color-mix(in srgb, var(--brand) 30%, white);
  border-radius: 999px;
  font-weight: 800;
  text-decoration: none;
}

.source-list {
  display: grid;
  gap: 8px;
  padding-left: 0;
  list-style: none;
}

.source-item {
  padding: 10px;
  background: #f8fafc;
  border: 1px solid var(--subtle);
  border-radius: var(--radius);
}

.source-item a {
  font-weight: 800;
}

.source-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.source-meta span {
  display: inline-flex;
  min-height: 22px;
  align-items: center;
  padding: 2px 7px;
  color: var(--muted);
  background: #fff;
  border: 1px solid var(--subtle);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}

.empty-state,
.error-state {
  padding: 20px;
  color: var(--muted);
  background: var(--surface-strong);
  border: 1px dashed var(--subtle);
  border-radius: var(--radius);
}

.error-state {
  color: #991b1b;
  background: #fff1f2;
  border-color: #fecdd3;
}

@media (max-width: 1180px) {
  .app-header {
    grid-template-columns: 1fr;
  }

  .summary-stats {
    min-width: 0;
  }

  .workspace {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .filter-panel {
    grid-column: 1;
    grid-row: 1;
  }

  .filter-body {
    display: block;
    overflow-x: hidden;
  }

  .field {
    margin-top: 14px;
  }

  .status-filter {
    grid-template-columns: 1fr;
    gap: 8px;
    align-self: auto;
    align-content: normal;
    margin: 16px 0 0;
  }

  .flag-filter {
    margin-top: 14px;
  }

  .legend {
    display: grid;
    gap: 10px;
    margin-top: 16px;
    padding-top: 14px;
  }

  .legend-group {
    display: grid;
    gap: 7px;
  }

  .calendar-panel {
    grid-column: 2;
    grid-row: 1;
  }

  .detail-panel {
    grid-column: 1 / -1;
    grid-row: 2;
    position: static;
    max-height: none;
  }
}

@media (max-width: 820px) {
  .app-header {
    padding: 16px;
  }

  .beta-banner {
    align-items: stretch;
    flex-direction: column;
    padding: 10px 16px;
  }

  .beta-feedback-link {
    width: 100%;
  }

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

  .brand-art {
    width: 100%;
    height: 92px;
  }

  .summary-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    grid-template-columns: 1fr;
    padding: 10px;
    gap: 10px;
  }

  .filter-panel,
  .calendar-panel,
  .detail-panel {
    grid-column: auto;
    grid-row: auto;
    position: static;
  }

  .detail-panel {
    display: none;
  }

  .filter-panel {
    padding: 12px;
  }

  .filter-toggle {
    display: inline-flex;
  }

  .active-filter-summary {
    display: block;
  }

  .filter-panel.filter-collapsed {
    padding-bottom: 12px;
  }

  .filter-panel.filter-collapsed .filter-body {
    display: none;
  }

  .calendar-panel {
    padding: 12px;
    overflow: hidden;
  }

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

  .calendar-help-panel {
    right: 0;
  }

  #monthTitle {
    width: auto;
    min-width: 148px;
    font-size: 19px;
  }

  .weekday-row {
    margin-top: 12px;
  }

  .day-cell {
    display: flex;
    flex-direction: column;
    min-height: 88px;
    padding: 5px 3px 6px;
    cursor: pointer;
  }

  .day-number {
    width: 24px;
    height: 24px;
    margin-bottom: 0;
    font-size: 12px;
  }

  .day-cell.today::after {
    top: 6px;
    right: 4px;
    min-height: 15px;
    padding: 0 4px;
    font-size: 8px;
  }

  .day-events {
    display: none;
  }

  .day-mobile-summary {
    display: grid;
    grid-template-rows: 8px 18px;
    gap: 2px;
    justify-content: center;
    margin-top: auto;
    min-width: 0;
    min-height: 28px;
  }

  .day-cell.has-ongoing-hint .day-mobile-summary {
    padding-bottom: 0;
  }

  .day-cell:not(.has-events) .day-mobile-summary {
    min-height: 12px;
  }

  .day-ongoing-hint {
    right: 8px;
    bottom: 3px;
    left: 8px;
    height: 2px;
    opacity: 0.7;
  }

  .day-ongoing-label {
    position: static;
    align-self: center;
    max-width: calc(100% - 4px);
    min-height: 15px;
    margin-top: 1px;
    padding: 0 4px;
    font-size: 8.5px;
    transform: none;
  }

  .day-event-dots,
  .day-mobile-meta {
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .day-event-dots {
    gap: 3px;
    min-height: 8px;
  }

  .day-event-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--status-color);
  }

  .day-mobile-meta {
    gap: 2px;
    min-width: 0;
  }

  .day-event-count,
  .day-attention-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 16px;
    border-radius: 999px;
    font-size: 9.5px;
    font-weight: 900;
    line-height: 1;
    white-space: nowrap;
  }

  .day-event-count {
    min-width: 25px;
    padding: 0 3px;
    color: var(--brand-dark);
    background: #eefaf7;
    border: 1px solid color-mix(in srgb, var(--brand) 22%, white);
  }

  .day-attention-badge {
    width: 15px;
    color: #7c2d12;
    background: #fff3e6;
    border: 1px solid #fed7aa;
  }

  .month-list {
    margin-top: 12px;
  }

  .month-event-row {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    gap: 3px 8px;
    align-items: start;
    padding: 7px 8px;
  }

  .mobile-inline-detail {
    display: block;
    margin-top: -1px;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--subtle);
    border-left: 4px solid var(--brand);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
  }

  .mobile-inline-detail .detail-title {
    font-size: 20px;
  }

  .mobile-inline-detail .source-list {
    margin-bottom: 0;
  }

  .month-date {
    grid-column: 1;
    grid-row: 1 / span 2;
    padding-top: 1px;
    font-size: 11px;
    line-height: 1.25;
  }

  .month-title {
    grid-column: 2;
    min-width: 0;
  }

  .month-title button,
  .month-row-title {
    align-items: center;
    font-size: 13px;
    line-height: 1.28;
    white-space: nowrap;
  }

  .month-title button span:last-child,
  .month-row-title span:last-child {
    white-space: nowrap;
  }

  .month-sub {
    flex-wrap: nowrap;
    font-size: 11px;
    line-height: 1.35;
    white-space: nowrap;
  }

  .date-filter-events {
    grid-template-columns: 1fr;
  }

  .month-event-row .attention-pill {
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    min-height: 20px;
    padding: 1px 6px;
    font-size: 11px;
  }

  .compact-shelf .month-event-row {
    grid-template-columns: 48px minmax(0, 1fr) auto;
    padding: 7px 8px;
  }

  .compact-shelf .month-event-row .attention-pill {
    grid-column: 3;
    justify-self: end;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 28px;
  }

  .beta-banner-copy {
    display: grid;
    gap: 6px;
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .calendar-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .month-controls {
    justify-content: space-between;
  }

  .calendar-actions {
    width: 100%;
  }

  .calendar-actions .text-button {
    flex: 1;
    width: auto;
  }

  .text-button {
    width: 100%;
  }

  .selected-date-head {
    align-items: stretch;
    flex-direction: column;
  }

  .selected-date-head .compact-button {
    width: 100%;
  }

  .date-filter-event {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .date-filter-event .attention-pill {
    grid-column: 2;
    justify-self: start;
  }

  .meta-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .detail-feedback {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-feedback a {
    text-align: center;
  }
}
