:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --text: #1d2424;
  --muted: #5d6665;
  --line: #dcdbd3;
  --accent: #1f5f5b;
  --accent_text: #ffffff;
  --accent_soft: #e0efec;
  --danger: #a32d2d;
  --danger_soft: #fbeaea;
  --warning: #7a4d07;
  --warning_soft: #faefd9;
  --success: #27600f;
  --success_soft: #e8f3df;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141918;
    --surface: #1e2524;
    --text: #edf0ef;
    --muted: #a3adab;
    --line: #363f3d;
    --accent: #6cc2b8;
    --accent_text: #0e1f1d;
    --accent_soft: #1d3633;
    --danger: #f19a9a;
    --danger_soft: #3c1f1f;
    --warning: #edbf72;
    --warning_soft: #3a2c13;
    --success: #a7d78a;
    --success_soft: #22331a;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans CJK TC", sans-serif;
}

body.has_tabs { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }

a { color: var(--accent); }
h1 { font-size: 1.4rem; line-height: 1.25; margin: 0 0 .5rem; }
h2 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; }
p { margin: 0 0 1rem; }

.top_bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 6px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.brand { color: var(--text); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.top_link { padding: 8px 0; white-space: nowrap; font-size: .95rem; }
.page { width: 100%; max-width: 640px; margin: 0 auto; padding: 16px; }

.card {
  padding: 14px;
  margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.card_link { display: block; color: inherit; text-decoration: none; }
.stack > * + * { margin-top: 8px; }
.list { list-style: none; margin: 16px 0; padding: 0; }
.row_between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row_between > :first-child { min-width: 0; }
.row_wrap { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.wrap_anywhere { overflow-wrap: anywhere; }
.pre_line { white-space: pre-line; overflow-wrap: anywhere; }

label { display: block; font-weight: 500; font-size: .95rem; }

input:not([type="checkbox"], [type="radio"]), select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
}

input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
textarea { min-height: 88px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.check_row { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 400; }
.field_row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field_row > div { min-width: 0; }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 16px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.button_primary { color: var(--accent_text); background: var(--accent); border-color: var(--accent); }
.button_danger { color: var(--danger); border-color: var(--danger); }
.button_small { min-height: 40px; padding: 4px 12px; font-size: .9rem; white-space: nowrap; }
.button_wide { width: 100%; }

.notice { padding: 10px 12px; border-radius: 8px; overflow-wrap: anywhere; }
.notice_error { color: var(--danger); background: var(--danger_soft); }
.notice_warning { color: var(--warning); background: var(--warning_soft); }
.notice_success { color: var(--success); background: var(--success_soft); }

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 500;
  white-space: nowrap;
}

.badge_confirmed, .badge_good { color: var(--success); background: var(--success_soft); }
.badge_to_book, .badge_warn { color: var(--warning); background: var(--warning_soft); }
.badge_suggestion, .badge_neutral { color: var(--muted); background: var(--bg); border: 1px solid var(--line); }
.badge_bad { color: var(--danger); background: var(--danger_soft); }

.sign_in { padding-top: 12vh; }
.dev_login { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--line); }
.dev_login > * + * { margin-top: 8px; }

.tabs {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.tabs a {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 4px;
  color: var(--muted);
  font-size: .85rem;
  text-align: center;
  text-decoration: none;
}

.tabs a[aria-current="page"] { color: var(--accent); font-weight: 600; box-shadow: inset 0 3px 0 var(--accent); }

.day_heading { margin: 22px 0 8px; font-size: 1rem; }
.item_time { font-variant-numeric: tabular-nums; font-weight: 600; }

.segments { display: flex; gap: 6px; flex-wrap: wrap; margin: 12px 0; }
.segments a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 4px 12px;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: .9rem;
  text-decoration: none;
}
.segments a[aria-current="true"] { color: var(--accent_text); background: var(--accent); border-color: var(--accent); }

.table_scroll { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
th, td { padding: 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child, td:first-child { position: sticky; left: 0; text-align: left; background: var(--surface); }
tr:last-child td { border-bottom: 0; font-weight: 600; }

.split_row { display: grid; grid-template-columns: minmax(0, 1fr) 110px; align-items: center; gap: 10px; }
.plain_fieldset { margin: 12px 0 0; padding: 0; border: 0; }
.plain_fieldset legend { padding: 0; font-weight: 500; font-size: .95rem; }
.is_hidden { display: none !important; }
.amount_positive { color: var(--success); }
.amount_negative { color: var(--danger); }
.action_bar { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0 16px; }
