:root {
  color: #18221c;
  background: #f3f7f4;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

.card {
  width: min(100%, 480px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 36px 24px 48px;
  background: #ffffff;
}

header {
  margin-bottom: 28px;
}

.brand {
  margin: 0 0 8px;
  color: #18794e;
  font-weight: 800;
}

h1 {
  margin: 0 0 10px;
  font-size: 2rem;
}

header p:last-child,
.help,
.empty-state p {
  color: #536159;
  line-height: 1.5;
}

header p:last-child {
  margin: 0;
}

form,
label {
  display: grid;
  gap: 10px;
}

form {
  gap: 22px;
}

label {
  font-weight: 700;
}

input,
button,
.link-button {
  min-height: 54px;
  border-radius: 10px;
  font: inherit;
}

input {
  width: 100%;
  padding: 12px 14px;
  border: 2px solid #c9d2cc;
  background: #ffffff;
}

input:focus {
  border-color: #18794e;
  outline: 3px solid #ccebdc;
}

button,
.link-button {
  border: 0;
  padding: 12px 18px;
  font-weight: 800;
  cursor: pointer;
}

.primary {
  color: #ffffff;
  background: #18794e;
}

.secondary {
  width: 100%;
  color: #12633f;
  background: #e3f3ea;
}

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

.check-row input {
  width: 24px;
  min-height: 24px;
  accent-color: #18794e;
}

.help,
.error {
  min-height: 1.5em;
  margin: -16px 0 0;
}

.error {
  color: #b42318;
}

.link-button {
  display: grid;
  place-items: center;
  margin-top: 18px;
  border: 2px solid #18794e;
  color: #12633f;
  text-decoration: none;
}

.text-link {
  display: block;
  margin-top: 24px;
  color: #12633f;
  text-align: center;
  font-weight: 700;
}

.empty-state {
  margin-bottom: 28px;
  padding: 24px;
  border-radius: 12px;
  background: #f3f7f4;
}

.empty-state h2,
.empty-state p {
  margin: 0;
}

.empty-state p {
  margin-top: 8px;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.terms-consent {
  padding: 20px;
  border: 1px solid #d9e3dc;
  border-radius: 12px;
  background: #f8fbf9;
}

.terms-consent h2 {
  margin: 0 0 16px;
  font-size: 1.05rem;
}

.terms-all {
  display: flex;
  align-items: center;
  gap: 9px;
}

.terms-all {
  padding-bottom: 14px;
  border-bottom: 1px solid #d9e3dc;
}

.terms-all input,
.term-row input {
  width: 22px;
  min-height: 22px;
  accent-color: #18794e;
}

.term-row {
  display: grid;
  align-items: center;
  padding-top: 14px;
  gap: 8px;
  grid-template-columns: 22px minmax(0, 1fr);
}

.term-title-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  min-height: 38px;
  padding: 4px 2px;
  color: #12633f;
  background: transparent;
  text-align: left;
  white-space: nowrap;
}

.term-title-button b {
  margin-left: 6px;
  font-size: 1.3rem;
}

.terms-message {
  margin: 12px 0 0;
  color: #536159;
  font-size: 0.85rem;
}

.terms-dialog {
  width: min(720px, calc(100% - 24px));
  height: min(82vh, 820px);
  padding: 0;
  border: 0;
  border-radius: 16px;
}

.terms-dialog::backdrop { background: rgba(20, 34, 26, 0.55); }
.terms-dialog-header { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid #d9e3dc; }
.terms-dialog-header h2 { margin: 0; font-size: 1.1rem; }
.terms-dialog-header button { min-height: 40px; padding: 4px 12px; font-size: 1.4rem; }
.terms-dialog pre { height: calc(100% - 77px); margin: 0; padding: 22px; overflow: auto; font: inherit; line-height: 1.7; white-space: pre-wrap; }

/* Logged-in mobile application shell */
[hidden] { display: none !important; }
.app-body { background: #f1f5f2; color: #17221b; }
.app-shell { width: min(100%, 540px); min-height: 100vh; margin: 0 auto; background: #fff; box-shadow: 0 0 36px rgba(23, 63, 42, .08); }
.app-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; height: 64px; margin: 0; padding: max(10px, env(safe-area-inset-top)) 22px 10px; border-bottom: 1px solid #e7ece8; background: rgba(255,255,255,.96); }
.app-header .brand { margin: 0; font-size: 1.15rem; }
.header-action { width: 42px; min-height: 42px; padding: 0; border-radius: 50%; color: #18794e; background: #edf7f1; font-size: .55rem; }
.app-content { min-height: calc(100vh - 144px); padding: 26px 20px calc(112px + env(safe-area-inset-bottom)); outline: none; }
.app-view { animation: view-in .18s ease-out; }
@keyframes view-in { from { opacity: .4; transform: translateY(4px); } }
.page-heading { margin-bottom: 24px; }
.page-heading h1 { margin-bottom: 8px; font-size: 1.65rem; letter-spacing: -.04em; }
.page-heading p:last-child { margin: 0; color: #617068; line-height: 1.5; }
.page-heading-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; }
.eyebrow { margin: 0 0 7px; color: #18794e; font-size: .78rem; font-weight: 800; }
.summary-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.summary-card { min-width: 0; padding: 20px; border: 1px solid #e0e8e2; border-radius: 18px; background: #fff; box-shadow: 0 6px 20px rgba(27,69,45,.06); }
.summary-card-wide { display: flex; align-items: center; justify-content: space-between; grid-column: 1 / -1; background: linear-gradient(135deg, #ecf8f1, #f8fcfa); }
.summary-card h2 { margin: 7px 0 10px; font-size: 1.18rem; }
.card-label { margin: 0; color: #617068; font-size: .82rem; font-weight: 700; }
.card-symbol { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 18px; color: #18794e; background: #d9efe3; font-size: .72rem; font-weight: 800; }
.status-badge { display: inline-flex; align-items: center; min-height: 28px; padding: 3px 10px; border-radius: 999px; font-size: .75rem; font-weight: 800; }
.status-active { color: #12633f; background: #dcefe4; }
.metric { display: flex; align-items: baseline; gap: 4px; margin: 10px 0 5px; }
.metric strong { color: #12633f; font-size: 1.8rem; line-height: 1; }
.metric span, .attention { color: #617068; font-size: .78rem; }
.attention { margin: 0; }
.attention strong { color: #c65d24; }
.text-action, .section-link { min-height: 40px; padding: 6px 0; color: #12633f; background: transparent; font-size: .78rem; text-align: left; }
.content-section { margin-top: 32px; }
.content-section > h2, .section-heading h2, .year-section > h2 { margin: 0; font-size: 1.08rem; }
.section-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.section-link { padding-inline: 8px; }
.compact-list, .certificate-list, .education-list { display: grid; gap: 10px; }
.compact-item, .education-item { display: grid; grid-template-columns: 40px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 15px 14px; border: 1px solid #e3e9e5; border-radius: 15px; }
.compact-item h3, .education-item h3, .certificate-card h3 { margin: 0 0 5px; font-size: .92rem; }
.compact-item p, .education-item p, .certificate-card p, .certificate-card time { margin: 0; color: #68756d; font-size: .75rem; }
.status-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; font-weight: 900; }
.status-mark-completed { color: #12633f; background: #dcefe4; }
.status-mark-needed, .status-mark-incomplete { color: #a94c1d; background: #fff0e3; }
.status-text { font-size: .72rem; font-weight: 800; white-space: nowrap; }
.status-text.completed { color: #18794e; }
.status-text.needed, .status-text.incomplete { color: #b45120; }
.compact-button { width: auto; min-height: 46px; padding: 10px 14px; font-size: .82rem; white-space: nowrap; }
.year-section { margin-top: 24px; }
.year-section > h2 { margin-bottom: 13px; }
.certificate-card { display: grid; grid-template-columns: 46px minmax(0,1fr); gap: 13px; padding: 18px; border: 1px solid #e0e8e2; border-radius: 17px; box-shadow: 0 5px 18px rgba(27,69,45,.05); }
.certificate-icon { display: grid; place-items: center; width: 46px; height: 54px; border-radius: 9px; color: #fff; background: #22895d; font-weight: 900; }
.certificate-copy time { display: block; margin-top: 8px; }
.certificate-card button { grid-column: 2; justify-self: end; min-height: 40px; padding: 4px 0 0 12px; color: #12633f; background: transparent; font-size: .75rem; }
.filter-tabs { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; margin-bottom: 28px; padding: 5px; border-radius: 14px; background: #edf2ee; }
.filter-button { min-height: 44px; padding: 8px; border-radius: 10px; color: #66736b; background: transparent; font-size: .82rem; }
.filter-button.is-active { color: #12633f; background: #fff; box-shadow: 0 2px 8px rgba(27,69,45,.1); }
.profile-card { display: flex; align-items: center; gap: 15px; padding: 20px; border-radius: 18px; background: #edf7f1; }
.avatar { display: grid; place-items: center; width: 58px; height: 58px; border-radius: 50%; color: #fff; background: #22895d; font-size: 1.3rem; font-weight: 900; }
.profile-card h2 { margin: 0 0 5px; font-size: 1.1rem; }
.profile-card p { margin: 0; color: #617068; font-size: .85rem; }
.organization-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 18px; border: 1px solid #e0e8e2; border-radius: 15px; }
.organization-row strong { display: block; margin-bottom: 9px; }
.outline-button { width: auto; min-height: 44px; padding: 8px 12px; border: 1px solid #b7c9bd; color: #12633f; background: #fff; font-size: .78rem; }
.organization-detail { display: grid; gap: 0; margin: 10px 0 0; padding: 8px 18px; border: 1px solid #e0e8e2; border-radius: 15px; background: #f8fbf9; }
.organization-detail div { display: grid; grid-template-columns: 82px minmax(0,1fr); gap: 10px; padding: 12px 0; border-bottom: 1px solid #e3e9e5; }
.organization-detail div:last-child { border-bottom: 0; }
.organization-detail dt { color: #68756d; font-size: .76rem; font-weight: 700; }
.organization-detail dd { margin: 0; font-size: .8rem; line-height: 1.45; overflow-wrap: anywhere; }
.settings-list { display: grid; margin-top: 30px; border-top: 1px solid #e3e9e5; }
.settings-list button, .settings-list a { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 58px; padding: 12px 4px; border: 0; border-bottom: 1px solid #e3e9e5; border-radius: 0; color: #26342b; background: #fff; font: inherit; font-weight: 700; text-decoration: none; }
.settings-list button:disabled { cursor: default; opacity: .6; }
.settings-list .logout-button { color: #b04434; }
.settings-list .withdraw-button { min-height: 50px; color: #8a928d; font-size: .78rem; }
.settings-list small { font-size: .68rem; font-weight: 600; }
.empty-state { display: grid; justify-items: center; margin: 30px 0; padding: 42px 22px; border: 1px dashed #c8d6cc; border-radius: 18px; text-align: center; }
.empty-symbol { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 15px; border-radius: 50%; color: #18794e; background: #e0f1e7; font-size: 1.5rem; }
.empty-state h2 { font-size: 1rem; }
.empty-state .compact-button { margin-top: 18px; }
.bottom-nav { position: fixed; right: 0; bottom: 0; left: 0; z-index: 30; display: grid; grid-template-columns: repeat(4,1fr); width: min(100%,540px); min-height: 74px; margin: 0 auto; padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid #dfe7e1; background: rgba(255,255,255,.98); box-shadow: 0 -6px 20px rgba(27,69,45,.07); }
.nav-item { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; min-height: 56px; padding: 5px 2px; border-radius: 12px; color: #738078; background: transparent; font-size: .7rem; }
.nav-item.is-active { color: #12633f; background: #e9f5ee; }
.nav-icon { font-size: 1.25rem; font-weight: 800; line-height: 1; }
.toast { position: fixed; right: 20px; bottom: calc(90px + env(safe-area-inset-bottom)); left: 20px; z-index: 50; width: min(calc(100% - 40px),480px); margin: auto; padding: 14px 18px; border-radius: 12px; color: #fff; background: #26342b; font-size: .82rem; text-align: center; box-shadow: 0 8px 24px rgba(0,0,0,.18); }

@media (max-width: 480px) {
  .terms-consent { padding: 16px 12px; }
  .term-title-button { font-size: 0.72rem; }
  .app-content { padding-inline: 16px; }
  .summary-card { padding: 17px; }
  .page-heading-row { align-items: center; }
}

@media (max-width: 360px) {
  .summary-grid { grid-template-columns: 1fr; }
  .summary-card-wide { grid-column: auto; }
  .compact-item, .education-item { grid-template-columns: 36px minmax(0,1fr); }
  .compact-item .status-text, .education-item .status-text { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) { .app-view { animation: none; } }
