/* Healthy Pantry admin: Pico (green theme) plus a few layout helpers. */
:root {
  --hp-green: #2e7d32;
  --hp-green-dark: #1b5e20;
  --hp-green-soft: #e8f5e9;
  --pico-primary: var(--hp-green);
  --pico-primary-background: var(--hp-green);
  --pico-primary-border: var(--hp-green);
  --pico-primary-hover: var(--hp-green-dark);
  --pico-primary-hover-background: var(--hp-green-dark);
  --pico-primary-hover-border: var(--hp-green-dark);
  --pico-primary-focus: rgba(46, 125, 50, 0.3);
  --pico-font-size: 100%;
}

html, body { background: #f6f8f6; min-height: 100%; }
main.container { padding-top: 1rem; padding-bottom: 2rem; }

.topbar { background: #fff; border-bottom: 3px solid var(--hp-green); }
.topbar nav { flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 0.5rem; text-decoration: none; color: inherit; }
.brand strong { color: var(--hp-green); }
.nav-links { flex-wrap: wrap; }
.nav-links a[aria-current="page"] { color: var(--hp-green); font-weight: 600; text-decoration: underline; text-underline-offset: 0.35em; }

.muted { color: var(--pico-muted-color); }
.mono { font-family: var(--pico-font-family-monospace); font-size: 0.85em; word-break: break-all; }
.small, button.small, [role="button"].small { font-size: 0.85rem; padding: 0.3rem 0.7rem; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.inline { display: inline; margin: 0; }
ul.plain { list-style: none; padding-left: 0; }
ul.plain li { list-style: none; margin-bottom: 0.35rem; }

.footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding-bottom: 2rem; }
.footer button { margin: 0; width: auto; }

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat { margin: 0; padding: 1rem; display: flex; flex-direction: column; gap: 0.2rem; border-top: 3px solid var(--hp-green); }
.stat small { color: var(--pico-muted-color); text-transform: uppercase; letter-spacing: 0.04em; font-size: 0.72rem; }
.stat strong { font-size: 1.8rem; line-height: 1.2; color: var(--hp-green-dark); }
.stat strong.small-value { font-size: 1rem; }
.stat span { font-size: 0.8rem; }
.stat.estimate { border-top-color: #f9a825; }

.range { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 1rem; }
.range [role="button"] { margin: 0; }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); gap: 1rem; }
.charts article { margin: 0; }
.charts canvas { height: 240px !important; width: 100% !important; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr)); gap: 1rem; margin-top: 1rem; }
.grid-2 article { margin: 0; }
.grid-2 + article, .grid-2 + details, .charts + .grid-2 { margin-top: 1rem; }

.table-wrap { overflow-x: auto; }
.table-wrap table { margin-bottom: 0.5rem; }
.audit { max-height: 22rem; overflow-y: auto; }
.audit table { font-size: 0.85rem; }
.audit td:first-child { white-space: nowrap; }

.badge { display: inline-block; padding: 0.05rem 0.5rem; border-radius: 999px; font-size: 0.75rem; background: #eceff1; color: #37474f; vertical-align: middle; white-space: nowrap; }
.badge.ok { background: var(--hp-green-soft); color: var(--hp-green-dark); }
.badge.warn { background: #fff8e1; color: #8d6e00; }
.badge.danger { background: #ffebee; color: #b71c1c; }

.notice { padding: 0.75rem 1rem; border-radius: var(--pico-border-radius); background: #eef3ee; border-left: 4px solid #90a4ae; }
.notice.ok { background: var(--hp-green-soft); border-left-color: var(--hp-green); }
.notice.error { background: #ffebee; border-left-color: #c62828; }
.notice-inline { display: block; margin-top: 0.25rem; }
.notice-inline.ok, small.ok { color: var(--hp-green-dark); }
.notice-inline.error, small.error { color: #b71c1c; display: block; }

.search { display: flex; gap: 0.5rem; }
.search input { margin: 0; }
.search button { width: auto; margin: 0; }
.pager { display: flex; gap: 1rem; justify-content: center; }

.key-group-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.key-group-header button { margin: 0; width: auto; }
.key-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0.5rem 1rem; padding: 0.75rem 0; border-bottom: 1px solid var(--pico-muted-border-color); }
.key-row:last-child { border-bottom: none; }
.key-meta { display: flex; flex-direction: column; gap: 0.15rem; }
.key-actions { display: flex; gap: 0.5rem; align-items: start; }
.key-form { display: flex; gap: 0.5rem; flex: 1; margin: 0; }
.key-form input { margin: 0; }
.key-form button, .key-actions > button { width: auto; margin: 0; }
.key-row > .notice-inline { grid-column: 1 / -1; }
@media (max-width: 720px) {
  .key-row { grid-template-columns: 1fr; }
  .footer { justify-content: center; }
}

button.danger, .danger-zone button { background: #c62828; border-color: #c62828; }
.danger-zone { margin-top: 1.5rem; padding: 1rem; border: 1px solid #ef9a9a; border-radius: var(--pico-border-radius); background: #fff; }
.danger-zone summary { color: #b71c1c; font-weight: 600; }

.login-card { max-width: 26rem; margin: 3rem auto; }
.login-header { text-align: center; }
.login-header h1 { margin: 0.5rem 0 0; color: var(--hp-green); font-size: 1.6rem; }
.login-header p { margin: 0; }
.login-card .google { display: flex; align-items: center; justify-content: center; gap: 0.5rem; width: 100%; }
.login-links { text-align: center; margin-top: 1rem; }

#toast { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); background: #263238; color: #fff; padding: 0.75rem 1.25rem; border-radius: var(--pico-border-radius); max-width: 90vw; z-index: 10; }
