:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --bg: #f5f7fa;
  --text: #1a1a1a;
  --muted: #666;
  --border: #dde3ea;
  --error: #b91c1c;
  --error-bg: #fee2e2;
  --warn: #b45309;
  --warn-bg: #fef3c7;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  padding-bottom: 24px;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
}

header.app-header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

header.app-header h1 {
  font-size: 17px;
  margin: 0;
}

header.app-header a { color: var(--muted); font-size: 14px; text-decoration: none; }

h2 { font-size: 18px; margin-top: 0; }

.card {
  background: white;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 4px;
  margin-top: 12px;
}

input, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 16px;
  background: white;
}

.row2 { display: flex; gap: 10px; }
.row2 > div { flex: 1; }

button, .btn {
  display: block;
  width: 100%;
  padding: 13px;
  border: none;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  font-size: 16px;
  font-weight: 600;
  margin-top: 16px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
}

button:active, .btn:active { background: var(--blue-dark); }
button:disabled { background: #a9c2f0; }

.btn-secondary {
  background: white;
  color: var(--blue);
  border: 1px solid var(--blue);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 15px;
}
.checkbox-row input { width: auto; }

table { width: 100%; border-collapse: collapse; margin-top: 10px; }
th, td { padding: 8px 6px; border-bottom: 1px solid var(--border); font-size: 14px; text-align: left; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.num, th.num { text-align: right; }

.total-line {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 15px;
}
.total-line.grand { font-size: 20px; font-weight: 700; border-top: 2px solid var(--text); padding-top: 12px; margin-top: 6px; }

.banner-error {
  background: var(--error-bg);
  color: var(--error);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 12px;
}
.banner-warn {
  background: var(--warn-bg);
  color: var(--warn);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 12px;
}

.empty-state { text-align: center; color: var(--muted); padding: 40px 20px; }

.history-item {
  display: block;
  background: white;
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 10px;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}
.history-item .hist-title { font-weight: 600; }
.history-item .hist-meta { color: var(--muted); font-size: 13px; margin-top: 4px; }

.loading { text-align: center; padding: 30px; color: var(--muted); }

nav.tabbar {
  display: flex;
  background: white;
  border-top: 1px solid var(--border);
  position: fixed;
  bottom: 0; left: 0; right: 0;
}
nav.tabbar a {
  flex: 1;
  text-align: center;
  padding: 10px 0 8px;
  text-decoration: none;
  color: var(--muted);
  font-size: 12px;
}
nav.tabbar a.active { color: var(--blue); font-weight: 600; }
