:root {
  color-scheme: light;
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  color: #152720;
  background: #f4f6ff;
  --surface: #fff;
  --ink: #152720;
  --muted: #546760;
  --green: #08644d;
  --accent: #094c3d;
  --line: #dfe7e3;
  --wash: #edf4f0;
  --danger: #a42b24;
  --amber: #805211;
  --shadow: 0 1px 2px #0f32200a, 0 12px 30px -26px #13332563;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    radial-gradient(ellipse 64rem 35rem at 100% 1%, #d8e6ff 0, transparent 72%),
    radial-gradient(ellipse 56rem 36rem at 42% -2%, #e9dcff 0, transparent 77%),
    radial-gradient(ellipse 40rem 38rem at 0 30%, #daf7ee 0, transparent 83%),
    #f4f6ff;
  min-height: 100vh;
}
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid #117357; outline-offset: 3px; }
h1:focus { outline: none; }
header {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
  gap: 10px; padding: 14px max(16px, calc((100vw - 1376px) / 2));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand, #accountActions, .toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.brand { gap: 11px; }
.brand strong { font-size: .9rem; letter-spacing: .035em; }
.brand small { display: block; font-size: .75rem; margin-top: 2px; }
.logo {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  color: #d2f4e2; background: var(--accent); font-size: .8rem; font-weight: 800;
}
#accountActions { font-size: .8rem; }
#accountActions button { padding-inline: 10px; }
#account { color: var(--muted); overflow-wrap: anywhere; }
main { max-width: 1424px; margin-inline: auto; padding: 12px 16px calc(100px + env(safe-area-inset-bottom)); }
.messages { margin-bottom: 12px; font-size: .82rem; overflow-wrap: anywhere; }
.messages p { margin: 0; }
#connection { display: flex; align-items: baseline; gap: 8px; color: var(--muted); }
#connection::before { content: ""; flex: 0 0 7px; height: 7px; border-radius: 50%; background: var(--green); }
#connection.error::before { background: var(--danger); }
#connection.waiting::before { background: var(--amber); }
#notice { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--wash); }
#notice.error { background: #fbece9; }
#notice.waiting { background: #fbf1db; }
small, .muted, .page-heading p { color: var(--muted); }
.error, .negative, .danger, #connection.error { color: var(--danger); }
.positive { color: var(--green); }
.waiting, #connection.waiting { color: var(--amber); }

button, .mobile-more summary {
  font: inherit; font-size: .875rem; font-weight: 650; min-height: 44px;
  border: 1px solid transparent; border-radius: 10px; padding: 9px 13px;
  background: var(--accent); color: #fff; cursor: pointer;
}
button:disabled { opacity: .55; cursor: not-allowed; }
.secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.secondary.danger { color: var(--danger); }
button:not(:disabled):active { transform: translateY(1px); }
.primary-action { display: inline-flex; align-items: center; gap: 8px; }
button svg, summary svg { width: 19px; height: 19px; flex: none; }
.sidebar { display: none; }
.mobile-nav {
  position: fixed; z-index: 5; inset: auto 0 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px max(5px, env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left));
  box-shadow: 0 -12px 30px -28px #17372a80;
}
nav button, .mobile-more summary {
  display: flex; align-items: center; justify-content: center; gap: 4px;
  background: transparent; color: var(--muted); padding: 6px 2px;
}
.mobile-nav > button, .mobile-more summary { flex-direction: column; min-height: 54px; font-size: .67rem; }
nav button[aria-current], .mobile-more.is-current > summary { background: var(--wash); color: var(--accent); }
.mobile-nav .nav-create svg { background: var(--accent); color: white; border-radius: 8px; width: 27px; height: 27px; padding: 4px; }
.mobile-more { border: 0; }
.mobile-more summary { list-style: none; }
.mobile-more summary::-webkit-details-marker { display: none; }
.more-menu {
  position: absolute; right: 10px; bottom: calc(100% + 8px); min-width: 168px; padding: 6px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: 0 12px 34px #16392826;
}
.more-menu button { width: 100%; justify-content: flex-start; padding-inline: 10px; gap: 8px; }

.workspace { min-width: 0; }
h1 { margin: 0; font-size: clamp(1.85rem, 4vw, 2.65rem); letter-spacing: -.048em; line-height: 1.1; }
h2 { margin: 0 0 10px; font-size: 1.06rem; letter-spacing: -.018em; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-heading p { margin: 6px 0 0; font-size: .9rem; }
.overview { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.panel, .metric, form {
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 15px; box-shadow: var(--shadow); min-width: 0;
}
.panel { margin-top: 16px; }
.panel-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.panel-heading h2 { margin: 0; }
.panel-heading button { font-size: .8rem; white-space: nowrap; }
.hero {
  grid-column: 1 / -1; display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
  border-radius: 18px; padding: 22px; color: #fff; min-height: 163px;
}
.hero small { color: #c8eadc; }
.hero strong { font-size: clamp(2rem, 7vw, 3.5rem); font-weight: 740; letter-spacing: -.065em; line-height: 1.03; margin: 8px 0 12px; overflow-wrap: anywhere; }
.hero .negative { color: #ffc6ba; }
#checks { padding: 4px 9px; border-radius: 999px; background: #ffffff13; }
.metric { display: grid; gap: 7px; align-content: center; }
.metric strong { font-size: clamp(1.05rem, 2vw, 1.5rem); letter-spacing: -.03em; overflow-wrap: anywhere; }
.metric strong, .hero strong, .item > strong, .history-table td:nth-child(4) { font-variant-numeric: tabular-nums; }
.item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 8px;
  padding: 13px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere;
}
.item small { display: block; margin-top: 4px; line-height: 1.45; }
.item:last-child { border-bottom: 0; }
#historyList { background: white; padding: 0 14px; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.toolbar { margin-block: 12px; }
form, #typeWrap, .filters { display: grid; gap: 14px; }
form { max-width: 660px; margin-top: 16px; }
#loginView { max-width: 410px; margin: clamp(28px, 10vh, 90px) auto; }
#loginView form { margin-top: 20px; padding: 22px; }
label { display: grid; gap: 6px; font-size: .85rem; font-weight: 650; min-width: 0; }
input, select {
  appearance: auto; width: 100%; min-width: 0; max-width: 100%; min-height: 46px;
  border: 1px solid #c8d5cf; border-radius: 9px; padding: 8px 10px;
  background: #fff; color: inherit; font: inherit; font-size: 1rem; font-weight: 450;
}
input:focus, select:focus { border-color: #117357; }
.entry-switch { margin-top: 12px; }
.form-feedback { background: #f5f8f6; border-radius: 10px; padding: 10px 12px; }
.form-feedback p { margin: 0; font-size: .875rem; }
.form-feedback p + p:not(:empty) { margin-top: 7px; }
.filters { grid-template-columns: repeat(auto-fit, minmax(min(100%, 142px), 1fr)); margin-top: 16px; }
.report-bars { display: grid; gap: 5px; padding-bottom: 10px; }
progress { width: 100%; height: 9px; accent-color: var(--green); }
progress.out { accent-color: var(--danger); }
dt { font-weight: 650; }
dd { margin: 0 0 10px; overflow-wrap: anywhere; }
.row-actions { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 7px; }
summary { cursor: pointer; min-height: 44px; padding: 10px 0; }
details { overflow-wrap: anywhere; border-bottom: 1px solid var(--line); }
.history-table { display: none; }
.skeleton { min-height: 46px; border-radius: 8px; background: var(--wash); }
@media (min-width: 850px) {
  main { padding: 18px 24px 44px; }
  .messages { margin-bottom: 17px; }
  #walletView { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 25px; }
  .mobile-nav { display: none; }
  .sidebar { display: grid; position: sticky; top: 18px; align-self: start; gap: 4px; padding: 6px 0; }
  .sidebar button { justify-content: flex-start; padding: 10px 12px; gap: 10px; text-align: left; }
  .overview { grid-template-columns: minmax(0, 1.45fr) repeat(2, minmax(0, 1fr)); gap: 12px; }
  .hero { grid-column: auto; grid-row: span 2; }
  .panel, .metric, form { padding: 20px; }
  .columns { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
  #form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #form > #typeWrap, #form > .form-feedback, #form > #save, #form > #editStatus, #form > #exitEdit { grid-column: 1 / -1; }
  #typeWrap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .mobile-history { display: none; }
  .history-table { display: table; width: 100%; border-collapse: collapse; table-layout: fixed; font-size: .86rem; }
  .history-table td, .history-table th { padding: 12px 7px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
  .history-table th { color: var(--muted); font-weight: 650; }
  .history-table tbody tr:last-child td { border-bottom: 0; }
  .history-table td:nth-child(4), .history-table th:nth-child(4) { text-align: right; }
  .history-table th:last-child { width: 155px; }
  .history-table button { padding-inline: 8px; font-size: .8rem; }
}
@media (hover: hover) {
  button:not(:disabled):hover { background: #0a674f; }
  nav button:not(:disabled):hover, button.secondary:not(:disabled):hover, .mobile-more summary:hover { background: var(--wash); }
  .history-table tbody tr:hover { background: #f6f9f7; }
}
@media (prefers-reduced-motion: no-preference) {
  button, input, select, summary { transition: background-color 150ms, border-color 150ms, transform 120ms; }
  .skeleton { background: linear-gradient(90deg, #e6eeea, #f7faf8, #e6eeea); background-size: 200% 100%; animation: pulse 1.5s linear infinite; }
  @keyframes pulse { to { background-position: -200% 0; } }
}
@media (prefers-reduced-motion: reduce) {
  button:not(:disabled):active { transform: none; }
}

#viewerFeedback { margin: 0; overflow-wrap: anywhere; }

.viewer-mode {
  min-height: 100vh;
}
.viewer-mode #account { display: none; }
.viewer-mode main { max-width: 1000px; padding-bottom: 40px; }
.viewer-mode .messages { margin-bottom: 20px; }
.viewer-heading, .viewer-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.viewer-heading { margin: 4px 0 18px; }
.viewer-heading p { margin: 6px 0 0; color: var(--muted); overflow-wrap: anywhere; }
.viewer-access, .viewer-period { color: var(--muted); font-size: .76rem; font-weight: 650; white-space: nowrap; }
.viewer-access { border: 1px solid #cce2d6; border-radius: 999px; padding: 5px 9px; color: #235743; background: #ecf6f0; }

.viewer-dashboard, .viewer-side { display: grid; gap: 12px; min-width: 0; }
.viewer-hero {
  position: relative; isolation: isolate; overflow: hidden; display: flex; flex-direction: column;
  align-items: flex-start; justify-content: center; gap: 15px;
  min-height: 182px; padding: clamp(20px, 4vw, 36px); border-radius: 23px; color: #fff;
}
.viewer-hero h2 { margin: 0; color: #d3f8e6; font-weight: 550; }
.viewer-amount {
  font-size: clamp(1.9rem, 8vw, 3.5rem); line-height: 1.05; letter-spacing: -.055em;
  font-variant-numeric: tabular-nums; overflow-wrap: anywhere;
}
.viewer-negative { color: #ffc8bd; }
.viewer-card {
  min-width: 0; padding: clamp(15px, 3vw, 22px); background: var(--surface);
  border: 1px solid #dce9e1; border-radius: 20px; box-shadow: var(--shadow);
}
.viewer-card h2 { margin: 0; overflow-wrap: anywhere; }
.viewer-card-label, .viewer-flow-note { margin: 0; font-size: .79rem; color: var(--muted); }
.viewer-partner { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: baseline; gap: 6px 10px; }
.viewer-partner .viewer-card-label { grid-column: 1 / -1; }
.viewer-partner strong { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.viewer-flow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0 8px; }
.viewer-flow > div { background: #f2f7f4; border-radius: 10px; padding: 9px 10px; }
.viewer-flow dt { color: var(--muted); font-size: .77rem; font-weight: 600; }
.viewer-flow dt span { margin-right: 3px; color: #087051; }
.viewer-flow > div:nth-child(2) dt span { color: #925335; }
.viewer-flow dd { margin: 4px 0 0; font-size: clamp(.92rem, 3vw, 1.14rem); font-weight: 700; font-variant-numeric: tabular-nums; }

.viewer-history-card { margin-top: 14px; }
.viewer-filters { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.viewer-filters button { background: #f3f7f4; color: #405a4f; border-radius: 9px; min-height: 44px; padding: 5px 11px; font-size: .79rem; }
.viewer-filters button[aria-pressed="true"] { background: #0b503d; color: white; }
.viewer-date-group { margin-top: 16px; }
.viewer-date-group h3 {
  margin: 0; padding: 7px 9px; border-radius: 7px; background: #f3f7f4;
  color: var(--muted); font-size: .77rem; font-weight: 650;
}
.viewer-entries { list-style: none; padding: 0; margin: 0; }
.viewer-transaction {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) minmax(0, auto); gap: 9px;
  align-items: center; padding: 10px 0; border-bottom: 1px solid #e7eee9;
}
.viewer-transaction:last-child { border-bottom: 0; }
.viewer-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 11px; font-weight: 700; }
.viewer-icon.in { background: #e0f4e9; color: #136747; }
.viewer-icon.out { background: #f8ede7; color: #884d35; }
.viewer-icon.other { background: #edf0f0; color: #475752; }
.viewer-description { min-width: 0; overflow-wrap: anywhere; }
.viewer-description strong, .viewer-value-amount { display: block; font-size: .86rem; }
.viewer-description small { display: block; margin-top: 3px; font-size: .74rem; }
.viewer-value { text-align: right; overflow-wrap: anywhere; }
.viewer-value-amount { font-variant-numeric: tabular-nums; margin-bottom: 3px; }
.viewer-value-amount.in { color: #14664b; }
.viewer-status { display: inline-block; padding: 2px 6px; border-radius: 7px; font-size: .67rem; background: #eff2f1; color: #475752; }
.viewer-status.done { background: #e4f4ea; color: #1c6749; }
.viewer-status.pending { background: #fff0d2; color: #7b4a09; }
.viewer-status.cancelled { background: #faece9; color: #8b3227; }
.viewer-empty { padding: 25px 8px 14px; text-align: center; }
.viewer-empty p { margin-bottom: 0; font-size: .85rem; }
.viewer-pagination { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; font-size: .8rem; }
@media (min-width: 720px) {
  .viewer-dashboard { grid-template-columns: minmax(0, 1.24fr) minmax(0, 1fr); gap: 15px; }
  .viewer-hero { min-height: 245px; }
  .viewer-history-card { margin-top: 16px; }
  .viewer-transaction { gap: 13px; padding-inline: 5px; }
}
@media (hover: hover) {
  .viewer-filters button:not(:disabled):hover { background: #e4f0e9; }
  .viewer-filters button[aria-pressed="true"]:hover { background: #14634c; }
}

.viewer-arrow {
  position: relative; display: inline-block; width: 14px; height: 2px; border-radius: 2px;
  vertical-align: middle; background: currentColor;
}
.viewer-arrow.in { transform: rotate(135deg); }
.viewer-arrow.out { transform: rotate(-45deg); }
.viewer-arrow::after {
  content: ""; position: absolute; right: 0; top: -2px; width: 6px; height: 6px;
  border-top: 2px solid; border-right: 2px solid; transform: rotate(45deg);
}
.viewer-arrow.other { width: 5px; height: 5px; }
.viewer-arrow.other::after { display: none; }
@media (max-width: 470px) {
  .viewer-mode .brand small { display: none; }
  .viewer-mode .brand strong { font-size: .78rem; }
  .viewer-mode .brand { gap: 8px; }
  .viewer-mode .logo { width: 33px; height: 33px; }
}

/* Aurora shared by the admin and member dashboards. */
.aurora-balance {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid #404980;
  border-radius: 24px;
  box-shadow: 0 17px 38px -23px #282d72c2;
  background:
    linear-gradient(90deg, #141b3bf2 0%, #182047bc 39%, #20244b38 74%, transparent 100%),
    radial-gradient(ellipse at 88% 1%, #86e5d2 0%, #397eaa 28%, transparent 65%),
    radial-gradient(ellipse at 83% 100%, #956ce5 0%, #6659bb 30%, transparent 70%),
    #263668;
}
.aurora-balance::before, .aurora-balance::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
  width: 110%;
  height: 77%;
  left: 38%;
  top: 7%;
  border: 1px solid #e1faff50;
  border-radius: 50%;
  transform: rotate(-32deg);
  box-shadow: 0 0 30px #aedbf036, inset 0 0 26px #d9ccff38;
}
.aurora-balance::after { left: 42%; top: 26%; border-color: #e7ddff42; }
.aurora-balance small, .aurora-balance h2 { color: #edf7ff; }
#home .aurora-balance { min-height: 179px; padding: clamp(20px, 4vw, 29px); }
#home #checks { background: #171c3a75; border: 1px solid #cfe8ff46; color: #e5f9ff; padding: 5px 10px; }
.viewer-hero .viewer-negative, .aurora-balance .negative { color: #ffd6ce; }

#home .panel, .viewer-card, .aurora-metric {
  border-color: #dfe5f7;
  border-radius: 19px;
  background: #ffffffed;
  box-shadow: 0 1px 2px #1b29580a, 0 14px 29px -25px #333a776d;
}
.aurora-metric {
  grid-template-columns: min-content minmax(0, 1fr);
  align-items: center;
  column-gap: 9px;
  row-gap: 6px;
}
.aurora-metric strong { grid-column: 1 / -1; }
.aurora-metric-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  background: #ece7ff;
  color: #5d4298;
}
.aurora-metric-icon svg { width: 17px; height: 17px; }
.aurora-metric.incoming .aurora-metric-icon { background: #ddf5eb; color: #10684e; }
.aurora-metric.outgoing .aurora-metric-icon { background: #e2edff; color: #2e5396; }
.aurora-metric.pending .aurora-metric-icon { background: #fff2d6; color: #82501a; }
#home .primary-action {
  border-color: #35417a;
  background: linear-gradient(115deg, #244b73 0%, #564589 100%);
  box-shadow: 0 8px 19px -10px #4c459e;
}
.viewer-access { background: #ece7ff; border-color: #dfd5ff; color: #513a85; }
.viewer-date-group h3 { background: #f0f2fd; color: #495575; }
.viewer-flow > div { background: #f1f4fc; }
.viewer-filters button[aria-pressed="true"] { background: #514681; color: #fff; }
@media (hover: hover) {
  #home .primary-action:not(:disabled):hover { background: #453775; }
  .viewer-filters button[aria-pressed="true"]:hover { background: #40346f; }
}
@media (min-width: 850px) {
  #home .aurora-balance { min-height: 212px; }
}

.transfer-fields, .transfer-preview { display: grid; gap: 10px; }
.transfer-preview { margin-bottom: 8px; }
.transfer-preview .metric { background: var(--surface); box-shadow: none; }
.transfer-preview strong { font-size: .92rem; overflow-wrap: anywhere; }
#transferHistory { margin-top: 12px; }
#transferHistory details summary {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px;
  align-items: start; padding: 11px 0; overflow-wrap: anywhere;
}
#transferHistory summary small { display: block; margin-top: 3px; }
#transferHistory dl { margin-block: 4px 12px; padding: 12px; border-radius: 10px; background: var(--wash); }
#transferHistory dt, #transferHistory dd { overflow-wrap: anywhere; }
#transferHistory .row-actions { margin: 6px 0 12px; }
@media (min-width: 620px) {
  .transfer-fields, .transfer-preview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Food Billing uses the wallet palette and system theme. */
#food h1 { margin-bottom: 1rem; }
.food-panel { margin-block: 1rem; }
.food-grid, .food-metrics { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); }
.food-metrics { margin-top: 1rem; }
.food-metrics .metric { min-height: 6rem; }
.food-controls { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; margin-block: .5rem; }
.food-controls button, .food-row button, .food-table button, #viewerFoodToggle, #foodWorkspace button { min-height: 44px; }
.food-rows { display: grid; gap: .75rem; margin-bottom: .75rem; }
.food-row { padding: .8rem; border: 1px solid var(--line, #acb5ca); border-radius: .8rem; min-width: 0; }
.food-row > button { margin-top: .65rem; }
.food-row .food-panel { margin: .65rem 0; }
.food-charge { margin-block: .65rem; }
.food-table { overflow-x: auto; }
.food-table table { min-width: max-content; width: 100%; }
.food-table td { white-space: normal; max-width: 19rem; }
.food-list { padding-inline-start: 1.25rem; }
.food-confirm { display: flex; align-items: center; justify-content: flex-end; flex-direction: row-reverse; gap: .7rem; margin-block: .7rem; }
.food-confirm input { width: 1.15rem; height: 1.15rem; flex: 0 0 auto; }
.food-feedback { padding: .55rem .7rem; border-radius: .55rem; background: var(--surface); }
#foodWorkspace textarea { width: 100%; color: var(--ink); background: var(--surface); padding: .65rem; }
#foodWorkspace summary { cursor: pointer; min-height: 44px; align-content: center; }
#viewerFood { margin-top: 1rem; }
#viewerFoodContent { min-width: 0; }
@media (max-width: 36rem) { .food-grid { grid-template-columns: 1fr; } }
