:root {
  --green: #1c5b34;
  --green-dark: #10391f;
  --orange: #e07a1f;
  --bg: #f5f4ef;
  --card: #ffffff;
  --border: #ddd8cc;
  --text: #222;
  --muted: #6b6a63;
  --danger: #b3261e;
}

* { box-sizing: border-box; }

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

a { color: var(--green); }

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

header.topbar h1 {
  font-size: 1.1rem;
  margin: 0;
  font-weight: 700;
}

header.topbar button.logout {
  background: transparent;
  border: 1px solid rgba(255,255,255,0.5);
  color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
}

main {
  padding: 12px;
  max-width: 720px;
  margin: 0 auto;
}

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

.progress-bar {
  height: 8px;
  background: #e6e3d7;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 6px;
}
.progress-bar > div {
  height: 100%;
  background: var(--orange);
}

.rank-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.rank-header h2 { font-size: 1rem; margin: 0; }
.rank-header .count { font-size: 0.8rem; color: var(--muted); }

.req-list { margin-top: 10px; display: none; }
.req-list.open { display: block; }

.req-item {
  border-top: 1px solid var(--border);
  padding: 10px 0;
}
.req-item .req-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.req-item input[type=checkbox] {
  width: 22px;
  height: 22px;
  margin-top: 2px;
  flex-shrink: 0;
  accent-color: var(--green);
}
.req-item .req-text { flex: 1; font-size: 0.92rem; }
.req-item .req-code { font-weight: 700; color: var(--green-dark); margin-right: 4px; }
.req-item .req-section { font-size: 0.72rem; text-transform: uppercase; color: var(--muted); letter-spacing: 0.03em; }

.signoff-fields {
  display: none;
  margin-top: 8px;
  margin-left: 32px;
  padding: 10px;
  background: #faf9f4;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.signoff-fields.open { display: grid; gap: 6px; grid-template-columns: 1fr 1fr; }
.signoff-fields label { font-size: 0.72rem; color: var(--muted); display: block; margin-bottom: 2px; }
.signoff-fields input, .signoff-fields select, .signoff-fields textarea {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.85rem;
  font-family: inherit;
}
.signoff-fields .full { grid-column: 1 / -1; }

nav.bottom {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  background: white;
  border-top: 1px solid var(--border);
  z-index: 10;
}
nav.bottom button {
  flex: 1;
  border: none;
  background: none;
  padding: 10px 4px 8px;
  font-size: 0.72rem;
  color: var(--muted);
}
nav.bottom button.active { color: var(--green); font-weight: 700; }

.login-wrap {
  max-width: 380px;
  margin: 15vh auto;
  padding: 20px;
}
.login-wrap h1 { color: var(--green); text-align: center; }
.login-wrap .card input {
  width: 100%;
  padding: 10px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 1rem;
}
.login-wrap button.primary {
  width: 100%;
  padding: 10px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 6px;
  font-size: 1rem;
  font-weight: 600;
}
.error { color: var(--danger); font-size: 0.85rem; margin-top: 6px; }

.badge-row {
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid var(--border);
  padding: 8px 0;
}
.badge-row .name { flex: 1; font-size: 0.92rem; }
.badge-row .name small { display: block; color: var(--muted); font-size: 0.7rem; }
.badge-row .arrows { display: flex; flex-direction: column; gap: 2px; }
.badge-row .arrows button {
  border: 1px solid var(--border);
  background: white;
  border-radius: 4px;
  font-size: 0.7rem;
  padding: 1px 5px;
}
.eagle-check {
  width: 20px; height: 20px; accent-color: var(--orange);
}
.tag {
  font-size: 0.65rem;
  padding: 2px 6px;
  border-radius: 10px;
  background: #eee;
  color: var(--muted);
}
.tag.eagle { background: #fdecd2; color: var(--orange); font-weight: 700; }

.search-box { position: relative; margin-bottom: 10px; }
.search-box input { width: 100%; padding: 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem; }
.search-results {
  position: absolute;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  width: 100%;
  max-height: 260px;
  overflow-y: auto;
  z-index: 5;
  box-shadow: 0 4px 10px rgba(0,0,0,0.08);
}
.search-results .item { padding: 8px 10px; border-bottom: 1px solid var(--border); font-size: 0.9rem; cursor: pointer; }
.search-results .item:hover { background: #f5f4ef; }

button.link {
  background: none; border: none; color: var(--green); font-size: 0.82rem; padding: 4px 0; text-decoration: underline;
}
button.small {
  border: 1px solid var(--border); background: white; border-radius: 6px; padding: 4px 8px; font-size: 0.78rem;
}
button.danger { color: var(--danger); border-color: var(--danger); }

.hint { font-size: 0.78rem; color: var(--muted); }
h3.section-heading { font-size: 0.8rem; text-transform: uppercase; color: var(--muted); margin: 14px 0 4px; letter-spacing: 0.04em; }
