:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #edf4f2;
  --ink: #17201d;
  --muted: #66736f;
  --line: #dce4df;
  --brand: #0f766e;
  --brand-dark: #0b5f59;
  --accent: #d97706;
  --danger: #b42318;
  --shadow: 0 14px 36px rgba(22, 32, 29, 0.12);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  padding: env(safe-area-inset-top) 0 calc(76px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 18px 12px;
  background: rgba(246, 247, 244, 0.92);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(220, 228, 223, 0.7);
}

.header-actions {
  display: flex;
  gap: 8px;
}

.brand-block {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.brand-logo {
  width: 46px;
  height: 46px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

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

.version-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 2px 6px;
  color: #fff;
  background: var(--brand);
  border-radius: 999px;
  font-size: 10px;
  letter-spacing: 0.02em;
}

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

h1 {
  margin-bottom: 0;
  max-width: min(52vw, 360px);
  font-size: 12px;
  line-height: 1.15;
  white-space: nowrap;
}

h2 {
  margin-bottom: 0;
  font-size: 12px;
}

main {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.dashboard-notifications {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  box-shadow: 0 8px 22px rgba(22, 32, 29, 0.06);
}

.notification-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  min-height: 24px;
  margin-left: 6px;
  padding: 2px 7px;
  color: #9a3412;
  background: #ffedd5;
  border-radius: 999px;
  font-size: 12px;
}

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

.notification-swipe-row {
  border-radius: 10px;
}

.notification-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid #fdba74;
  border-radius: 10px;
}

.notification-card h3 {
  margin: 0;
  font-size: 15px;
}

.notification-card p {
  margin: 0;
}

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

.summary-grid article {
  min-width: 0;
  min-height: 92px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(22, 32, 29, 0.06);
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.summary-grid strong {
  display: block;
  margin-top: 10px;
  max-width: 100%;
  font-size: clamp(16px, 6vw, 24px);
  line-height: 1.1;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.partner-summary {
  display: grid;
  gap: 8px;
}

.partner-filter-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding: 12px;
  color: var(--muted);
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  border-radius: 10px;
}

.partner-filter-total strong {
  color: var(--brand-dark);
  font-size: 12px;
}

.partner-summary-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.partner-summary-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--brand);
}

.partner-summary-row span {
  color: var(--muted);
  font-size: 13px;
}

.partner-summary-row strong {
  color: var(--brand-dark);
}

.section-head,
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin: 22px 0 10px;
}

.month-toolbar,
.manager-add,
.sort-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.month-toolbar input,
.sort-toolbar label {
  max-width: 240px;
}

.sort-toolbar label {
  width: 100%;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.car-sort-filter {
  display: grid;
  gap: 8px;
  margin: -2px 0 10px;
}

.car-sort-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.car-sort-filter-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.car-sort-filter-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.car-sort-filter label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 7px 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.car-sort-filter input {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--brand);
}

.manager-add input {
  min-width: 0;
}

.manager-add .primary-button {
  flex: 0 0 auto;
}

.monthly-summary {
  margin-bottom: 8px;
}

.managed-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.manager-section {
  margin: 12px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.manager-section summary {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 800;
  list-style-position: inside;
}

.manager-section summary::marker {
  color: var(--brand);
}

.manager-count {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  margin-left: auto;
  padding: 0 6px;
  color: var(--brand-dark);
  background: var(--surface-2);
  border-radius: 999px;
  font-size: 12px;
}

.manager-content {
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
}

.manager-content .manager-add {
  margin-top: 12px;
}

.managed-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 4px 5px 4px 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.managed-name-button {
  min-width: 0;
  width: auto;
  height: 28px;
  padding: 0 6px;
  color: var(--text);
  background: transparent;
  border: 0;
  font: inherit;
  text-align: left;
}

.managed-remove-button {
  min-width: 34px;
  width: auto;
  height: 28px;
  color: var(--danger);
  background: transparent;
  border: 0;
  font-weight: 900;
}

.toolbar {
  position: sticky;
  top: 72px;
  z-index: 8;
  padding: 8px 0;
  background: rgba(246, 247, 244, 0.94);
  backdrop-filter: blur(18px);
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

label.full {
  grid-column: 1 / -1;
}

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

.segmented-control {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 4px;
  margin: 0 0 12px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segmented-control button {
  min-height: 38px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-weight: 800;
}

.segmented-control button.active {
  color: #fff;
  background: var(--brand);
}

.segmented-control span {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  margin-left: 3px;
  padding: 0 5px;
  color: inherit;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  font-size: 11px;
}

.empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.card {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(22, 32, 29, 0.05);
}

.swipe-row {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  touch-action: pan-y;
}

.swipe-row .card {
  position: relative;
  z-index: 2;
  transition: transform 180ms ease;
}

.swipe-row.open .card {
  transform: translateX(calc(-1 * var(--slide-width, 92px)));
}

.swipe-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  width: var(--slide-width, 92px);
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 4px;
  padding-left: 4px;
}

.swipe-actions button {
  height: 100%;
  border-radius: 8px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 800;
}

.car-card {
  grid-template-columns: 86px 1fr;
}

.thumb {
  width: 86px;
  height: 72px;
  object-fit: cover;
  background: var(--surface-2);
  border-radius: 8px;
}

.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 30px;
}

.card h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.meta {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.owner-line {
  margin: 0 0 4px;
  color: var(--ink);
  font-size: 13px;
}

.owner-line strong {
  color: var(--brand-dark);
}

.price-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 4px 8px;
  color: var(--brand-dark);
  background: var(--surface-2);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.card-actions {
  display: flex;
  grid-column: 1 / -1;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.car-status-actions {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: 3px;
  margin-right: auto;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 8px;
}

.car-status-block {
  display: grid;
  gap: 4px;
  margin-right: auto;
}

.partner-line {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.partner-line strong {
  color: var(--ink);
}

.car-status-actions button {
  min-height: 36px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}

.car-status-actions button.active {
  color: #fff;
  background: var(--brand);
}

.car-status-actions button.active.sold {
  background: var(--accent);
}

.car-status-actions button.active.cal {
  background: #2563eb;
}

.car-status-actions button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.calculation-content {
  display: grid;
  gap: 8px;
}

.car-detail-content {
  display: grid;
  gap: 12px;
}

.car-detail-photos {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
}

.car-detail-photos img,
.detail-photo-placeholder {
  flex: 0 0 100%;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--surface-2);
  border-radius: 8px;
  scroll-snap-align: start;
}

.detail-photo-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
}

.car-detail-title,
.detail-repair {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.car-detail-title h3,
.car-detail-title p {
  margin: 0;
}

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

.detail-item,
.detail-section {
  padding: 10px;
  background: var(--surface-2);
  border-radius: 8px;
}

.detail-item {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.detail-item span,
.detail-repair small {
  color: var(--muted);
  font-size: 12px;
}

.detail-item strong {
  overflow-wrap: anywhere;
}

.detail-item.positive strong {
  color: var(--brand);
}

.detail-item.negative strong {
  color: var(--danger);
}

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

.detail-section p {
  margin: 0;
  white-space: pre-wrap;
}

.detail-repair span {
  display: grid;
  gap: 2px;
}

.detail-total {
  padding-top: 8px;
  border-top: 2px solid var(--line);
  color: var(--brand-dark);
}

.calculation-row {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  min-height: 42px;
  padding: 8px 10px;
  background: var(--surface-2);
  border-radius: 8px;
}

.calculation-row.total {
  color: #fff;
  background: var(--brand);
}

.calculation-row.profit.negative {
  background: var(--danger);
}

.calculation-repairs {
  display: grid;
  gap: 5px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.payer-group {
  display: grid;
  gap: 5px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.payer-group:last-child {
  border-bottom: 0;
}

.payer-group-title {
  display: flex;
  gap: 10px;
  justify-content: space-between;
  color: var(--brand-dark);
}

.payer-totals {
  display: grid;
  gap: 6px;
  padding: 10px;
  background: var(--surface-2);
  border-radius: 8px;
}

.person-calculation-row {
  display: grid;
  gap: 7px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.person-calculation-row > span {
  color: var(--muted);
  font-size: 13px;
}

.person-calculation-row label {
  display: grid;
  grid-template-columns: 1fr minmax(110px, 42%);
  gap: 8px;
  align-items: center;
}

.person-calculation-row input {
  min-width: 0;
  text-align: right;
}

.earning-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
}

.mini-button {
  min-height: 34px;
  padding: 6px 10px;
  font-size: 12px;
}

.earning-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}

.earning-display strong {
  color: var(--brand-dark);
}

.contact-name-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 8px;
  align-items: center;
}

.contact-name-row .icon-button {
  min-height: 42px;
  font-size: 24px;
}

.primary-button,
.secondary-button,
.danger-button,
.text-button,
.icon-button {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.primary-button {
  padding: 0 14px;
  color: #fff;
  background: var(--brand);
}

.secondary-button {
  padding: 0 14px;
  color: var(--ink);
  background: var(--surface-2);
}

.social-share-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.whatsapp-icon-button,
.facebook-icon-button {
  display: grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  height: 42px;
  padding: 0 8px;
  color: #fff;
  background: #128c4a;
  border: 0;
  border-radius: 8px;
}

.facebook-icon-button {
  color: #fff;
  background: #1877f2;
}

.whatsapp-icon-button svg,
.facebook-icon-button svg,
.whatsapp-detail-logo svg {
  width: 25px;
  height: 25px;
}

.danger-button {
  padding: 0 14px;
  color: #fff;
  background: var(--danger);
}

.whatsapp-detail-item {
  width: 100%;
  color: #fff;
  background: #128c4a;
  border: 0;
  text-align: left;
  cursor: pointer;
}

.whatsapp-detail-logo {
  display: flex;
  align-items: center;
}

.whatsapp-detail-item span,
.whatsapp-detail-item strong {
  color: #fff;
}

.phone-detail-item {
  width: 100%;
  color: #fff;
  background: #1976d2;
  border: 1px solid #0f5da8;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 3px 0 #0d4f91;
  text-align: left;
  cursor: pointer;
}

.phone-detail-item span,
.phone-detail-item strong {
  color: #fff;
}

.text-button {
  padding: 0 6px;
  color: var(--brand);
  background: transparent;
}

.icon-button {
  width: 42px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
}

.tabbar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.95);
  border-top: 1px solid var(--line);
  box-shadow: 0 -12px 30px rgba(22, 32, 29, 0.08);
}

.tab {
  display: grid;
  gap: 2px;
  place-items: center;
  min-height: 54px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 800;
}

.tab span {
  font-size: 12px;
}

.tab.active {
  color: var(--brand);
  background: var(--surface-2);
}

dialog {
  width: min(720px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: 10px;
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(13, 18, 16, 0.45);
}

.dialog-card {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.dialog-head,
.dialog-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

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

.dialog-actions .danger-button {
  margin-right: auto;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-height: min(65dvh, 640px);
  overflow: auto;
  padding-right: 2px;
}

.photo-strip,
.attachment-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.photo-strip img {
  width: 92px;
  height: 70px;
  object-fit: cover;
  border-radius: 8px;
}

.photo-item {
  position: relative;
  flex: 0 0 auto;
}

.photo-remove {
  position: absolute;
  top: 3px;
  right: 3px;
  display: grid;
  place-items: center;
  min-width: 46px;
  width: auto;
  height: 28px;
  padding: 0 8px;
  color: #fff;
  background: rgba(180, 35, 24, 0.92);
  border: 2px solid #fff;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

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

.share-cost-list {
  display: grid;
  gap: 8px;
}

.share-cost-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 132px 72px 54px 72px;
  gap: 8px;
  align-items: center;
}

.repair-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 82px 88px;
  gap: 8px;
  align-items: center;
}

.repair-swipe-row {
  position: relative;
  overflow: hidden;
  border-radius: 8px;
  touch-action: pan-y;
}

.repair-swipe-row .repair-display-row {
  position: relative;
  z-index: 2;
  grid-template-columns: minmax(0, 1fr);
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  transition: transform 180ms ease;
}

.repair-swipe-row.open .repair-display-row {
  transform: translateX(-148px);
}

.repair-swipe-actions {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: 68px 72px;
  gap: 8px;
  align-items: stretch;
  z-index: 1;
}

.repair-swipe-actions button {
  height: 100%;
  border-radius: 8px;
}

.repair-edit-row {
  grid-template-columns: minmax(0, 1fr) 96px minmax(90px, 0.7fr) 132px 72px 54px 72px;
}

.cost-display-row {
  grid-template-columns: 52px minmax(0, 1fr) !important;
}

.cost-tick {
  display: grid;
  place-items: center;
  min-width: 46px;
  width: auto;
  height: 28px;
  padding: 0 8px;
  color: transparent;
  background: transparent;
  border: 2px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.cost-tick.checked {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.cost-check-label {
  display: flex;
  gap: 5px;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.cost-check-label input {
  width: 16px;
  height: 16px;
  accent-color: var(--danger);
}

.repair-word {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.repair-word strong,
.repair-word span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.repair-word span {
  color: var(--muted);
  font-size: 13px;
}

.repair-confirm-button {
  min-width: 0;
  padding-inline: 0;
}

.company-preview {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 10px;
  background: var(--surface-2);
  border-radius: 8px;
}

.company-preview img {
  width: 64px;
  height: 64px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
}

.hidden {
  display: none !important;
}

@media (max-width: 620px) {
  .toolbar {
    align-items: stretch;
  }

  .toolbar input {
    min-width: 0;
  }

  .toolbar .primary-button {
    flex: 0 0 auto;
  }

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

  .repair-row {
    grid-template-columns: minmax(0, 1fr) 76px 84px;
  }

  .repair-swipe-row .repair-display-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .repair-edit-row,
  .share-cost-row {
    grid-template-columns: minmax(0, 1fr) 84px;
  }

  .repair-row [data-repair-payer],
  .repair-row [data-repair-date],
  .share-cost-row [data-share-date],
  .cost-check-label {
    grid-column: 1 / -1;
  }

  .repair-edit-row .repair-confirm-button,
  .repair-edit-row [data-remove-repair] {
    grid-column: auto;
  }

  .share-cost-row {
    grid-template-columns: minmax(0, 1fr) 84px;
  }

  .share-cost-edit-row .repair-confirm-button,
  .share-cost-edit-row [data-remove-share] {
    grid-column: auto;
  }
}

@media (min-width: 760px) {
  .summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.checkbox-line {
  display: flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-weight: 800;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.attachment-item {
  position: relative;
  flex: 0 0 auto;
}

.attachment-tile {
  display: grid;
  gap: 5px;
  width: 108px;
  min-height: 96px;
  padding: 6px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
}

.attachment-tile img {
  width: 100%;
  height: 68px;
  object-fit: cover;
  border-radius: 6px;
}

.attachment-tile.pdf span {
  display: grid;
  place-items: center;
  height: 68px;
  color: #fff;
  background: var(--danger);
  border-radius: 6px;
  font-weight: 900;
}

.attachment-tile strong {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.detail-attachment-strip {
  margin-top: 8px;
}

.detail-photo-button {
  flex: 0 0 100%;
  padding: 0;
  background: transparent;
  border: 0;
  scroll-snap-align: start;
}

.detail-photo-button img {
  width: 100%;
}

.attachment-dialog-card {
  width: min(720px, 96vw);
}

.attachment-viewer {
  display: grid;
  gap: 10px;
  place-items: center;
  min-height: 50vh;
  background: var(--surface-2);
  border-radius: 10px;
  overflow: hidden;
}

.attachment-viewer img,
.attachment-viewer iframe {
  width: 100%;
  max-height: 70vh;
  object-fit: contain;
  border: 0;
}

.attachment-viewer iframe {
  min-height: 70vh;
}
