:root {
  color-scheme: dark;
  --bg: #101214;
  --panel: #191d21;
  --panel-strong: #20262b;
  --line: #333a42;
  --text: #eef2f5;
  --muted: #9da8b3;
  --accent: #16a34a;
  --accent-strong: #4ade80;
  --accent-soft: rgba(22, 163, 74, 0.16);
  --accent-mid: rgba(22, 163, 74, 0.34);
  --danger: #ff3b30;
  --danger-bg: #ff3b30;
  --on-accent: #ffffff;
  --body-glow: rgba(22, 163, 74, 0.14);
  --body-start: #101214;
  --body-mid: #111b16;
  --body-end: #0b1410;
  --input-bg: #111519;
  --panel-rgb: 25, 29, 33;
  --secondary-hover: #1c2b22;
  --card-bg: #15191d;
  --empty-bg: rgba(255, 255, 255, 0.02);
  --modal-backdrop: rgba(5, 7, 9, 0.72);
  --step-bg: #12161a;
  --range-bg: #12161a;
  --range-summary-bg: #111b15;
  --calendar-day-bg: #171c20;
  --calendar-day-hover: #172b20;
  --calendar-outside-bg: #111519;
  --calendar-outside-text: #66707a;
  --today-border: #238246;
  --star-bg: #3a3012;
  --star-border: #b9972f;
  --purchased-text: #747b83;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.35);
  font-family: "Yu Gothic UI", "Yu Gothic", "Meiryo", system-ui, sans-serif;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #ffffff;
  --panel: #ffffff;
  --panel-strong: #f3f4f6;
  --line: #d6dbe1;
  --text: #1f2328;
  --muted: #68707a;
  --accent: #16a34a;
  --accent-strong: #15803d;
  --accent-soft: rgba(22, 163, 74, 0.13);
  --accent-mid: rgba(22, 163, 74, 0.24);
  --danger: #ff3b30;
  --danger-bg: #ff3b30;
  --on-accent: #ffffff;
  --body-glow: transparent;
  --body-start: #ffffff;
  --body-mid: #ffffff;
  --body-end: #ffffff;
  --input-bg: #ffffff;
  --panel-rgb: 255, 255, 255;
  --secondary-hover: #e9edf2;
  --card-bg: #ffffff;
  --empty-bg: rgba(22, 163, 74, 0.04);
  --modal-backdrop: rgba(31, 35, 40, 0.38);
  --step-bg: #f7f8fa;
  --range-bg: #f7f8fa;
  --range-summary-bg: #ffffff;
  --calendar-day-bg: #ffffff;
  --calendar-day-hover: #edfdf3;
  --calendar-outside-bg: #f4faf6;
  --calendar-outside-text: #98aa9f;
  --today-border: #93d3a8;
  --star-bg: #fff3b0;
  --star-border: #d6a900;
  --purchased-text: #8d8585;
  --shadow: 0 18px 50px rgba(31, 35, 40, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top left, var(--body-glow), transparent 34%),
    linear-gradient(135deg, var(--body-start) 0%, var(--body-mid) 52%, var(--body-end) 100%);
  color: var(--text);
}

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

button {
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 16px;
  cursor: pointer;
  color: var(--on-accent);
  background: var(--accent);
  font-weight: 700;
}

button:hover {
  background: var(--accent-strong);
}

button.secondary {
  color: var(--text);
  background: var(--panel-strong);
  border-color: var(--line);
}

button.secondary:hover {
  background: var(--secondary-hover);
}

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

button.danger:hover {
  background: #d92d20;
  border-color: #d92d20;
}

button[data-delete],
button[data-delete-schedule],
button[data-delete-item],
button[data-delete-gourmet],
button[data-delete-sightseeing],
button[data-delete-budget-flight],
button[data-delete-budget-award],
button[data-delete-budget-memo],
button[data-delete-category],
button[data-delete-category-items],
button[data-delete-uncategorized-items] {
  color: #fff;
  background: var(--danger-bg);
  border-color: var(--danger);
}

button[data-delete]:hover,
button[data-delete-schedule]:hover,
button[data-delete-item]:hover,
button[data-delete-gourmet]:hover,
button[data-delete-sightseeing]:hover,
button[data-delete-budget-flight]:hover,
button[data-delete-budget-award]:hover,
button[data-delete-budget-memo]:hover,
button[data-delete-category]:hover,
button[data-delete-category-items]:hover,
button[data-delete-uncategorized-items]:hover {
  color: #fff;
  background: #d92d20;
  border-color: #d92d20;
}

button.ghost {
  min-height: 34px;
  padding: 0 10px;
  color: var(--muted);
  background: transparent;
  border-color: var(--line);
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

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

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
}

.app-shell {
  width: min(1120px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 26px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

button.icon-button {
  width: 42px;
  min-height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  font-size: 20px;
}

.brand {
  display: grid;
  gap: 4px;
}

.brand h1,
.panel h2,
.auth-panel h1 {
  margin: 0;
  letter-spacing: 0;
}

.brand h1 {
  font-size: 28px;
}

.brand p,
.empty p,
.helper,
.trip-meta {
  margin: 0;
  color: var(--muted);
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-panel,
.panel {
  background: rgba(var(--panel-rgb), 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-panel {
  width: min(440px, 100%);
  padding: 28px;
}

.auth-panel form,
.wizard-body,
.form-grid {
  display: grid;
  gap: 18px;
}

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

.panel {
  padding: 22px;
}

.dashboard {
  display: grid;
  gap: 18px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 18px;
}

.trip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.trip-card {
  display: grid;
  gap: 14px;
  min-height: 168px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-bg);
}

.trip-card h3 {
  margin: 0;
  font-size: 20px;
  overflow-wrap: anywhere;
}

.trip-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.trip-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-self: end;
}

.trip-actions button {
  min-width: 0;
  padding: 0 10px;
}

.empty {
  display: grid;
  gap: 12px;
  justify-items: start;
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--empty-bg);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: var(--modal-backdrop);
}

.modal {
  width: min(640px, 100%);
  max-height: calc(100vh - 36px);
  overflow: auto;
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin: 18px 0 22px;
}

.step-pill {
  min-height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--step-bg);
  font-size: 14px;
}

.step-pill.active {
  color: var(--on-accent);
  border-color: var(--accent);
  background: var(--accent);
  font-weight: 800;
}

.stat-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.stat {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--step-bg);
}

.stat strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  color: var(--text);
}

.modal-actions,
.auth-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.message {
  min-height: 22px;
  color: var(--danger);
}

.hidden {
  display: none;
}

.trip-workspace {
  display: grid;
  gap: 18px;
}

.workspace-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.workspace-head h2 {
  margin: 0;
}

.detail-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

button.detail-tab {
  min-height: 40px;
  color: var(--text);
  background: var(--panel-strong);
  border-color: var(--line);
}

button.detail-tab:hover {
  background: var(--secondary-hover);
}

button.detail-tab.active {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent-strong);
}

.wireframe-panel {
  display: grid;
  gap: 16px;
  min-height: 320px;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--empty-bg);
}

.wireframe-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wireframe-title h3 {
  margin: 0;
  font-size: 22px;
}

.wireframe-title span {
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: var(--panel-strong);
  font-size: 13px;
}

.wireframe-panel p {
  margin: 0;
  color: var(--muted);
}

.wireframe-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  grid-template-rows: 96px 96px;
  gap: 12px;
}

.wireframe-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--panel-strong), transparent);
}

.wireframe-grid div:first-child {
  grid-row: span 2;
}

.schedule-board {
  display: grid;
  gap: 16px;
}

.schedule-toolbar {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 12px;
}

.schedule-toolbar-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.schedule-toolbar h3 {
  margin: 0;
  text-align: center;
}

.schedule-toolbar .helper {
  text-align: center;
}

.schedule-mode-toggle {
  min-width: 92px;
  white-space: nowrap;
}

.summary-board {
  display: grid;
  gap: 12px;
}

.summary-head h3 {
  margin: 0;
}

.summary-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.summary-table {
  width: 100%;
  min-width: 960px;
  table-layout: fixed;
  border-collapse: collapse;
  background: var(--card-bg);
}

.summary-col-day {
  width: 5%;
}

.summary-col-date {
  width: 9%;
}

.summary-col-location {
  width: 30%;
}

.summary-col-temperature {
  width: 10%;
}

.summary-col-remarks {
  width: 20%;
}

.summary-col-hotel {
  width: 20%;
}

.summary-col-booking {
  width: 5%;
}

.summary-table th,
.summary-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.summary-table th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  background: var(--panel-strong);
}

.summary-table td {
  color: var(--text);
}

.budget-flight-table {
  min-width: 0;
}

.budget-flight-table .summary-editable-cell {
  min-width: 0;
}

.budget-flight-table th,
.budget-flight-table td {
  padding-left: 6px;
  padding-right: 6px;
}

.budget-flight-table th:nth-child(1),
.budget-flight-table td:nth-child(1) {
  width: 20%;
}

.budget-flight-table th:nth-child(2),
.budget-flight-table td:nth-child(2) {
  width: 16%;
}

.budget-flight-table th:nth-child(3),
.budget-flight-table td:nth-child(3),
.budget-flight-table th:nth-child(4),
.budget-flight-table td:nth-child(4) {
  width: 7%;
}

.budget-flight-table th:nth-child(5),
.budget-flight-table td:nth-child(5) {
  width: 10%;
}

.budget-flight-table th:nth-child(6),
.budget-flight-table td:nth-child(6) {
  width: 18%;
}

.budget-flight-table th:nth-child(7),
.budget-flight-table td:nth-child(7) {
  width: 18%;
}

.budget-award-table th:nth-child(1),
.budget-award-table td:nth-child(1) {
  width: 15%;
}

.budget-award-table th:nth-child(5),
.budget-award-table td:nth-child(5),
.budget-award-table th:nth-child(6),
.budget-award-table td:nth-child(6) {
  width: 15%;
}

.budget-award-table th:nth-child(7),
.budget-award-table td:nth-child(7) {
  width: 20%;
}

.budget-flight-delete-head,
.budget-flight-delete-cell {
  width: 4%;
  text-align: right;
}

.budget-flight-delete-cell {
  padding-right: 8px;
}

.budget-memo-table th:nth-child(1),
.budget-memo-table td:nth-child(1),
.budget-memo-table th:nth-child(2),
.budget-memo-table td:nth-child(2),
.budget-memo-table th:nth-child(4),
.budget-memo-table td:nth-child(4),
.budget-memo-table th:nth-child(5),
.budget-memo-table td:nth-child(5) {
  width: 21%;
}

.budget-memo-table th:nth-child(3),
.budget-memo-table td:nth-child(3) {
  width: 10%;
}

.budget-memo-table th:nth-child(6),
.budget-memo-table td:nth-child(6) {
  width: 4%;
}

.am-calculator-section {
  margin-top: 16px;
}

.am-calculator-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.am-calculator-fields {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.am-calculator-label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.85rem;
  color: var(--muted);
}

.am-calculator-input {
  width: 150px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--input-bg, var(--bg));
  color: var(--text);
  font-size: 0.9rem;
}

.am-calculator-output-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.am-calculator-output-label {
  font-size: 0.8rem;
  color: var(--muted);
}

.am-calculator-output-value {
  font-size: 1rem;
  font-weight: 600;
}

.am-value-invalid {
  text-decoration: line-through;
  color: var(--muted);
}

.am-calculator-warning {
  color: var(--danger, #ef4444);
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0;
}

.summary-table .day-saturday {
  color: #60a5fa;
  font-weight: 800;
}

.summary-table .day-sunday {
  color: #ef4444;
  font-weight: 800;
}

.summary-editable-cell {
  min-width: 140px;
  padding: 0;
}

.summary-editable-cell {
  cursor: text;
}

.summary-editable-cell:hover {
  background: var(--secondary-hover);
}

.summary-cell-text {
  display: block;
  min-height: 1.35em;
}

.summary-inline-form {
  margin: 0;
}

.summary-inline-input {
  width: 100%;
  min-height: 38px;
  border-radius: 0;
  border: 0;
  background: var(--input-bg);
}

.schedule-day-toolbar {
  grid-template-columns: 1fr;
}

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

.schedule-column {
  min-height: 420px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-bg);
}

.schedule-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.schedule-column-head h4 {
  margin: 0;
  font-size: 17px;
}

.schedule-day-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.schedule-day-title {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.schedule-day-title .day-saturday {
  color: #60a5fa;
}

.schedule-day-title .day-sunday {
  color: #ef4444;
}

.holiday-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.holiday-toggle input {
  width: auto;
  min-height: 0;
  padding: 0;
}

.schedule-items {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 320px;
}

.schedule-day-section {
  min-height: auto;
}

.schedule-day-items {
  min-height: 0;
}

.schedule-empty {
  margin: 0;
  min-height: 96px;
  display: grid;
  place-items: center;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--empty-bg);
}

.schedule-card {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px solid var(--line);
  border-left-width: 7px;
  border-radius: 8px;
  background: var(--panel);
  font-size: 1em;
}

.schedule-column.edit-mode .schedule-card {
  cursor: grab;
}

.schedule-column.read-mode .schedule-card {
  cursor: default;
}

.schedule-column.read-mode .schedule-items {
  gap: 3px;
}

.schedule-column.read-mode .schedule-card {
  padding: 6px;
}

.schedule-card.dragging {
  opacity: 0.55;
}

.schedule-card.drop-before,
.schedule-card.drop-after {
  position: relative;
}

.schedule-card.drop-before::before,
.schedule-card.drop-after::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  height: 4px;
  border-radius: 999px;
  background: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.schedule-card.drop-before::before {
  top: -8px;
}

.schedule-card.drop-after::after {
  bottom: -8px;
}

.schedule-items.drop-empty {
  outline: 3px solid var(--accent-strong);
  outline-offset: -3px;
  border-radius: 8px;
}

.schedule-card-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 4px;
}

.schedule-card strong,
.schedule-card p {
  margin: 0;
  overflow-wrap: anywhere;
}

.schedule-card-title,
.transport-route {
  font-size: 1em;
  line-height: 1.35;
}

.schedule-card p {
  color: var(--muted);
  font-size: 1em;
}

.schedule-memo strong {
  color: inherit;
  font-weight: 800;
}

.memo-red {
  color: #ef4444;
}

.schedule-card a {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--accent-strong);
  font-weight: 800;
  text-decoration: none;
}

.schedule-link-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.schedule-card a:hover {
  text-decoration: underline;
}

.schedule-day-card {
  gap: 10px;
}

.schedule-day-row {
  display: grid;
  grid-template-columns: 16fr 59fr 16fr 9fr;
  gap: 12px;
  align-items: start;
}

.schedule-day-main {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.schedule-day-time,
.schedule-day-cost,
.schedule-day-reserved {
  color: var(--muted);
  font-size: 1em;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.schedule-day-time {
  color: var(--text);
  font-size: 1em;
  font-weight: 500;
}

.schedule-day-cost,
.schedule-day-reserved {
  padding-top: 1px;
}

.transport-route {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-weight: 800;
}

.transport-line-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 10px;
  border-radius: 999px;
  box-shadow: inset 0 0 0 1px rgba(17, 17, 17, 0.18);
}

.type-action {
  border-left-color: #ff79bd;
  background: linear-gradient(90deg, rgba(255, 121, 189, 0.18), var(--panel) 38%);
}

.type-sightseeing {
  border-left-color: #22d3ee;
  background: linear-gradient(90deg, rgba(34, 211, 238, 0.16), var(--panel) 38%);
}

.type-gourmet {
  border-left-color: #fbbf24;
  background: linear-gradient(90deg, rgba(251, 191, 36, 0.2), var(--panel) 38%);
}

.type-limited {
  border-left-color: #fff200;
  background: linear-gradient(90deg, rgba(255, 242, 0, 0.2), var(--panel) 38%);
}

.type-driving {
  border-left-color: #22c55e;
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.18), var(--panel) 38%);
}

.type-transport {
  border-left-color: #9ca3af;
  background: linear-gradient(90deg, rgba(156, 163, 175, 0.18), var(--panel) 38%);
}

.type-hotel {
  border-left-color: #a78bfa;
  background: linear-gradient(90deg, rgba(167, 139, 250, 0.18), var(--panel) 38%);
}

.schedule-day-card.type-action {
  background: rgba(255, 121, 189, 0.18);
}

.schedule-day-card.type-sightseeing {
  background: rgba(34, 211, 238, 0.18);
}

.schedule-day-card.type-gourmet {
  background: rgba(251, 191, 36, 0.18);
}

.schedule-day-card.type-limited {
  background: rgba(255, 242, 0, 0.18);
}

.schedule-day-card.type-driving {
  background: rgba(34, 197, 94, 0.18);
}

.schedule-day-card.type-transport {
  background: rgba(156, 163, 175, 0.18);
}

.schedule-day-card.type-hotel {
  background: rgba(167, 139, 250, 0.18);
}

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

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

.schedule-modal-head h2 {
  margin: 0;
}

.schedule-modal label {
  position: relative;
}

.schedule-modal .wide-field,
.local-time-row {
  grid-column: 1 / -1;
}

.import-mode-options {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.json-field textarea {
  min-height: 260px;
  font-family: Consolas, "Courier New", monospace;
  line-height: 1.4;
}

.local-time-row {
  display: flex;
  gap: 18px;
}

.color-field {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.color-field input[type="color"] {
  height: 42px;
  padding: 4px;
}

.station-pair-row {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px minmax(0, 1fr);
  gap: 10px;
  align-items: end;
}

.station-swap-button {
  width: 42px;
  min-height: 42px;
  padding: 0;
}

.romaji-suggestions {
  position: absolute;
  z-index: 20;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  display: grid;
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

button.romaji-suggestion {
  width: 100%;
  min-height: 0;
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  color: var(--text);
  background: transparent;
  border-color: transparent;
  text-align: left;
}

button.romaji-suggestion:hover,
button.romaji-suggestion.active {
  color: var(--text);
  background: var(--secondary-hover);
}

button.romaji-suggestion.active {
  border-color: var(--accent);
}

.romaji-suggestion span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.shopping-board {
  display: grid;
  gap: 18px;
}

.gourmet-board {
  display: grid;
  gap: 16px;
}

.gourmet-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: stretch;
}

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

.gourmet-form {
  margin: 0;
}

.gourmet-list {
  display: grid;
  gap: 8px;
  min-height: 56px;
}

.gourmet-empty {
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--empty-bg);
}

.gourmet-item {
  display: grid;
  grid-template-columns: 40px 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.gourmet-item.dragging {
  opacity: 0.55;
}

.gourmet-item.drop-before,
.gourmet-item.drop-after,
.shopping-item.drop-before,
.shopping-item.drop-after {
  position: relative;
}

.gourmet-item.drop-before::before,
.gourmet-item.drop-after::after,
.shopping-item.drop-before::before,
.shopping-item.drop-after::after {
  content: "";
  position: absolute;
  left: 8px;
  right: 8px;
  height: 4px;
  border-radius: 999px;
  background: var(--accent-strong);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.gourmet-item.drop-before::before,
.shopping-item.drop-before::before {
  top: -8px;
}

.gourmet-item.drop-after::after,
.shopping-item.drop-after::after {
  bottom: -8px;
}

.gourmet-list.drop-empty,
.shopping-items.drop-empty {
  outline: 3px solid var(--accent-strong);
  outline-offset: -3px;
  border-radius: 8px;
}

.gourmet-item.done {
  opacity: 0.78;
}

.gourmet-item.done .gourmet-item-main,
.gourmet-item.done .gourmet-item-main * {
  color: var(--purchased-text);
}

.gourmet-item.done .gourmet-item-text {
  text-decoration: line-through;
}

.gourmet-item-main {
  min-width: 0;
}

.gourmet-item-text {
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  color: var(--text);
  background: transparent;
  text-align: left;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.gourmet-item-text:hover {
  color: var(--accent-strong);
  background: transparent;
}

.gourmet-inline-form {
  margin: 0;
}

.gourmet-inline-form input {
  min-height: 36px;
  padding: 7px 9px;
  font-weight: 800;
}

.shopping-tools {
  display: grid;
  gap: 12px;
}

.compact-form,
.item-form {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--empty-bg);
}

.compact-form {
  grid-template-columns: minmax(180px, 1fr) auto;
}

.category-tools-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.category-tools-row .compact-form {
  flex: 1;
}

.item-form {
  grid-template-columns: 1.2fr 1fr 1fr minmax(160px, 0.8fr) auto;
  align-items: center;
}

.check-label,
.item-check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.check-label input,
.item-check input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.shopping-groups {
  display: grid;
  gap: 14px;
}

.shopping-group {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card-bg);
}

.shopping-group.dragging,
.shopping-item.dragging {
  opacity: 0.55;
}

.shopping-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.shopping-group-head h3 {
  margin: 0;
  font-size: 18px;
}

.shopping-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drag-handle {
  cursor: grab;
}

.shopping-items {
  display: grid;
  gap: 8px;
  min-height: 48px;
}

.shopping-empty {
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--empty-bg);
}

.shopping-item {
  display: grid;
  grid-template-columns: 40px 28px minmax(0, 1fr) minmax(150px, 0.32fr) 40px 32px 32px;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.shopping-item.purchased {
  opacity: 0.72;
}

.shopping-item.starred-item {
  border-color: var(--star-border);
  background: var(--star-bg);
}

.shopping-item.purchased,
.shopping-item.purchased .shopping-item-main,
.shopping-item.purchased .shopping-item-main *,
.shopping-item.purchased .item-name,
.shopping-item.purchased a,
.shopping-item.purchased p,
.shopping-item.purchased em {
  color: var(--purchased-text);
}

.shopping-item.purchased .item-name {
  text-decoration: line-through;
}

.shopping-item-main {
  min-width: 0;
  display: grid;
  gap: 7px;
}

.item-name {
  width: fit-content;
  min-height: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  text-align: left;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.item-name:hover {
  color: var(--accent-strong);
  background: transparent;
}

.item-name.starred {
  font-weight: 900;
}

.inline-name-form {
  margin: 0;
}

.inline-name-form input {
  min-height: 36px;
  padding: 7px 9px;
  font-weight: 800;
}

.shopping-item-main strong,
.shopping-meta-row {
  overflow-wrap: anywhere;
}

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

.shopping-meta-row span {
  color: var(--muted);
  font-size: 12px;
}

.shopping-meta-row a,
.shopping-meta-row p,
.shopping-meta-row em {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.shopping-meta-row a {
  color: var(--accent-strong);
}

.shopping-meta-row em {
  font-style: normal;
}

button.mini-icon {
  width: 32px;
  min-height: 32px;
  padding: 0;
}

.item-category-select {
  min-height: 38px;
  padding: 7px 9px;
}

button.star-button {
  width: 40px;
  min-height: 40px;
  padding: 0;
  color: var(--muted);
}

button.star-button.active {
  color: var(--accent-strong);
  border-color: var(--accent);
  background: var(--accent-soft);
}

.range-picker {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--range-bg);
}

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

.range-summary div {
  min-height: 70px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--range-summary-bg);
}

.range-summary span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 13px;
}

.range-summary strong {
  display: block;
  color: var(--text);
  font-size: 16px;
  overflow-wrap: anywhere;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: 42px 1fr 42px;
  align-items: center;
  gap: 8px;
}

.calendar-title {
  text-align: center;
  color: var(--text);
  font-weight: 800;
}

button.calendar-nav {
  width: 42px;
  min-height: 42px;
  padding: 0;
  color: var(--text);
  font-size: 24px;
}

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

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

.calendar-month h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 16px;
  text-align: center;
}

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

.calendar-weekdays {
  margin-bottom: 6px;
}

.calendar-weekdays span {
  min-height: 24px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}

button.calendar-day {
  width: 100%;
  min-height: 38px;
  padding: 0;
  border-color: transparent;
  color: var(--text);
  background: var(--calendar-day-bg);
  font-weight: 700;
}

button.calendar-day:hover {
  border-color: var(--accent);
  background: var(--calendar-day-hover);
}

button.calendar-day.outside {
  color: var(--calendar-outside-text);
  background: var(--calendar-outside-bg);
}

button.calendar-day.today {
  border-color: var(--today-border);
}

button.calendar-day.in-range {
  color: var(--text);
  background: var(--accent-soft);
  border-color: transparent;
}

button.calendar-day.range-start,
button.calendar-day.range-end {
  color: var(--on-accent);
  background: var(--accent);
  border-color: var(--accent-strong);
}

@media (max-width: 680px) {
  .app-shell {
    width: min(100vw - 20px, 1120px);
    padding-top: 18px;
  }

  .topbar,
  .section-head,
  .workspace-head,
  .wireframe-title,
  .modal-actions,
  .auth-actions,
  .topbar-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .range-summary,
  .calendar-months,
  .stat-strip,
  .trip-actions,
  .wireframe-grid,
  .schedule-modal .form-grid {
    grid-template-columns: 1fr;
  }

  .schedule-day-card {
    font-size: 0.82em;
  }

  .schedule-day-row {
    grid-template-columns: 16fr 59fr 16fr 9fr;
    gap: 6px;
  }

  .schedule-toolbar-title {
    flex-direction: column;
    gap: 8px;
  }

  .station-pair-row {
    grid-template-columns: 1fr;
  }

  .station-swap-button {
    justify-self: start;
  }

  .wireframe-grid {
    grid-template-rows: repeat(3, 86px);
  }

  .wireframe-grid div:first-child {
    grid-row: auto;
  }

  .compact-form,
  .item-form,
  .gourmet-tools,
  .gourmet-item,
  .shopping-item {
    grid-template-columns: 1fr;
  }

  .shopping-group-head,
  .shopping-actions {
    align-items: stretch;
    flex-direction: column;
  }

  button:not(.calendar-day):not(.calendar-nav):not(.go-top-button) {
    width: 100%;
  }

  .holiday-toggle input {
    width: auto;
  }
}

.budget-page {
  display: grid;
  gap: 16px;
}

.budget-section {
  display: grid;
  gap: 16px;
  padding: 20px 24px;
}

.budget-section h3 {
  margin: 0;
  font-size: 18px;
}

.budget-section h4 {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.budget-currency-summary {
  display: grid;
  gap: 10px;
}

.budget-flight-summary-narrow {
  width: 40%;
}

.budget-flight-summary-narrow .summary-scroll {
  overflow-x: visible;
}

.budget-flight-summary-narrow .summary-table {
  min-width: 0;
  width: 100%;
}

.budget-detail-table {
  min-width: 480px;
}

.budget-detail-table th:nth-child(1) { width: 30%; }
.budget-detail-table th:nth-child(2) { width: 50%; }
.budget-detail-table th:nth-child(3) { width: 20%; }

.go-top-button {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

button.go-top-button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  aspect-ratio: 1;
  flex: 0 0 auto;
}

.go-top-button.visible {
  opacity: 0.85;
  pointer-events: auto;
}

.go-top-button:hover {
  opacity: 1;
}
