:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-soft: #f0f0f2;
  --ink: #1d1d1f;
  --ink-soft: #6e6e73;
  --line: #dedee3;
  --line-strong: #c7c7cc;
  --blue: #0071e3;
  --blue-soft: #e8f2fd;
  --green: #23845a;
  --green-soft: #e7f5ed;
  --coral: #d94f57;
  --coral-soft: #fcebed;
  --amber: #a86900;
  --amber-soft: #fbf1dc;
  --violet: #7655a6;
  --violet-soft: #f0ebf7;
  --shadow: 0 12px 32px rgba(29, 29, 31, 0.08);
  --sidebar-width: 224px;
  --bottom-nav-height: 72px;
}

* {
  box-sizing: border-box;
  letter-spacing: 0;
}

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

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

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

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(0, 113, 227, 0.22);
  outline-offset: 2px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

svg {
  flex: 0 0 auto;
}

[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px 14px;
  border-right: 1px solid var(--line);
  background: rgba(250, 250, 252, 0.94);
  backdrop-filter: saturate(180%) blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  padding: 0 8px 24px;
}

.brand img {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(217, 79, 87, 0.16);
}

.brand div,
.brand strong,
.brand span {
  min-width: 0;
}

.brand strong,
.brand span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand strong {
  font-size: 16px;
  font-weight: 650;
}

.brand span {
  margin-top: 1px;
  color: var(--ink-soft);
  font-size: 12px;
}

.primary-nav,
.sidebar-footer {
  display: grid;
  gap: 5px;
}

.sidebar-footer {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

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

.nav-item:hover {
  background: var(--surface-soft);
  color: var(--ink);
}

.nav-item.is-active {
  background: var(--ink);
  color: #fff;
}

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

.main-content {
  width: 100%;
  max-width: 1220px;
  min-width: 0;
  margin: 0 auto;
  padding: 28px 36px 64px;
}

.topbar,
.view-heading,
.panel-heading,
.dialog-header,
.toolbar,
.month-controls,
.topbar-actions,
.form-actions,
.confirm-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  min-height: 54px;
  margin-bottom: 22px;
}

.topbar h1,
.view-heading h2,
.panel-heading h3,
.dialog-header h2,
.settings-section h3,
.confirm-content h2 {
  margin: 0;
  line-height: 1.22;
}

.topbar h1 {
  font-size: 25px;
  font-weight: 700;
}

.view-heading {
  min-height: 44px;
  margin-bottom: 18px;
}

.view-heading h2 {
  font-size: 22px;
  font-weight: 680;
}

.panel-heading h3,
.settings-section h3 {
  font-size: 17px;
  font-weight: 650;
}

.section-total {
  margin-left: 5px;
  color: var(--coral);
  font-size: 12px;
  font-weight: 600;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
}

.save-state {
  display: inline-flex;
  align-items: center;
  color: var(--ink-soft);
  font-size: 12px;
  gap: 7px;
}

.save-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.icon-button,
.primary-button,
.secondary-button,
.text-button,
.wide-add-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 7px;
  cursor: pointer;
  gap: 7px;
  white-space: nowrap;
}

.icon-button {
  width: 40px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
}

.icon-button.small {
  width: 34px;
  min-height: 34px;
}

.icon-button:hover,
.secondary-button:hover {
  border-color: var(--line-strong);
  background: #fafafa;
}

.icon-button svg,
.primary-button svg,
.secondary-button svg,
.wide-add-button svg {
  width: 18px;
  height: 18px;
}

.primary-button,
.secondary-button,
.danger-button {
  padding: 0 14px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 600;
}

.primary-button {
  background: var(--ink);
  color: #fff;
}

.primary-button:hover {
  background: #353539;
}

.secondary-button {
  border-color: var(--line);
  background: var(--surface);
}

.text-button,
.danger-text {
  min-height: auto;
  padding: 4px 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.danger-text {
  color: var(--coral);
}

.danger-button {
  background: var(--coral);
  color: #fff;
}

.sample-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  padding: 12px 14px;
  border: 1px solid #ead9a8;
  border-radius: 8px;
  background: #fff9e8;
}

.sample-notice strong,
.sample-notice span {
  display: block;
}

.sample-notice strong {
  font-size: 13px;
}

.sample-notice span {
  color: var(--ink-soft);
  font-size: 12px;
}

.sample-notice button {
  flex: 0 0 auto;
  padding: 5px 9px;
  border: 0;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
}

.month-picker {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  gap: 7px;
}

.month-picker svg {
  width: 17px;
  height: 17px;
  color: var(--ink-soft);
}

.month-picker input {
  width: 132px;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.metric-card {
  min-width: 0;
  min-height: 118px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.metric-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-soft);
  gap: 10px;
}

.metric-card header span {
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-icon {
  display: grid;
  width: 30px;
  height: 30px;
  border-radius: 7px;
  place-items: center;
}

.metric-icon svg {
  width: 16px;
  height: 16px;
}

.metric-icon.blue { background: var(--blue-soft); color: var(--blue); }
.metric-icon.green { background: var(--green-soft); color: var(--green); }
.metric-icon.coral { background: var(--coral-soft); color: var(--coral); }
.metric-icon.amber { background: var(--amber-soft); color: var(--amber); }

.metric-card strong {
  display: block;
  margin-top: 13px;
  overflow: hidden;
  font-size: 25px;
  font-weight: 680;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.metric-card small {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 11px;
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(320px, 0.88fr);
  gap: 14px;
  margin-bottom: 28px;
}

.panel {
  min-width: 0;
  min-height: 300px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.panel-heading {
  min-height: 38px;
  margin-bottom: 16px;
}

.finance-overview {
  display: grid;
  grid-template-columns: 144px minmax(0, 1fr);
  align-items: center;
  gap: 24px;
  padding: 8px 0 18px;
}

.net-figure {
  position: relative;
  display: grid;
  width: 132px;
  height: 132px;
  border-radius: 50%;
  background: conic-gradient(var(--green) var(--income-share), var(--coral) 0);
  place-items: center;
}

.net-figure::before {
  width: 98px;
  height: 98px;
  border-radius: 50%;
  background: var(--surface);
  content: "";
}

.net-figure-copy {
  position: absolute;
  text-align: center;
}

.net-figure-copy span,
.net-figure-copy strong {
  display: block;
}

.net-figure-copy span {
  color: var(--ink-soft);
  font-size: 11px;
}

.net-figure-copy strong {
  margin-top: 2px;
  font-size: 18px;
}

.finance-bars {
  display: grid;
  gap: 15px;
}

.finance-bar-row {
  display: grid;
  gap: 7px;
}

.finance-bar-label {
  display: flex;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 12px;
  gap: 12px;
}

.finance-bar-label strong {
  color: var(--ink);
}

.finance-bar-track {
  height: 7px;
  overflow: hidden;
  border-radius: 4px;
  background: var(--surface-soft);
}

.finance-bar-track span {
  display: block;
  height: 100%;
  border-radius: 4px;
}

.finance-bar-track .income { background: var(--green); }
.finance-bar-track .expense { background: var(--coral); }

.cost-summary {
  display: grid;
  gap: 12px;
  padding: 4px 0 16px;
}

.cost-row {
  display: grid;
  gap: 6px;
}

.cost-row > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-soft);
  font-size: 12px;
  gap: 12px;
}

.cost-row strong {
  color: var(--ink);
  font-size: 12px;
}

.cost-track {
  height: 6px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--surface-soft);
}

.cost-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--coral);
}

.ledger-list,
.task-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.ledger-item,
.task-item {
  display: grid;
  align-items: center;
  min-width: 0;
  border-bottom: 1px solid var(--line);
}

button.ledger-item {
  width: 100%;
  padding: 0;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.ledger-item {
  grid-template-columns: 32px minmax(0, 1fr) auto;
  gap: 10px;
  min-height: 54px;
}

.ledger-icon {
  display: grid;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  place-items: center;
}

.ledger-icon.income { background: var(--green-soft); color: var(--green); }
.ledger-icon.expense { background: var(--coral-soft); color: var(--coral); }

.ledger-icon svg {
  width: 15px;
  height: 15px;
}

.ledger-copy,
.task-copy {
  min-width: 0;
}

.ledger-copy strong,
.ledger-copy span,
.task-copy strong,
.task-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ledger-copy strong,
.task-copy strong {
  font-size: 13px;
  font-weight: 600;
}

.ledger-copy span,
.task-copy span {
  color: var(--ink-soft);
  font-size: 11px;
}

.ledger-amount {
  font-size: 13px;
  font-weight: 650;
}

.ledger-amount.income { color: var(--green); }
.ledger-amount.expense { color: var(--coral); }

.task-item {
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 11px;
  min-height: 60px;
  cursor: pointer;
}

.task-check {
  display: grid;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 1.5px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  place-items: center;
}

.task-check svg {
  width: 14px;
  height: 14px;
  opacity: 0;
}

.task-item.is-complete .task-check {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.task-item.is-complete .task-check svg {
  opacity: 1;
}

.task-item.is-complete .task-copy strong {
  color: var(--ink-soft);
  text-decoration: line-through;
}

.task-date {
  display: grid;
  min-width: 50px;
  justify-items: end;
  color: var(--ink-soft);
  font-size: 11px;
  white-space: nowrap;
}

.task-type-dot {
  width: 7px;
  height: 7px;
  margin-bottom: 4px;
  border-radius: 50%;
  background: var(--type-color, var(--blue));
}

.priority-date {
  display: grid;
  min-width: 58px;
  justify-items: end;
  font-size: 10px;
}

.priority-date strong {
  color: var(--blue);
  font-size: 11px;
}

.priority-date span {
  margin-top: 2px;
  color: var(--ink-soft);
}

.priority-task.is-overdue .task-check {
  border-color: var(--coral);
}

.priority-task.is-overdue .priority-date strong {
  color: var(--coral);
}

.section-block {
  min-width: 0;
}

.month-orders-panel {
  margin-bottom: 22px;
}

.backlog-panel {
  margin-bottom: 22px;
}

.backlog-list {
  display: grid;
  border-top: 1px solid var(--line);
}

.backlog-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  align-items: center;
  min-height: 54px;
  padding: 8px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  cursor: pointer;
  gap: 9px;
  text-align: left;
}

.backlog-row > span:nth-child(2),
.backlog-row strong,
.backlog-row small {
  display: block;
  min-width: 0;
}

.backlog-row strong,
.backlog-row small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.backlog-row strong {
  font-size: 12px;
}

.backlog-row small {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 10px;
}

.backlog-row > svg {
  width: 15px;
  color: var(--ink-soft);
}

.backlog-icon {
  display: grid;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: #eef6ee;
  color: var(--green);
  place-items: center;
}

.backlog-icon svg {
  width: 16px;
  height: 16px;
}

.month-orders-list {
  display: grid;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.month-order-row {
  display: grid;
  grid-template-columns: minmax(170px, 1.15fr) auto minmax(260px, 1.8fr) minmax(135px, 0.95fr);
  align-items: center;
  min-width: 0;
  padding: 12px 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: inherit;
  cursor: pointer;
  gap: 14px;
  text-align: left;
}

.month-order-row:last-child {
  border-bottom: 0;
}

.month-order-row:hover {
  background: var(--surface-soft);
}

.month-order-main,
.month-order-next {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.month-order-main strong,
.month-order-main small,
.month-order-next {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.month-order-state {
  display: grid;
  justify-items: start;
  gap: 4px;
}

.settlement-note {
  display: block;
  margin-top: 4px;
  color: var(--ink-soft);
  font-size: 9px;
  line-height: 1.3;
  white-space: nowrap;
}

.month-order-main strong {
  font-size: 13px;
}

.month-order-main small,
.month-order-next {
  color: var(--ink-soft);
  font-size: 11px;
}

.month-order-finance {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.month-order-finance span {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.month-order-finance .month-order-not-applicable {
  grid-column: 1 / -1;
}

.month-order-finance em {
  color: var(--ink-soft);
  font-size: 10px;
  font-style: normal;
}

.month-order-finance b {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.horizontal-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.receivable-card {
  min-width: 0;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
}

.receivable-card:hover,
.project-card:hover,
.idea-card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow);
}

.receivable-card header,
.project-card header,
.idea-card-body header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.receivable-card h4,
.project-card h3,
.idea-card h3 {
  margin: 0;
  overflow-wrap: anywhere;
}

.receivable-card h4 {
  margin-top: 11px;
  font-size: 14px;
}

.receivable-card strong {
  display: block;
  margin-top: 13px;
  color: var(--coral);
  font-size: 20px;
}

.receivable-card small {
  color: var(--ink-soft);
}

.status-chip,
.type-chip {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  max-width: 100%;
  padding: 0 8px;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-chip.green { background: var(--green-soft); color: var(--green); }
.status-chip.blue { background: var(--blue-soft); color: var(--blue); }
.status-chip.coral { background: var(--coral-soft); color: var(--coral); }
.status-chip.amber { background: var(--amber-soft); color: var(--amber); }

.type-chip.non-commercial {
  background: var(--amber-soft);
  color: var(--amber);
}

.month-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.month-controls .secondary-button {
  min-height: 38px;
  padding: 0 12px;
}

.month-calendar {
  overflow: hidden;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

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

.calendar-weekdays {
  min-height: 34px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 10px;
  text-align: center;
}

.calendar-day {
  position: relative;
  display: grid;
  align-content: start;
  min-width: 0;
  min-height: 92px;
  padding: 7px;
  border: 0;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  gap: 6px;
  text-align: left;
}

.calendar-day:nth-child(7n) {
  border-right: 0;
}

.calendar-day:nth-last-child(-n + 7) {
  border-bottom: 0;
}

.calendar-day:hover {
  background: var(--surface-soft);
}

.calendar-day.is-selected {
  z-index: 1;
  box-shadow: inset 0 0 0 2px var(--blue);
}

.calendar-day.is-outside {
  color: #b2b2b7;
}

.calendar-day > strong {
  display: grid;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  place-items: center;
}

.calendar-day.is-today > strong {
  background: var(--coral);
  color: #fff;
}

.calendar-events {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.calendar-event-label {
  display: block;
  min-width: 0;
  padding: 2px 5px;
  overflow: hidden;
  border-radius: 3px;
  background: var(--type-color, var(--blue));
  color: #fff;
  font-size: 9px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-event-label.is-complete {
  opacity: 0.42;
  text-decoration: line-through;
}

.calendar-events small {
  color: var(--ink-soft);
  font-size: 9px;
}

.day-agenda {
  min-width: 0;
}

.day-agenda .empty-state {
  min-height: 132px;
  border: 0;
}

.schedule-list {
  display: grid;
  gap: 22px;
}

.schedule-day h3 {
  margin: 0 0 9px;
  font-size: 14px;
  font-weight: 650;
}

.schedule-items {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.schedule-row {
  display: grid;
  grid-template-columns: 55px 4px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 72px;
  padding: 10px 13px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  gap: 12px;
}

.schedule-row:last-child {
  border-bottom: 0;
}

.schedule-time {
  color: var(--ink-soft);
  font-size: 12px;
  text-align: right;
}

.schedule-accent {
  align-self: stretch;
  min-height: 42px;
  border-radius: 2px;
  background: var(--type-color, var(--blue));
}

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

.schedule-copy strong,
.schedule-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.schedule-copy strong {
  font-size: 14px;
}

.schedule-copy span {
  margin-top: 2px;
  color: var(--ink-soft);
  font-size: 11px;
}

.wide-add-button {
  width: 100%;
  margin-top: 22px;
  border: 1px dashed var(--line-strong);
  background: transparent;
  color: var(--ink-soft);
}

.wide-add-button:hover {
  border-color: var(--ink);
  color: var(--ink);
}

.toolbar {
  align-items: stretch;
  margin-bottom: 16px;
}

.search-field {
  display: flex;
  align-items: center;
  width: min(360px, 100%);
  min-height: 40px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  gap: 8px;
}

.search-field svg {
  width: 17px;
  height: 17px;
  color: var(--ink-soft);
}

.search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.segmented-control {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(70px, auto);
  align-items: center;
  min-height: 40px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-soft);
}

.segmented-control button {
  min-height: 32px;
  padding: 0 11px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 12px;
}

.segmented-control button.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 4px rgba(29, 29, 31, 0.1);
  font-weight: 600;
}

.table-view-note {
  display: grid;
  gap: 3px;
  margin: -4px 0 14px;
  padding: 11px 13px;
  border-left: 3px solid var(--blue);
  background: var(--blue-soft);
}

.table-view-note strong {
  font-size: 13px;
  font-weight: 650;
}

.table-view-note span {
  color: var(--ink-soft);
  font-size: 12px;
}

.project-month-tabs {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 15px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.project-month-tabs::-webkit-scrollbar {
  display: none;
}

.project-month-tabs button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  font-size: 12px;
  white-space: nowrap;
}

.project-month-tabs button.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.project-month-tabs small {
  margin-left: 3px;
  opacity: 0.72;
}

.project-list {
  display: grid;
  gap: 18px;
}

.order-month-group {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.order-month-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 66px;
  padding: 12px 15px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
  gap: 18px;
}

.order-month-heading > div:first-child {
  min-width: 115px;
}

.order-month-heading span,
.order-month-heading h3 {
  display: block;
}

.order-month-heading span {
  color: var(--ink-soft);
  font-size: 11px;
}

.order-month-heading h3 {
  margin: 2px 0 0;
  font-size: 17px;
  font-weight: 680;
}

.order-month-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--ink-soft);
  font-size: 11px;
  gap: 6px 14px;
  text-align: right;
}

.order-month-summary span + span {
  position: relative;
}

.order-month-summary span + span::before {
  position: absolute;
  top: 0;
  left: -8px;
  color: var(--line-strong);
  content: "·";
}

.order-table-wrap {
  overflow-x: auto;
}

.order-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 12px;
}

.order-table th,
.order-table td {
  padding: 10px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.order-table th {
  color: var(--ink-soft);
  background: #fafafd;
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.order-table th:nth-child(1) { width: 23%; }
.order-table th:nth-child(2) { width: 10%; }
.order-table th:nth-child(3) { width: 11%; }
.order-table th:nth-child(4) { width: 9%; }
.order-table th:nth-child(5),
.order-table th:nth-child(6) { width: 11%; }
.order-table th:nth-child(7) { width: 10%; }
.order-table th:nth-child(8) { width: 10%; }
.order-table th:nth-child(9) { width: 8%; }

.order-table tbody tr:last-child td {
  border-bottom: 0;
}

.order-table-row {
  cursor: pointer;
  transition: background 140ms ease;
}

.order-table-row:hover,
.order-table-row:focus-visible {
  outline: 0;
  background: var(--blue-soft);
}

.table-project,
.table-next,
.table-stack {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.table-project strong {
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 650;
}

.table-id {
  color: var(--blue);
  font-variant-numeric: tabular-nums;
}

.table-project small,
.table-next small,
.table-submoney {
  color: var(--ink-soft);
  font-size: 10px;
}

.table-next strong {
  font-size: 11px;
  font-weight: 600;
}

.table-money,
.table-pending {
  font-weight: 650;
  white-space: nowrap;
}

.table-na,
.table-next {
  color: var(--ink-soft);
}

.table-stack .status-chip,
.table-stack .type-chip {
  justify-self: start;
}

.asset-status {
  display: inline-flex;
  min-height: 23px;
  align-items: center;
  padding: 0 7px;
  border-radius: 5px;
  background: var(--surface-soft);
  color: var(--ink-soft);
  font-size: 10px;
  white-space: nowrap;
}

.asset-status.has-assets {
  background: var(--green-soft);
  color: var(--green);
}

.project-card {
  min-width: 0;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.project-card h3 {
  margin-top: 13px;
  font-size: 17px;
}

.project-brand {
  margin: 4px 0 16px;
  color: var(--ink-soft);
  font-size: 12px;
}

.project-date {
  margin: -10px 0 14px;
  color: var(--ink-soft);
  font-size: 11px;
}

.project-meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.project-meta span,
.project-meta strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-meta span {
  color: var(--ink-soft);
  font-size: 10px;
}

.project-meta strong {
  margin-top: 2px;
  font-size: 13px;
}

.project-meta-wide {
  grid-column: 1 / -1;
}

.project-card:has(.type-chip.non-commercial) .project-meta {
  background: #fffaf0;
}

.project-next {
  display: flex;
  align-items: center;
  min-width: 0;
  margin-top: 12px;
  color: var(--ink-soft);
  font-size: 11px;
  gap: 7px;
}

.project-next svg {
  width: 15px;
  height: 15px;
}

.project-next span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.idea-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.idea-cover {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #e8e8eb;
}

.idea-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.idea-cover-fallback {
  display: grid;
  width: 100%;
  height: 100%;
  background: var(--fallback-bg, var(--surface-soft));
  color: var(--fallback-ink, var(--ink));
  place-items: center;
}

.idea-cover-fallback svg {
  width: 34px;
  height: 34px;
}

.idea-card-body {
  padding: 14px;
}

.idea-card-body [data-source-link] {
  display: grid;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  color: var(--blue);
  place-items: center;
}

.idea-card-body [data-source-link]:hover {
  background: var(--blue-soft);
}

.idea-card-body [data-source-link] svg {
  width: 16px;
  height: 16px;
}

.idea-card h3 {
  margin-top: 11px;
  font-size: 15px;
}

.idea-card p {
  display: -webkit-box;
  min-height: 42px;
  margin: 7px 0 0;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.empty-state {
  grid-column: 1 / -1;
  display: grid;
  min-height: 190px;
  padding: 28px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--ink-soft);
  place-items: center;
  text-align: center;
}

.empty-state svg {
  width: 28px;
  height: 28px;
  margin: 0 auto 8px;
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state strong {
  color: var(--ink);
  font-size: 14px;
}

.empty-state span {
  margin-top: 3px;
  font-size: 12px;
}

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

.sheet-dialog,
.confirm-dialog {
  width: min(680px, calc(100vw - 32px));
  max-height: min(860px, calc(100dvh - 32px));
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
  color: var(--ink);
}

.sheet-dialog::backdrop,
.confirm-dialog::backdrop {
  background: rgba(0, 0, 0, 0.36);
  backdrop-filter: blur(5px);
}

.dialog-header {
  min-height: 74px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-header h2 {
  max-width: 520px;
  overflow: hidden;
  font-size: 20px;
  font-weight: 680;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-dialog {
  width: min(520px, calc(100vw - 32px));
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 18px;
}

.action-grid button {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  grid-template-rows: auto auto;
  min-height: 68px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  column-gap: 10px;
  text-align: left;
}

.action-grid button:hover {
  border-color: var(--line-strong);
  background: #fafafa;
}

.action-icon {
  display: grid;
  grid-row: 1 / 3;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  place-items: center;
}

.action-icon svg {
  width: 19px;
  height: 19px;
}

.action-icon.coral { background: var(--coral-soft); color: var(--coral); }
.action-icon.blue { background: var(--blue-soft); color: var(--blue); }
.action-icon.green { background: var(--green-soft); color: var(--green); }
.action-icon.amber { background: var(--amber-soft); color: var(--amber); }
.action-icon.violet { background: var(--violet-soft); color: var(--violet); }

.action-grid strong {
  align-self: end;
  font-size: 13px;
}

.action-grid small {
  align-self: start;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.editor-form,
#project-detail-content,
.settings-dialog > .settings-section {
  overflow-y: auto;
}

.editor-form {
  max-height: calc(100dvh - 108px);
  padding: 18px;
}

.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid.two-col {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.span-2 {
  grid-column: span 2;
}

.field {
  display: grid;
  min-width: 0;
  gap: 6px;
}

.field > span,
.milestone-grid label > span:first-child {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
}

.field input,
.field select,
.field textarea,
.milestone-grid input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  outline: 0;
}

.field input,
.field select,
.milestone-grid input {
  min-height: 42px;
  padding: 0 10px;
}

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

.field input:focus,
.field select:focus,
.field textarea:focus,
.milestone-grid input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

.idea-import-box {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.idea-import-box p {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.5;
}

.inline-action-field {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.inline-action-field button {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
  white-space: nowrap;
}

.inline-action-field button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.inline-action-field button svg {
  width: 15px;
  height: 15px;
}

.money-input {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.money-input:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.1);
}

.money-input b {
  padding-left: 10px;
  color: var(--ink-soft);
  font-weight: 500;
}

.money-input input {
  border: 0;
  box-shadow: none !important;
}

.money-input.large b,
.money-input.large input {
  font-size: 25px;
}

.form-section {
  margin: 18px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.form-section legend {
  padding: 0 6px;
  font-size: 13px;
  font-weight: 650;
}

.form-section-hint {
  margin: -3px 0 12px;
  color: var(--ink-soft);
  font-size: 12px;
}

.switch-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  margin: -3px 0 14px;
  cursor: pointer;
  gap: 12px;
}

.switch-row span,
.switch-row strong,
.switch-row small {
  display: block;
}

.switch-row strong {
  font-size: 12px;
}

.switch-row small {
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.45;
}

.switch-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-row i {
  position: relative;
  width: 42px;
  height: 24px;
  border-radius: 12px;
  background: #c7c7cc;
  transition: background 160ms ease;
}

.switch-row i::after {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.22);
  content: "";
  transition: transform 160ms ease;
}

.switch-row input:checked + i {
  background: var(--green);
}

.switch-row input:checked + i::after {
  transform: translateX(18px);
}

.switch-row input:focus-visible + i {
  outline: 3px solid rgba(0, 113, 227, 0.18);
  outline-offset: 2px;
}

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

.milestone-grid label {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.milestone-grid input {
  padding: 0 7px;
  font-size: 12px;
}

.milestone-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 98px;
  gap: 6px;
}

.form-actions {
  position: sticky;
  bottom: -18px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  margin: 20px -18px -18px;
  padding: 13px 18px calc(13px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
}

#project-detail-content {
  max-height: calc(100dvh - 108px);
  padding: 18px;
}

.detail-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.detail-finance-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.detail-finance-grid > div {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.detail-finance-grid span,
.detail-finance-grid strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-field-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.detail-field-grid > div,
.detail-ddl-item,
.detail-archive-item,
.detail-archive-list a {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.detail-field-grid span,
.detail-field-grid strong,
.detail-ddl-item span,
.detail-ddl-item strong,
.detail-ddl-item small,
.detail-archive-item span,
.detail-archive-item strong,
.detail-archive-list a span,
.detail-archive-list a strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.detail-field-grid span,
.detail-ddl-item span,
.detail-archive-item span,
.detail-archive-list a span {
  color: var(--ink-soft);
  font-size: 10px;
}

.detail-field-grid strong,
.detail-ddl-item strong,
.detail-archive-item strong,
.detail-archive-list a strong {
  margin-top: 3px;
  font-size: 12px;
  font-weight: 600;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.detail-ddl-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.detail-ddl-item small {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 10px;
}

.detail-archive-list {
  display: grid;
  gap: 8px;
}

.detail-archive-list a {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto 16px;
  align-items: center;
  color: inherit;
  gap: 8px;
  text-decoration: none;
}

.detail-archive-list a:hover {
  background: var(--surface-soft);
}

.detail-archive-list a svg {
  width: 16px;
  height: 16px;
  color: var(--blue);
}

.detail-finance-grid span {
  color: var(--ink-soft);
  font-size: 10px;
}

.detail-finance-grid strong {
  margin-top: 3px;
  font-size: 13px;
}

.detail-summary div {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-summary span,
.detail-summary strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-summary span {
  color: var(--ink-soft);
  font-size: 10px;
}

.detail-summary strong {
  margin-top: 3px;
  font-size: 14px;
}

.detail-section {
  margin-top: 22px;
}

.detail-section h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.detail-section h3 small {
  margin-left: 5px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 500;
}

.detail-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  gap: 10px;
}

.detail-section-heading h3 {
  margin: 0;
}

.detail-section-heading > div {
  display: flex;
  align-items: center;
  gap: 6px;
}

.secondary-button.compact {
  min-height: 34px;
  padding: 0 10px;
  font-size: 11px;
}

.checkpoint-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.checkpoint-grid > div {
  min-width: 0;
  padding: 11px;
  border-right: 1px solid var(--line);
}

.checkpoint-grid > div:last-child {
  border-right: 0;
}

.checkpoint-grid span,
.checkpoint-grid strong,
.checkpoint-grid small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.checkpoint-grid span,
.checkpoint-grid small {
  color: var(--ink-soft);
  font-size: 10px;
}

.checkpoint-grid strong {
  margin: 5px 0 2px;
  font-size: 13px;
}

.snapshot-list {
  display: grid;
  margin-top: 8px;
  border-top: 1px solid var(--line);
}

.snapshot-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) repeat(4, auto);
  align-items: center;
  padding: 10px 2px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 11px;
  gap: 12px;
}

.snapshot-row > span:first-child strong,
.snapshot-row > span:first-child small {
  display: block;
}

.snapshot-row > span:first-child strong {
  color: var(--ink);
  font-size: 12px;
}

.snapshot-row > span:first-child small {
  margin-top: 2px;
  font-size: 9px;
}

.tracking-empty {
  display: flex;
  align-items: center;
  min-height: 52px;
  padding: 11px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--ink-soft);
  font-size: 11px;
  gap: 8px;
}

.tracking-empty svg {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.tracking-manual {
  margin-top: 8px;
}

.asset-list {
  display: grid;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.asset-list a,
.asset-list .asset-empty {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 49px;
  padding: 8px 11px;
  border-bottom: 1px solid var(--line);
  gap: 8px;
}

.asset-list a:last-child,
.asset-list .asset-empty:last-child {
  border-bottom: 0;
}

.asset-list a:hover {
  background: #fafafa;
}

.asset-list svg {
  width: 17px;
  height: 17px;
  color: var(--blue);
}

.asset-list span {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-list small {
  color: var(--ink-soft);
  font-size: 10px;
}

.detail-copy {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
  color: var(--ink-soft);
  font-size: 13px;
  white-space: pre-wrap;
}

.detail-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 22px;
  gap: 8px;
}

.settings-dialog {
  width: min(520px, calc(100vw - 32px));
}

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

.settings-section:last-child {
  border-bottom: 0;
}

.settings-section h3 {
  margin-bottom: 10px;
  font-size: 13px;
}

.settings-actions {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.settings-actions button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 18px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  padding: 8px 11px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  cursor: pointer;
  gap: 9px;
  text-align: left;
}

.settings-actions button:last-child {
  border-bottom: 0;
}

.settings-actions button:hover {
  background: #fafafa;
}

.settings-actions button > svg {
  width: 17px;
  height: 17px;
  color: var(--ink-soft);
}

.settings-icon {
  display: grid;
  width: 32px;
  height: 32px;
  border-radius: 7px;
  background: var(--surface-soft);
  color: var(--ink);
  place-items: center;
}

.settings-icon svg {
  width: 17px;
  height: 17px;
}

.settings-actions strong,
.settings-actions small {
  display: block;
}

.settings-actions strong {
  font-size: 13px;
}

.settings-actions small {
  color: var(--ink-soft);
  font-size: 11px;
}

.data-counts {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.data-counts div {
  padding: 10px 5px;
  border-radius: 7px;
  background: var(--surface-soft);
  text-align: center;
}

.data-counts strong,
.data-counts span {
  display: block;
}

.data-counts strong {
  font-size: 17px;
}

.data-counts span {
  color: var(--ink-soft);
  font-size: 10px;
}

.reset-button {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--coral);
  cursor: pointer;
  font-weight: 600;
}

.confirm-dialog {
  width: min(390px, calc(100vw - 32px));
}

.confirm-content {
  padding: 24px;
  text-align: center;
}

.confirm-icon {
  display: grid;
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background: var(--coral-soft);
  color: var(--coral);
  place-items: center;
}

.confirm-icon svg {
  width: 21px;
  height: 21px;
}

.confirm-content h2 {
  font-size: 18px;
}

.confirm-content p {
  margin: 8px 0 18px;
  color: var(--ink-soft);
  font-size: 13px;
}

.confirm-actions {
  justify-content: stretch;
}

.confirm-actions button {
  flex: 1;
}

.toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 24px;
  max-width: calc(100vw - 32px);
  padding: 10px 14px;
  border-radius: 7px;
  background: rgba(29, 29, 31, 0.94);
  color: #fff;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

body.dialog-open {
  position: fixed;
  top: var(--locked-scroll-y);
  right: 0;
  left: 0;
  width: 100%;
}

@media (max-width: 1020px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .home-grid { grid-template-columns: 1fr; }
  .horizontal-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .idea-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .app-shell {
    display: block;
    min-height: 100dvh;
  }

  .sidebar {
    display: none;
  }

  .main-content {
    max-width: none;
    padding: calc(14px + env(safe-area-inset-top)) 14px calc(var(--bottom-nav-height) + 34px + env(safe-area-inset-bottom));
  }

  .topbar {
    min-height: 46px;
    margin-bottom: 14px;
  }

  .topbar h1 {
    font-size: 21px;
  }

  .topbar-actions .save-state {
    display: none;
  }

  .view-heading {
    margin-bottom: 14px;
  }

  .view-heading h2 {
    font-size: 20px;
  }

  .sample-notice {
    align-items: flex-start;
    margin-bottom: 14px;
  }

  .home-heading {
    align-items: flex-end;
  }

  .month-picker {
    min-height: 36px;
  }

  .month-picker input {
    width: 112px;
    font-size: 12px;
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 14px;
  }

  .month-orders-panel {
    margin-bottom: 14px;
  }

  .backlog-panel {
    margin-bottom: 14px;
  }

  .month-order-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 7px 10px;
    padding: 12px 0;
  }

  .month-order-state {
    grid-column: 2;
    grid-row: 1;
    justify-items: end;
  }

  .month-order-finance {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .month-order-next {
    grid-column: 1 / -1;
    grid-row: 3;
    max-width: none;
    justify-self: start;
    text-align: left;
  }

  .project-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 8px;
  }

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

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

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

  .detail-section-heading {
    align-items: flex-start;
  }

  .detail-section-heading > div {
    flex: 0 0 auto;
  }

  .snapshot-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px 5px;
    font-size: 10px;
  }

  .snapshot-row > span:first-child {
    grid-column: 1 / -1;
  }

  .detail-actions {
    flex-wrap: wrap;
  }

  .metric-card {
    min-height: 103px;
    padding: 13px;
  }

  .metric-card strong {
    font-size: 21px;
  }

  .home-grid {
    gap: 10px;
    margin-bottom: 22px;
  }

  .panel {
    min-height: 0;
    padding: 14px;
  }

  .finance-overview {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 16px;
  }

  .net-figure {
    width: 108px;
    height: 108px;
  }

  .net-figure::before {
    width: 80px;
    height: 80px;
  }

  .net-figure-copy strong {
    font-size: 15px;
  }

  .horizontal-list {
    grid-auto-columns: minmax(230px, 78vw);
    grid-template-columns: none;
    grid-auto-flow: column;
    gap: 9px;
    margin: 0 -14px;
    padding: 0 14px 4px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .receivable-card {
    scroll-snap-align: start;
  }

  .month-controls {
    gap: 5px;
  }

  .month-controls .icon-button {
    width: 36px;
    min-height: 36px;
  }

  .month-controls .secondary-button {
    min-height: 36px;
    padding: 0 10px;
  }

  .month-calendar {
    margin-right: -6px;
    margin-left: -6px;
  }

  .calendar-weekdays {
    min-height: 30px;
  }

  .calendar-day {
    min-height: 66px;
    padding: 4px;
    gap: 3px;
  }

  .calendar-day > strong {
    width: 21px;
    height: 21px;
    font-size: 11px;
  }

  .calendar-event-label {
    padding: 1px 3px;
    font-size: 9px;
  }

  .schedule-row {
    grid-template-columns: 42px 3px minmax(0, 1fr) auto;
    min-height: 68px;
    padding: 9px 10px;
    gap: 9px;
  }

  .schedule-time {
    font-size: 11px;
  }

  .toolbar {
    display: grid;
    gap: 10px;
  }

  .search-field {
    width: 100%;
  }

  .segmented-control {
    grid-auto-columns: minmax(0, 1fr);
    width: 100%;
  }

  .project-list,
  .idea-grid {
    grid-template-columns: 1fr;
  }

  .table-view-note {
    margin-top: -2px;
    padding: 10px 11px;
  }

  .table-view-note span {
    line-height: 1.45;
  }

  .project-month-tabs {
    margin-right: -14px;
    margin-left: -14px;
    padding-right: 14px;
    padding-left: 14px;
  }

  .order-month-heading {
    align-items: flex-start;
    min-height: 0;
    padding: 12px;
    gap: 9px;
  }

  .order-month-heading > div:first-child {
    min-width: 95px;
  }

  .order-month-heading h3 {
    font-size: 16px;
  }

  .order-month-summary {
    justify-content: flex-end;
    gap: 3px 10px;
    line-height: 1.45;
  }

  .order-month-summary span + span::before {
    left: -6px;
  }

  .order-table-wrap {
    overflow: visible;
  }

  .order-table {
    min-width: 0;
    table-layout: auto;
  }

  .order-table thead {
    display: none;
  }

  .order-table,
  .order-table tbody,
  .order-table-row,
  .order-table-row td {
    display: block;
  }

  .order-table-row {
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
  }

  .order-table-row:last-child {
    border-bottom: 0;
  }

  .order-table-row td {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    min-height: 28px;
    padding: 4px 0;
    border: 0;
    gap: 12px;
    text-align: right;
  }

  .order-table-row td::before {
    flex: 0 0 auto;
    color: var(--ink-soft);
    content: attr(data-label);
    font-size: 10px;
    text-align: left;
  }

  .order-table-row .table-project {
    display: grid;
    align-items: start;
    justify-content: start;
    min-height: 44px;
    margin-bottom: 3px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
    text-align: left;
  }

  .order-table-row .table-project::before {
    display: none;
  }

  .order-table-row .table-project strong,
  .order-table-row .table-project small {
    max-width: 100%;
    text-align: left;
  }

  .order-table-row .table-stack {
    justify-items: end;
    text-align: right;
  }

  .order-table-row .table-next {
    justify-items: end;
    text-align: right;
  }

  .idea-card {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    min-height: 116px;
  }

  .idea-cover {
    height: 100%;
    aspect-ratio: auto;
  }

  .idea-card-body {
    padding: 12px;
  }

  .idea-card h3 {
    margin-top: 8px;
    font-size: 14px;
  }

  .idea-card p {
    min-height: 36px;
    font-size: 11px;
  }

  .desktop-only {
    display: none;
  }

  .bottom-nav {
    position: fixed;
    z-index: 40;
    right: 0;
    bottom: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    padding: 5px 8px env(safe-area-inset-bottom);
    border-top: 1px solid rgba(222, 222, 227, 0.9);
    background: rgba(250, 250, 252, 0.9);
    backdrop-filter: saturate(180%) blur(18px);
  }

  .bottom-nav button {
    display: grid;
    min-width: 0;
    padding: 7px 0 4px;
    border: 0;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
    font-size: 10px;
    justify-items: center;
    gap: 2px;
  }

  .bottom-nav button.is-active {
    color: var(--blue);
  }

  .bottom-nav svg {
    width: 21px;
    height: 21px;
  }

  .mobile-only {
    display: inline-flex;
  }

  .sheet-dialog {
    width: 100%;
    max-width: none;
    max-height: calc(94dvh - env(safe-area-inset-top));
    margin: auto 0 0;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 8px 8px 0 0;
  }

  .dialog-header {
    padding: 13px 14px;
  }

  .action-grid {
    padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
  }

  .editor-form,
  #project-detail-content {
    max-height: calc(94dvh - 76px - env(safe-area-inset-top));
    padding: 14px;
  }

  .form-grid.two-col {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

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

  .form-actions {
    bottom: -14px;
    margin: 18px -14px -14px;
    padding: 11px 14px calc(11px + env(safe-area-inset-bottom));
  }

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

  .toast {
    bottom: calc(var(--bottom-nav-height) + 18px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 420px) {
  .action-grid {
    grid-template-columns: 1fr;
  }

  .finance-overview {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .finance-bars {
    width: 100%;
  }

  .form-actions {
    grid-template-columns: auto 1fr auto;
  }

  .form-actions .danger-text + span {
    display: none;
  }

  .form-actions .secondary-button {
    display: none;
  }
}

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