:root {
  --brand: #00b16b;
  --brand-dark: #00925a;
  --brand-light: #e5f8ef;
  --accent: #e2883f;
  --danger: #b3261e;
  --danger-bg: #fff0ef;
  --text: #222;
  --text-sub: #888;
  --border: #ddd;
  --neutral-bg: #e5e9e0;
  --radius-card: 16px;
  --radius-pill: 999px;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  overflow-x: hidden;
  font-family: -apple-system, "Hiragino Sans", "Yu Gothic", sans-serif;
  background: #f4f6f2;
  color: var(--text);
  line-height: 1.5;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: env(safe-area-inset-top, 0px) 16px 0 16px;
  background: var(--brand-dark);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.app-header .app-logo {
  color: #fff;
  text-decoration: none;
  font-size: 1rem;
  font-weight: bold;
  letter-spacing: 0.12em;
}

.container {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
}

h1 {
  font-size: 1.4rem;
}

.card {
  background: #fff;
  border-radius: var(--radius-card);
  padding: 16px;
  margin-bottom: 16px;
  overflow-wrap: break-word;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

label {
  display: block;
  margin-bottom: 12px;
  font-size: 0.9rem;
  color: #444;
}

input, textarea, select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 12px;
  font-size: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

button {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  padding: 14px;
  font-size: 1.05rem;
  font-weight: bold;
  color: #fff;
  background: var(--brand);
  border: none;
  border-radius: var(--radius-pill);
  margin-top: 8px;
}

button:active {
  background: var(--brand-dark);
}

button.secondary {
  background: #fff;
  color: var(--brand);
  font-weight: bold;
  border: 1px solid var(--brand);
}

button.delete-btn {
  background: var(--danger-bg);
  color: var(--danger);
}

.tabbar {
  display: flex;
  flex-wrap: nowrap;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
  gap: 8px;
  margin: 0 -16px 16px;
  padding: 4px 16px 8px;
  background: #f4f6f2;
  -webkit-mask-image: linear-gradient(to right, black calc(100% - 28px), transparent);
  mask-image: linear-gradient(to right, black calc(100% - 28px), transparent);
}

/* サイト全体のナビ(_nav.html)だけをスティッキーにする。
   グループ内サブタブ等はここに重ねて固定されると隠れてしまうため対象外。 */
.tabbar-sticky {
  position: sticky;
  top: calc(48px + env(safe-area-inset-top, 0px));
  z-index: 10;
}

.tabbar a, .tabbar button {
  flex: 0 0 auto;
  min-width: 70px;
}

.tabbar a, .tabbar button {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  background: #fff;
  color: var(--text);
  font-weight: normal;
  font-size: 0.85rem;
  margin-top: 0;
  border: 1px solid var(--border);
  white-space: nowrap;
}

.tabbar a:active, .tabbar button:not(.tab-active):active {
  background: var(--neutral-bg);
}

.tabbar button.tab-active {
  background: var(--brand);
  color: #fff;
  font-weight: bold;
  border-color: var(--brand);
}

.comments {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #eee;
}

.comment-form {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.comment-form input {
  flex: 1;
  margin-top: 0;
}

.comment-form button {
  width: auto;
  margin-top: 0;
}

.message {
  font-size: 0.9rem;
  color: var(--danger);
  min-height: 1.2em;
}

.hidden {
  display: none;
}

.badge {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 7px;
  font-size: 0.75rem;
  font-weight: bold;
  color: #fff;
  background: var(--danger);
  border-radius: var(--radius-pill);
}

.notification-list, .member-list, .post-list, .message-list {
  list-style: none;
  padding: 0;
}

.notification-list li, .member-list li, .post-list li {
  background: #fff;
  border-radius: var(--radius-card);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  overflow-wrap: break-word;
}

.notification-list li.unread {
  border-left: 4px solid var(--brand);
}

.message-list li {
  background: #fff;
  border-radius: var(--radius-card);
  padding: 10px 12px;
  margin-bottom: 8px;
  overflow-wrap: break-word;
}

.message-list li .author {
  font-weight: bold;
  font-size: 0.85rem;
  color: var(--brand);
}

.sub {
  font-size: 0.8rem;
  color: var(--text-sub);
}

.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.bar-row {
  display: grid;
  grid-template-columns: 90px 1fr 40px;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.bar-track {
  background: var(--neutral-bg);
  border-radius: 6px;
  height: 14px;
  overflow: hidden;
}

.bar-fill {
  background: var(--brand);
  height: 100%;
  border-radius: 6px 0 0 6px;
}

.bar-row .bar-count {
  text-align: right;
  color: #666;
}

.log-list {
  list-style: none;
  padding: 0;
}

.log-list li {
  background: #fff;
  border-radius: var(--radius-card);
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  overflow-wrap: break-word;
}

.app-header .app-help {
  margin-left: auto;
  padding: 4px 12px;
  color: #fff;
  font-size: 0.8rem;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius-pill);
}

.help h2 {
  margin-top: 0;
  padding-bottom: 6px;
  font-size: 1.1rem;
  border-bottom: 2px solid var(--brand-light);
}

.help h3 {
  margin: 16px 0 4px;
  font-size: 0.95rem;
  color: var(--brand-dark);
}

.help section[id] {
  scroll-margin-top: calc(56px + env(safe-area-inset-top, 0px));
}

.help ol, .help ul {
  padding-left: 1.4em;
}

.help li {
  margin-bottom: 6px;
}

.help .toc {
  columns: 1;
  margin: 0;
}

.help .toc a {
  color: var(--brand-dark);
}

.help .note, .help .warn {
  margin: 12px 0;
  padding: 10px 12px;
  font-size: 0.9rem;
  border-radius: 8px;
}

.help .note {
  background: var(--brand-light);
}

.help .warn {
  background: var(--danger-bg);
  color: var(--danger);
}

.help .table-wrap {
  overflow-x: auto;
}

.help table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.help th, .help td {
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  border: 1px solid var(--border);
}

.help th {
  background: var(--brand-light);
  white-space: nowrap;
}

.help code {
  padding: 1px 5px;
  font-size: 0.85em;
  background: var(--neutral-bg);
  border-radius: 4px;
}
