/* Design values taken from docs/design/coope.html. Adjust tokens here when the design changes. */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@500;600;700&family=Nunito+Sans:wght@400;600;700&display=swap');

:root {
  --font-body: 'Nunito Sans', system-ui, sans-serif;
  --font-heading: Manrope, sans-serif;
  --color-text: #18332d;
  --color-muted: #526b64;
  --color-subtle: #7c8c84;
  --color-primary: #176d50;
  --color-primary-gradient: linear-gradient(135deg, #0a5e45, #1f7a59);
  --color-line: #d5e1da;
  --color-row-line: #e0e8e3;
  --color-field: #f8f8f1;
  --color-focus: #80bfa4;
  --page-bg: linear-gradient(135deg, #e0f2e8, #f7f2e6);
  --sidebar-bg: linear-gradient(145deg, #f7fffa, #e8f5ed);
  --panel-bg: linear-gradient(135deg, #fff, #f5fcf7);
  --panel-border: #cce0d4;
  --panel-shadow: 0 12px 28px rgba(20, 61, 41, 0.1);
  --nav-active: linear-gradient(120deg, #bde6ce, #e0f2d6);
  --status-ok-bg: #e2f2e9;
  --status-ok: #176d50;
  --status-pending-bg: #fff0cf;
  --status-pending: #946000;
  --status-error-bg: #fde7e4;
  --status-error: #a43d34;

  font-family: var(--font-body);
  color: var(--color-text);
  font-size: 14px;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--page-bg); min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }
a { color: var(--color-primary); }
button:focus-visible, input:focus-visible, a:focus-visible {
  outline: 3px solid var(--color-focus);
  outline-offset: 2px;
}
.muted { color: var(--color-muted); }
.small { font-size: 13px; color: var(--color-muted); }

/* Brand */
.brand { display: flex; gap: 12px; align-items: center; padding: 0 8px; height: 50px; }
.logo {
  height: 32px; width: 32px; border-radius: 11px; flex: none;
  background: var(--color-primary); color: #fff;
  display: grid; place-items: center; font: bold 18px var(--font-heading);
}
.brand strong { font: 600 18px var(--font-heading); }
.brand small { display: block; margin-top: 2px; color: var(--color-muted); }

/* Admin shell */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 232px; flex: none; display: flex; flex-direction: column;
  background: var(--sidebar-bg); border-right: 1px solid #caddd1; padding: 14px 16px 22px;
}
.nav { margin-top: 29px; display: grid; gap: 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 7px; width: 100%;
  border: 0; border-radius: 7px; background: transparent; color: #29453a;
  text-align: left; text-decoration: none;
}
.nav-item.sub { padding-left: 16px; }
.nav-item.active { background: var(--nav-active); font-weight: 700; }
.nav-icon {
  display: grid; place-items: center; width: 27px; height: 27px; border-radius: 8px; flex: none;
}
.nav-icon.people { background: #d1ebdd; }
.nav-icon.finance { background: #fce8bd; }
.nav-icon.community { background: #e0e0f7; }
.chev { margin-left: auto; display: inline-flex; align-items: center; }
.sidebar-bottom { margin-top: auto; }
.link-button {
  border: 0; background: transparent; color: var(--color-muted); padding: 0 7px; height: 34px;
  display: flex; align-items: center; gap: 10px;
}

.main { min-width: 0; flex: 1; }
.topbar {
  height: 72px; display: flex; align-items: center; gap: 24px; padding: 0 48px;
  background: linear-gradient(175deg, #f7fffa, #fafaf0); border-bottom: 1px solid var(--color-row-line);
}
.crumb { color: #52665c; }
.top-profile {
  margin-left: auto; display: flex; align-items: center; gap: 10px; min-width: 240px;
  background: #fff; border: 1px solid var(--color-line); border-radius: 8px; padding: 6px 12px;
}
.top-profile small { display: block; color: var(--color-subtle); font-size: 11px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: #d9eddf; color: var(--color-primary);
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.content { padding: 26px 50px 70px 48px; }
.intro { font-size: 16px; color: var(--color-muted); margin: 0 0 25px; }

/* Panel (card) */
.panel {
  background: var(--panel-bg); border: 1px solid var(--panel-border); border-radius: 20px;
  box-shadow: var(--panel-shadow); padding: 22px 24px 40px; max-width: 1110px;
}
.panel h1, .panel h2 { font: 600 18px var(--font-heading); margin: 0 0 6px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }

/* Controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; white-space: nowrap; text-decoration: none;
  background: var(--color-field); border: 1px solid var(--color-line); border-radius: 10px;
  color: var(--color-text); font-weight: 700;
}
.btn.primary { background: var(--color-primary-gradient); border-color: transparent; color: #fff; }
.field {
  height: 36px; padding: 0 10px; width: 100%;
  background: var(--color-field); border: 1px solid var(--color-line); border-radius: 10px;
  color: var(--color-text);
}
.stack { display: grid; gap: 10px; }
label { font-weight: 700; font-size: 13px; }
.field-error { margin: 0; color: var(--status-error); font-size: 13px; }

/* Table */
.table-scroll {
  overflow-x: auto; margin-top: 24px; background: #fff;
  border: 1px solid var(--color-line); border-radius: 12px;
}
table { border-collapse: collapse; width: 100%; min-width: 950px; text-align: left; font-size: 13px; }
th { height: 42px; font-weight: 700; }
td { height: 50px; }
th, td { border-bottom: 1px solid var(--color-row-line); padding: 0 9px; }
th:first-child, td:first-child { padding-left: 14px; }
tr:last-child td { border-bottom: 0; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

/* Status pills */
.status { padding: 4px 9px; border-radius: 30px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status.ok { background: var(--status-ok-bg); color: var(--status-ok); }
.status.pending { background: var(--status-pending-bg); color: var(--status-pending); }
.status.error { background: var(--status-error-bg); color: var(--status-error); }

.icon-btn {
  width: 32px; height: 32px; border: 0; border-radius: 8px; background: #e8f5eb;
  display: inline-grid; place-items: center;
}
.icon { display: block; flex: none; }

/* Public pages (families) */
.public-main {
  min-height: 100vh; display: grid; place-content: center; gap: 24px; padding: 24px 16px;
}
.public-main .panel { width: min(440px, 100%); padding: 28px; }
.amount {
  display: flex; justify-content: space-between; align-items: baseline;
  margin: 20px 0; padding: 14px 16px; border-radius: 12px; background: var(--status-ok-bg);
}
.amount strong { font: 700 24px var(--font-heading); color: var(--color-primary); }
.public-main .btn { width: 100%; margin-top: 8px; }

@media (max-width: 900px) {
  .sidebar { width: 190px; }
  .topbar { padding: 0 22px; }
  .top-profile { min-width: auto; }
  .content { padding: 24px; }
}
@media (max-width: 640px) {
  .app { display: block; }
  .sidebar { width: 100%; padding: 10px; }
  .nav, .sidebar-bottom { display: none; }
  .topbar { height: auto; padding: 12px; flex-wrap: wrap; }
  .content { padding: 18px; }
  .panel-head { display: block; }
}

/* Attempt detail */
.facts {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px;
  margin: 24px 0; padding: 16px; background: #fff; border: 1px solid var(--color-line); border-radius: 12px;
}
.facts dt { font-size: 12px; color: var(--color-subtle); margin-bottom: 4px; }
.facts dd { margin: 0; font-weight: 600; }
.json-block { margin-top: 24px; }
.json {
  margin: 8px 0 0; padding: 16px; max-height: 480px; overflow: auto;
  background: #f6faf7; border: 1px solid var(--color-line); border-radius: 12px;
  font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre;
}
