/* 元のCSSをそのまま記述（省略せず全く同じものを入れてください） */
:root {
  --color-primary: #3b82f6;
  --color-primary-hover: #2563eb;
  --color-danger: #ef4444;
  --color-success: #10b981;
  --color-bg-light: #f1f5f9;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --text-main: #1e293b;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  --font-size-xs: 0.75rem;
  --font-size-sm: 0.875rem;
  --font-size-base: 1rem;
  --font-size-lg: 1.125rem;
  --font-size-xl: 1.25rem;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 9999px;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.08);
}
body {
  background-color: var(--color-bg-light);
  color: var(--text-main);
  font-family: sans-serif;
  padding: env(safe-area-inset-top) 10px 10px;
  font-size: var(--font-size-base);
  line-height: 1.5;
}
.card-shell {
  position: relative;
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 500px;
  margin: 10px auto;
  padding: 24px;
  min-height: 450px;
}
.header-nav {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 16px;
}
.menu-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-light);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: 0.2s;
}
.menu-btn:hover,
.menu-btn:focus {
  background: var(--color-bg-light);
  color: var(--text-main);
  outline: none;
}
.view-section {
  display: none;
}
.view-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.form-control,
.form-select {
  font-size: var(--font-size-base) !important;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  padding: 12px 16px;
  box-shadow: none;
  transition: 0.2s;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.form-label {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
}
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}
.nav-tabs {
  background-color: var(--color-bg-light);
  padding: 2px;
  border-radius: var(--radius-sm);
  display: flex;
  margin-bottom: 20px;
  border: none;
  width: fit-content;
  margin-left: 0;
  margin-right: auto;
}
.nav-item {
  list-style: none;
  flex: none;
}
.nav-link {
  color: var(--text-muted);
  border: none !important;
  font-weight: 700;
  font-size: var(--font-size-sm);
  padding: 4px 16px;
  border-radius: var(--radius-sm);
  transition: 0.2s;
  background: transparent;
  min-width: 60px;
}
.nav-link.active {
  color: var(--text-main) !important;
  background: var(--color-surface) !important;
  box-shadow: var(--shadow-sm);
}
.attr-group {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 16px;
  border-left: 6px solid var(--color-border);
  box-shadow: var(--shadow-sm);
}
.attr-title {
  font-size: var(--font-size-xs);
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.tile-label {
  width: 100%;
  font-size: var(--font-size-sm);
  font-weight: 600;
  padding: 12px 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--text-main);
  text-align: center;
  cursor: pointer;
  transition: 0.2s;
  user-select: none;
}
.btn-check:checked + .tile-label {
  background-color: var(--color-primary);
  color: var(--color-surface);
  border-color: var(--color-primary);
  box-shadow: 0 4px 10px rgba(59, 130, 246, 0.3);
}
.ext-toggle-area {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  background: var(--color-bg-light);
  padding: 10px 16px;
  border-radius: var(--radius-md);
}
.ext-item {
  display: none !important;
}
.show-extensions .ext-item {
  display: block !important;
}
.reg-ext-item {
  display: none !important;
}
.show-reg-extensions .reg-ext-item {
  display: block !important;
}
.reg-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-bottom: 12px;
  transition: 0.2s;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.reg-card:active {
  transform: scale(0.98);
  background: var(--color-bg-light);
}
.reg-card-title {
  font-size: var(--font-size-base);
  color: var(--text-main);
}
.reg-card-amount {
  font-size: var(--font-size-lg);
  font-weight: 700;
  color: var(--text-main);
}
.details {
  font-size: var(--font-size-sm);
  color: var(--text-muted);
  margin-top: 8px;
  line-height: 1.5;
}
.btn-custom {
  padding: 14px 20px;
  font-weight: 700;
  border-radius: var(--radius-lg);
  font-size: var(--font-size-base);
  transition: 0.2s;
  border: none;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
}
.btn-custom:active {
  transform: translateY(2px);
}
.btn-custom:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}
.btn-primary-custom {
  background: var(--text-main);
  color: var(--color-surface);
}
.btn-primary-custom:hover {
  background: #000;
  color: var(--color-surface);
}
.btn-outline-custom {
  background: transparent;
  border: 2px solid var(--color-border);
  color: var(--text-main);
}
.btn-outline-custom:hover {
  background: var(--color-bg-light);
  border-color: var(--text-muted);
}
.btn-danger-custom {
  background: var(--color-danger);
  color: var(--color-surface);
}
.btn-outline-danger-custom {
  background: transparent;
  border: 2px solid var(--color-danger);
  color: var(--color-danger);
}
.btn-success-custom {
  background: var(--color-success);
  color: var(--color-surface);
}
.fab {
  position: absolute;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: var(--radius-pill);
  background: var(--text-main);
  color: var(--color-surface);
  border: none;
  font-size: 2rem;
  font-weight: 300;
  box-shadow: var(--shadow-md);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: 0.2s;
}
.fab:active {
  transform: scale(0.9);
  box-shadow: var(--shadow-sm);
}
.modal-content {
  border-radius: var(--radius-xl);
  border: none;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 24px 24px 16px;
}
.modal-body {
  padding: 0 24px;
}
.modal-footer {
  padding: 16px 24px 24px;
}
.modal-title {
  font-size: var(--font-size-lg);
  font-weight: 700;
}
.master-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.master-table th,
.master-table td {
  font-size: var(--font-size-sm);
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.master-table th {
  background: var(--color-bg-light);
  color: var(--text-muted);
  font-weight: 700;
}
.master-table tr:last-child td {
  border-bottom: none;
}
.master-table tr.dragging {
  opacity: 0.5;
}
.master-table tr.drag-over-before td {
  box-shadow: inset 0 3px 0 var(--color-primary);
}
.master-table tr.drag-over-after td {
  box-shadow: inset 0 -3px 0 var(--color-primary);
}
.drag-handle {
  cursor: grab;
  color: var(--text-light);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
  font-weight: 700;
  font-size: var(--font-size-lg);
  line-height: 1;
}
.master-action-btn {
  padding: 8px 10px;
  font-size: var(--font-size-sm);
  border-radius: var(--radius-sm);
}
.master-tab-btn {
  cursor: grab;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  -webkit-user-select: none;
}
.master-tab-btn.dragging {
  opacity: 0.5;
}
.nav-item.drag-over-before .master-tab-btn {
  box-shadow: inset 3px 0 0 var(--color-primary);
}
.nav-item.drag-over-after .master-tab-btn {
  box-shadow: inset -3px 0 0 var(--color-primary);
}
.master-tab-handle {
  font-size: var(--font-size-sm);
  color: var(--text-light);
  line-height: 1;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}
.master-sort-hint {
  font-size: var(--font-size-xs);
  color: var(--text-muted);
  background: var(--color-bg-light);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  margin: -8px 0 12px;
}
.entry-date-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}
.entry-date-nav-btn {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--text-muted);
  border-radius: var(--radius-pill);
  width: 36px;
  height: 36px;
  line-height: 1;
  font-size: var(--font-size-base);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.entry-date-nav-btn:hover {
  background: var(--color-bg-light);
  color: var(--text-main);
}
.entry-date-arrow {
  width: 0;
  height: 0;
  display: inline-block;
}
.entry-date-arrow.prev {
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-right: 9px solid currentColor;
  margin-left: -2px;
}
.entry-date-arrow.next {
  border-top: 6px solid transparent;
  border-bottom: 6px solid transparent;
  border-left: 9px solid currentColor;
  margin-right: -2px;
}
.entry-date-display {
  border: 1px solid var(--color-border);
  background: var(--color-bg-light);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  font-size: var(--font-size-sm);
  font-weight: 700;
}
.entry-date-picker {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.color-input-wrap {
  position: relative;
}
