/* 家計のわきドコロ PWA（家計簿インターフェースApp ベースデザイン） */
:root {
  --bg: #F8F5F2;
  --surface: #FFFFFF;
  --surface-muted: #F3EFEA;
  --mauve: #8C8790;
  --mauve-dark: #716C75;
  --sage: #D9E3DD;
  --sage-border: #B4C8BC;
  --sage-ink: #384B41;
  --border: #E4DFDA;
  --border-strong: #D0D0D0;
  --text: #333333;
  --text-muted: #827D86;
  --error: #B85C5C;
  --warn: #B5894A;
  --radius-sm: 10px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
  touch-action: manipulation;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

.app {
  width: 100%;
  max-width: 430px;
  height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: calc(env(safe-area-inset-bottom) + clamp(8px, 2dvh, 20px));
  background: var(--bg);
  overflow: hidden;
  position: relative;
}

/* iOS 26+ スタンドアロンPWAの強制上部ぼかし無効化対策 */
.ios-blur-fix {
  display: none;
}

@media (display-mode: standalone) {
  .ios-blur-fix {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 11px;
    z-index: 2147483647;
    pointer-events: none;
    background-color: var(--bg);
    -webkit-background-clip: text;
    background-clip: text;
  }
}

/* Header */
.header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: clamp(6px, 1dvh, 10px) 14px clamp(4px, 0.7dvh, 7px);
  background: var(--bg);
}

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

.brand-mark {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--sage-ink);
}

.brand-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #2B282E;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.status-pill {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.status-dot {
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--text-muted);
}

.status-pill.ok { background: var(--sage); border-color: transparent; color: var(--sage-ink); }
.status-pill.ok .status-dot { background: var(--sage-ink); }
.status-pill.syncing { color: var(--warn); border-color: rgba(181, 137, 74, 0.4); }
.status-pill.syncing .status-dot { background: var(--warn); }
.status-pill.error { color: var(--error); border-color: rgba(184, 92, 92, 0.45); }
.status-pill.error .status-dot { background: var(--error); }

.header-btn {
  flex-shrink: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.header-btn:active { background: var(--surface-muted); }

.header-btn-dot {
  display: none;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--error);
}

.header-btn.has-alert .header-btn-dot { display: inline-block; }

.icon-btn {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-btn:active { background: var(--surface-muted); }

/* Edit mode banner */
.edit-banner {
  flex-shrink: 0;
  margin: 0 16px clamp(4px, 0.7dvh, 7px);
  padding: 6px 10px 6px 12px;
  border-radius: var(--radius-sm);
  background: var(--sage);
  border: 1px solid var(--sage-border);
  color: var(--sage-ink);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.edit-banner-text {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.edit-cancel-btn {
  flex-shrink: 0;
  border: 1px solid rgba(56, 75, 65, 0.28);
  background: rgba(255, 255, 255, 0.78);
  color: var(--sage-ink);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  cursor: pointer;
}

.edit-cancel-btn:active { background: #FFFFFF; }
.edit-cancel-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.app.is-editing .amount-card { border-color: var(--sage-border); }
.app.is-editing .key.submit { background: var(--sage-ink); border-color: var(--sage-ink); }
.app.is-editing .key.submit:active { background: #2A3931; }

/* Owner switcher (かぬ / まぬ / 家計クレカ) */
.mode-wrap {
  flex-shrink: 0;
  padding: clamp(2px, 0.5dvh, 5px) 16px clamp(5px, 0.9dvh, 9px);
}

.segment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 3px;
}

.segment.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.segment button {
  min-width: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: clamp(12px, 1.5dvh, 13px);
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: clamp(6px, 0.9dvh, 9px) 2px;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.16s ease;
}

.segment button.active {
  background: var(--mauve);
  color: #FFFFFF;
}

/* Main stack */
.main {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 2px 16px clamp(6px, 1dvh, 10px);
  gap: clamp(8px, 1.3dvh, 12px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.main > * { flex-shrink: 0; }

/* Amount card */
.amount-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: clamp(9px, 1.4dvh, 14px) 16px;
}

.amount-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.micro-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.calc-preview {
  font-family: "Roboto", sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: var(--mauve-dark);
  font-variant-numeric: tabular-nums;
}

.sheet-target {
  border: none;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--sage-ink);
  background: var(--sage);
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.sheet-target.warn {
  color: var(--error);
  background: rgba(184, 92, 92, 0.14);
}

.amount-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  min-height: clamp(34px, 4.5dvh, 42px);
  overflow: hidden;
}

.amount-sign {
  flex-shrink: 0;
  font-family: "Roboto", sans-serif;
  font-size: clamp(22px, 3.1dvh, 28px);
  font-weight: 700;
  color: var(--error);
  margin-right: 1px;
}

.currency {
  flex-shrink: 0;
  font-family: "Roboto", sans-serif;
  font-size: clamp(16px, 2.1dvh, 19px);
  font-weight: 500;
  color: var(--text-muted);
  align-self: flex-end;
  margin-bottom: 4px;
}

.amount-value {
  font-family: "Roboto", -apple-system, sans-serif;
  font-size: clamp(28px, 4dvh, 36px);
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.amount-value.size-md { font-size: clamp(21px, 2.9dvh, 26px); }
.amount-value.size-sm { font-size: clamp(17px, 2.3dvh, 20px); }
.amount-value.empty { color: var(--border-strong); }
.amount-value.negative { color: var(--error); }

.amount-cursor {
  flex-shrink: 0;
  display: inline-block;
  width: 2px;
  height: clamp(24px, 3.4dvh, 30px);
  border-radius: 1px;
  background: var(--mauve);
  margin-left: 2px;
  animation: caret-blink 1.05s steps(1, end) infinite;
}

@keyframes caret-blink {
  0%, 50% { opacity: 1; }
  50.01%, 100% { opacity: 0; }
}

/* Option blocks (かぬカード選択 / 立替え / まぬ支払方法) */
.option-block {
  display: flex;
  flex-direction: column;
  gap: clamp(6px, 0.9dvh, 9px);
}

.option-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px;
}

.option-status {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.option-status.active {
  color: var(--sage-ink);
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(6px, 0.9dvh, 8px);
}

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

.chip-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.chip {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: clamp(9px, 1.25dvh, 12px) 6px;
  font-size: clamp(12.5px, 1.55dvh, 13.5px);
  font-weight: 600;
  font-family: inherit;
  text-align: center;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.08s ease;
}

.chip:active { transform: scale(0.97); }
.chip.selected {
  background: var(--sage);
  border-color: var(--sage-border);
  color: var(--sage-ink);
  font-weight: 700;
}

/* 立替えトグルボタン */
.advance-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: clamp(9px, 1.2dvh, 12px) 13px;
  border-radius: var(--radius-sm);
  border: 1.5px dashed var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s ease;
}

.advance-btn:active { transform: scale(0.985); }

.advance-left {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.advance-check {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg);
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.advance-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.advance-hint {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.advance-btn.active {
  border-style: solid;
  border-color: var(--sage-ink);
  background: var(--sage);
  color: var(--sage-ink);
}

.advance-btn.active .advance-check {
  background: var(--sage-ink);
  border-color: var(--sage-ink);
  color: #FFFFFF;
}

.advance-btn.active .advance-hint {
  color: var(--sage-ink);
}

/* Date & Comment inputs */
.meta-stack { display: flex; flex-direction: column; gap: clamp(6px, 0.85dvh, 9px); }
.meta-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.meta-row.date-comment { grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.38fr); }

.control {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  height: clamp(38px, 4.9dvh, 44px);
  padding: 0 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  display: block;
  overflow: hidden;
}

input[type="date"].control { padding: 0 9px; line-height: calc(clamp(38px, 4.9dvh, 44px) - 2px); text-align: left; font-size: 14px; }
input[type="date"].control::-webkit-date-and-time-value { text-align: left; margin: 0; }
.control:focus { border-color: var(--mauve); }
.control::placeholder { color: #ACA7B0; font-size: 13px; }

/* Keypad */
.keypad-wrap {
  flex-shrink: 0;
  margin: clamp(6px, 1.2dvh, 14px) 14px 0;
  padding: clamp(8px, 1.2dvh, 12px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
}

.keypad {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(5px, 0.8dvh, 8px);
}

.key {
  width: 100%;
  min-width: 0;
  height: clamp(40px, 5.4dvh, 49px);
  padding: 0;
  margin: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: "Roboto", "Noto Sans JP", sans-serif;
  font-size: clamp(18px, 2.3dvh, 21px);
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-appearance: none;
  appearance: none;
  transition: background 0.1s ease, transform 0.06s ease;
}

.key:active { transform: scale(0.96); background: var(--surface-muted); }
.key.sub { font-size: clamp(13px, 1.7dvh, 15px); color: var(--text-muted); }
.key.op {
  background: var(--surface-muted);
  border-color: var(--border);
  color: var(--text);
  font-size: clamp(18px, 2.3dvh, 20px);
  font-weight: 700;
}
.key.eq {
  background: var(--sage);
  border-color: #C3D4CA;
  color: var(--sage-ink);
  font-size: clamp(18px, 2.3dvh, 20px);
  font-weight: 700;
}
.key.submit {
  grid-column: 1 / -1;
  height: clamp(42px, 5.6dvh, 50px);
  margin-top: clamp(2px, 0.5dvh, 5px);
  background: var(--mauve);
  border-color: var(--mauve);
  color: #FFFFFF;
  font-family: "Noto Sans JP", sans-serif;
  font-size: clamp(14px, 1.75dvh, 15px);
  font-weight: 700;
  letter-spacing: 0.08em;
}
.key.submit:active { background: var(--mauve-dark); }
.key.submit:disabled { opacity: 0.38; cursor: not-allowed; }
.key.submit.is-advance {
  background: var(--sage-ink);
  border-color: var(--sage-ink);
}
.key.submit.is-advance:active { background: #2A3931; }

/* Lock Overlay */
.setup-overlay {
  position: absolute;
  inset: 0;
  background: var(--bg);
  z-index: 40;
  display: none;
  flex-direction: column;
  padding: 24px 20px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.setup-overlay.open { display: flex; }

.setup-card {
  margin: auto 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 26px 20px;
  text-align: center;
}

.setup-logo {
  width: 54px;
  height: 54px;
  margin: 0 auto 12px;
  display: block;
  border-radius: 13px;
}

.setup-title {
  font-size: 17px;
  font-weight: 700;
  margin: 0 0 8px;
  letter-spacing: 0.04em;
}

.setup-desc {
  font-size: 12px;
  line-height: 1.7;
  color: var(--text-muted);
  margin: 0 0 18px;
}

/* Toast */
.toast {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 12px);
  left: 50%;
  transform: translateX(-50%) translateY(-16px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  max-width: calc(100vw - 32px);
  text-align: center;
  line-height: 1.45;
  background: #333333;
  color: #FFFFFF;
  padding: 9px 16px;
  border-radius: 18px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  box-shadow: 0 8px 24px rgba(51, 51, 51, 0.16);
  transition: transform 0.2s ease, opacity 0.2s ease, visibility 0.2s ease;
  z-index: 100;
}

.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(51, 51, 51, 0.36);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 50;
}

.modal-backdrop.open { display: flex; }

.modal {
  width: 100%;
  max-width: 430px;
  max-height: 85dvh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 18px 18px calc(env(safe-area-inset-bottom) + 20px);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}

.modal-title { font-size: 15px; font-weight: 700; margin: 0; letter-spacing: 0.04em; }

.modal-desc {
  font-size: 13px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin: 0 0 14px;
}

.info-box {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 12px;
  font-size: 12px;
}

.info-box-label { font-size: 11px; color: var(--text-muted); margin-bottom: 3px; }
.info-box-value { font-weight: 700; word-break: break-all; }

.sheet-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.sheet-mini-chip {
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.sheet-mini-chip.latest {
  background: var(--sage);
  border-color: var(--sage-border);
  color: var(--sage-ink);
}

/* Create next sheet card inside Menu */
.create-sheet-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 13px;
}

.create-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.create-sheet-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}

.create-sheet-desc {
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 0 11px;
}

.btn-stack { display: flex; flex-direction: column; gap: 8px; }

.btn {
  flex: 1;
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.btn:active { opacity: 0.88; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn.primary { background: var(--mauve); border-color: var(--mauve); color: #FFFFFF; }
.btn.danger { color: var(--error); border-color: rgba(184, 92, 92, 0.35); background: #FFFFFF; }

/* History */
.history-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin: -6px 0 10px;
}

.failed-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.failed-actions .btn.danger {
  flex: 0 0 auto;
  width: auto;
  white-space: nowrap;
}

.inline-confirm-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 11px;
  margin-bottom: 10px;
  border-radius: var(--radius-sm);
  background: rgba(184, 92, 92, 0.09);
  border: 1px solid rgba(184, 92, 92, 0.35);
}

.inline-confirm-bar.sage {
  margin-bottom: 0;
  background: var(--sage);
  border-color: var(--sage-border);
}

.inline-confirm-bar.sage .inline-confirm-text {
  color: var(--sage-ink);
}

.inline-confirm-text {
  font-size: 11px;
  font-weight: 700;
  color: var(--error);
  line-height: 1.45;
}

.inline-confirm-btns {
  flex-shrink: 0;
  display: flex;
  gap: 6px;
}

.history-list { display: flex; flex-direction: column; gap: 7px; }
.history-item {
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 12px;
  overflow: hidden;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.history-item.expanded {
  border-color: var(--mauve);
  background: var(--surface);
}
.history-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.history-row:active { background: rgba(140, 135, 144, 0.08); }
.history-info { min-width: 0; flex: 1; }
.history-title-row {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}
.history-title {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-amount-wrap { flex-shrink: 0; text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.history-badge-row { display: inline-flex; align-items: center; gap: 4px; margin-top: 2px; }
.history-chevron {
  color: var(--text-muted);
  transition: transform 0.15s ease;
  display: inline-flex;
  align-items: center;
}
.history-item.expanded .history-chevron { transform: rotate(180deg); color: var(--mauve-dark); }

.history-actions {
  border-top: 1px solid var(--border);
  padding: 8px 12px 10px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.history-action-row { display: flex; gap: 8px; }
.history-note { font-size: 11px; color: var(--text-muted); line-height: 1.5; }
.history-confirm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.btn-mini {
  flex: 1;
  min-width: 0;
  padding: 7px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
}
.btn-mini:active { background: var(--surface-muted); }
.btn-mini:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-mini.primary { background: var(--mauve); border-color: var(--mauve); color: #FFFFFF; }
.btn-mini.primary:active { background: var(--mauve-dark); }
.btn-mini.danger { color: var(--error); border-color: rgba(184, 92, 92, 0.4); background: #FFFFFF; }
.btn-mini.danger-solid { background: var(--error); border-color: var(--error); color: #FFFFFF; }
.inline-confirm-btns .btn-mini { flex: 0 0 auto; padding: 6px 10px; font-size: 11px; }

.badge { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 999px; display: inline-block; flex-shrink: 0; }
.badge.sent { background: var(--sage); color: var(--sage-ink); }
.badge.pending { background: rgba(181, 137, 74, 0.16); color: var(--warn); }
.badge.failed { background: rgba(184, 92, 92, 0.16); color: var(--error); }
.badge.advance { background: var(--sage); color: var(--sage-ink); border: 1px solid var(--sage-border); }
