/* Goose Admin: the internal tool for the team that runs Goose. Deliberately
   plain, nothing from the playful app. Everything is scoped under
   .staff-ui because Propshaft also bundles this file into the app stylesheet. */

.staff-ui {
  --bg: #ffffff;
  --panel: #f8f9fa;
  --text: #111827;
  --muted: #6b7280;
  --faint: #9ca3af;
  --border: #e5e7eb;
  --row-hover: #f9fafb;
  --accent: #111827;
  --link: #2563eb;
  --ok-bg: #ecfdf5; --ok: #047857;
  --warn-bg: #fffbeb; --warn: #b45309;
  --bad-bg: #fef2f2; --bad: #b91c1c;
  --info-bg: #eff6ff; --info: #1d4ed8;
  color-scheme: light;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.staff-ui * { box-sizing: border-box; }
.staff-ui a { color: var(--link); text-decoration: none; }
.staff-ui a:hover { text-decoration: underline; }
.staff-ui h1, .staff-ui h2, .staff-ui h3, .staff-ui p { margin: 0; }

.staff-ui .shell { display: grid; grid-template-columns: 224px 1fr; min-height: 100vh; }

/* Sidebar */
.staff-ui .sidebar {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 1.5rem;
  padding: 1.1rem 0.75rem;
  background: var(--panel);
  border-right: 1px solid var(--border);
}
.staff-ui .product { display: flex; align-items: center; gap: 0.5rem; padding: 0 0.5rem; color: var(--text); font-weight: 700; font-size: 15px; }
.staff-ui .product:hover { text-decoration: none; }
.staff-ui .product .env { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 0.35rem; background: var(--bg); }
.staff-ui .sidebar nav { display: flex; flex-direction: column; gap: 2px; }
.staff-ui .nav-item { display: block; padding: 0.4rem 0.6rem; border-radius: 6px; color: #374151; font-weight: 500; }
.staff-ui .nav-item:hover { background: #eef0f2; text-decoration: none; }
.staff-ui .nav-item[aria-current="page"] { background: var(--bg); color: var(--text); font-weight: 600; box-shadow: 0 0 0 1px var(--border); }
.staff-ui .nav-item.subtle { color: var(--muted); }
.staff-ui .nav-item .count { float: right; min-width: 1.4rem; text-align: center; font-size: 11px; font-weight: 600; padding: 0 0.35rem; border-radius: 999px; background: var(--accent); color: #fff; }
.staff-ui .sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 0.5rem; }
.staff-ui .sidebar-foot .who { padding: 0 0.6rem; font-size: 12px; font-weight: 600; }
.staff-ui .sidebar-foot .who span { font-weight: 400; color: var(--muted); }

/* Content */
.staff-ui .content { padding: 1.75rem 2rem 3rem; max-width: 1200px; width: 100%; }
.staff-ui .page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.staff-ui .page-head h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
.staff-ui .page-head .sub { color: var(--muted); margin-top: 0.15rem; }
.staff-ui .crumbs { font-size: 13px; color: var(--muted); margin-bottom: 0.35rem; }
.staff-ui .section { margin-top: 1.75rem; }
.staff-ui .section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 0.6rem; }
.staff-ui .section-head h2 { font-size: 14px; font-weight: 600; }
.staff-ui .section-head .meta { font-size: 13px; color: var(--muted); }
.staff-ui .muted { color: var(--muted); }
.staff-ui .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.staff-ui .num { font-variant-numeric: tabular-nums; text-align: right; }
.staff-ui .split { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.staff-ui .split > .section { margin-top: 0; }

.staff-ui .notice { margin-bottom: 1rem; padding: 0.6rem 0.85rem; border-radius: 6px; background: var(--ok-bg); color: var(--ok); border: 1px solid #a7f3d0; font-weight: 500; }
.staff-ui .notice.error { background: var(--bad-bg); color: var(--bad); border-color: #fecaca; }

/* KPIs */
.staff-ui .kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.staff-ui .kpi { padding: 0.9rem 1rem; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); margin: 0 -1px -1px 0; }
.staff-ui .kpi .label { font-size: 12px; font-weight: 500; color: var(--muted); }
.staff-ui .kpi .value { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; margin-top: 0.15rem; }
.staff-ui .kpi .hint { font-size: 12px; color: var(--faint); }

/* Signups chart */
.staff-ui .chart { display: flex; align-items: flex-end; gap: 3px; height: 72px; padding: 0.75rem; border: 1px solid var(--border); border-radius: 8px; }
.staff-ui .chart span { flex: 1; background: #d1d5db; border-radius: 2px 2px 0 0; min-height: 2px; }
.staff-ui .chart span:hover { background: var(--accent); }
.staff-ui .chart-axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--faint); margin-top: 0.3rem; }

/* Tables */
.staff-ui .table-wrap { border: 1px solid var(--border); border-radius: 8px; overflow-x: auto; }
.staff-ui table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
.staff-ui table.data th {
  text-align: left; font-size: 12px; font-weight: 500; color: var(--muted);
  padding: 0.55rem 0.85rem; background: var(--panel); border-bottom: 1px solid var(--border); white-space: nowrap;
}
.staff-ui table.data td { padding: 0.55rem 0.85rem; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.staff-ui table.data tr:last-child td { border-bottom: 0; }
.staff-ui table.data tbody tr:hover td { background: var(--row-hover); }
.staff-ui table.data th.num, .staff-ui table.data td.num { text-align: right; }
.staff-ui table.data td.wrap { white-space: normal; }
.staff-ui table.data .primary { font-weight: 500; color: var(--text); }
.staff-ui table.data .secondary { display: block; color: var(--muted); font-size: 12px; }
.staff-ui table.data .empty { text-align: center; color: var(--muted); padding: 1.5rem; }
.staff-ui table.data td.actions { text-align: right; }
.staff-ui table.data td.actions form { display: inline; }

/* Definition list */
.staff-ui dl.facts { display: grid; grid-template-columns: 160px 1fr; margin: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.staff-ui dl.facts dt, .staff-ui dl.facts dd { margin: 0; padding: 0.5rem 0.85rem; border-bottom: 1px solid var(--border); }
.staff-ui dl.facts dt { color: var(--muted); background: var(--panel); font-weight: 500; font-size: 13px; }
.staff-ui dl.facts dt:last-of-type, .staff-ui dl.facts dd:last-of-type { border-bottom: 0; }

/* Status badges */
.staff-ui .badge { display: inline-block; padding: 0.05rem 0.45rem; border-radius: 4px; font-size: 12px; font-weight: 500; background: #f3f4f6; color: #374151; border: 1px solid var(--border); }
.staff-ui .badge.ok { background: var(--ok-bg); color: var(--ok); border-color: #a7f3d0; }
.staff-ui .badge.warn { background: var(--warn-bg); color: var(--warn); border-color: #fde68a; }
.staff-ui .badge.bad { background: var(--bad-bg); color: var(--bad); border-color: #fecaca; }
.staff-ui .badge.info { background: var(--info-bg); color: var(--info); border-color: #bfdbfe; }

/* Controls */
.staff-ui .toolbar { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-bottom: 0.75rem; }
.staff-ui input[type="text"], .staff-ui input[type="email"], .staff-ui input[type="search"], .staff-ui select {
  font: inherit; font-size: 13px; padding: 0.4rem 0.6rem; border: 1px solid #d1d5db; border-radius: 6px; background: var(--bg); color: var(--text); min-width: 0;
}
.staff-ui input[type="search"] { width: 280px; max-width: 100%; }
.staff-ui input:focus, .staff-ui select:focus { outline: 2px solid #93c5fd; outline-offset: 0; border-color: #60a5fa; }
.staff-ui label { display: block; font-size: 12px; font-weight: 500; color: #374151; margin-bottom: 0.25rem; }
.staff-ui .form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; align-items: end; }
.staff-ui .form-grid input { width: 100%; }

.staff-ui .btn {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 0.4rem 0.75rem; border-radius: 6px; cursor: pointer;
  border: 1px solid #d1d5db; background: var(--bg); color: var(--text);
}
.staff-ui .btn:hover { background: var(--panel); text-decoration: none; }
.staff-ui .btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.staff-ui .btn.primary:hover { background: #1f2937; }
.staff-ui .btn.danger { color: var(--bad); border-color: #fecaca; }
.staff-ui .btn.danger:hover { background: var(--bad-bg); }
.staff-ui .btn.small { padding: 0.2rem 0.5rem; font-size: 12px; }
.staff-ui .btn-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.staff-ui .btn-row form { display: inline; }

.staff-ui .danger-zone { border: 1px solid #fecaca; border-radius: 8px; padding: 1rem; display: grid; gap: 0.6rem; }
.staff-ui .danger-zone h2 { font-size: 14px; font-weight: 600; color: var(--bad); }

.staff-ui .pager { display: flex; justify-content: space-between; align-items: center; margin-top: 0.6rem; color: var(--muted); font-size: 13px; }

.staff-ui .impersonation { position: sticky; top: 0; z-index: 10; }

/* Phones first. The sidebar becomes a top bar plus a bottom tab bar within
   thumb reach, tables become stacked cards, and nothing scrolls sideways. */
@media (max-width: 860px) {
  .staff-ui { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .staff-ui .shell { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .staff-ui .sidebar {
    position: sticky; top: 0; z-index: 20; height: auto;
    flex-direction: row; align-items: center; gap: 0.75rem;
    padding: calc(0.6rem + env(safe-area-inset-top)) 1rem 0.6rem;
    border-right: 0; border-bottom: 1px solid var(--border);
    background: var(--panel); /* no backdrop-filter: it would trap the fixed tab bar inside the header */
  }
  .staff-ui .product .env { margin-left: 0.25rem; }
  .staff-ui .sidebar nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    flex-direction: row; gap: 0; justify-content: space-around;
    padding: 0.35rem 0.25rem calc(0.35rem + env(safe-area-inset-bottom));
    background: var(--bg); border-top: 1px solid var(--border);
  }
  .staff-ui .sidebar nav .nav-item { flex: 1; text-align: center; font-size: 12px; padding: 0.55rem 0.2rem; position: relative; }
  .staff-ui .sidebar nav .nav-item[aria-current="page"] { box-shadow: none; background: var(--panel); }
  .staff-ui .sidebar nav .nav-item .count { float: none; position: absolute; top: 0.1rem; left: calc(50% + 1.4rem); min-width: 1.1rem; font-size: 10px; line-height: 1.4; }
  .staff-ui .sidebar-foot { display: flex; margin: 0 0 0 auto; flex-direction: row; }
  .staff-ui .sidebar-foot .who { display: none; }
  .staff-ui .sidebar-foot .nav-item { font-size: 13px; padding: 0.3rem 0.5rem; }

  .staff-ui .content { padding: 1rem 1rem 2rem; }
  .staff-ui .page-head { flex-direction: column; align-items: stretch; }
  .staff-ui .page-head .btn-row > *, .staff-ui .page-head .btn-row .btn { flex: 1; justify-content: center; }
  .staff-ui .split, .staff-ui .form-grid { grid-template-columns: 1fr !important; }
  .staff-ui .kpis { grid-template-columns: 1fr 1fr; }
  .staff-ui .kpi .value { font-size: 20px; }
  .staff-ui dl.facts { grid-template-columns: 1fr; }
  .staff-ui dl.facts dt { border-bottom: 0; padding-bottom: 0.1rem; font-size: 12px; }
  .staff-ui dl.facts dd { word-break: break-word; }
  .staff-ui .toolbar > *, .staff-ui .toolbar input[type="search"] { flex: 1 1 auto; width: auto; }
  .staff-ui .toolbar form { display: flex; gap: 0.5rem; width: 100%; margin-left: 0 !important; }
  .staff-ui .toolbar form select { flex: 1; }

  /* Tables become cards: one row per card, each cell labelled by its column. */
  .staff-ui .table-wrap { border: 0; overflow: visible; }
  .staff-ui table.data, .staff-ui table.data tbody, .staff-ui table.data tr, .staff-ui table.data td { display: block; width: 100%; }
  .staff-ui table.data thead { display: none; }
  .staff-ui table.data tr { border: 1px solid var(--border); border-radius: 8px; padding: 0.4rem 0; margin-bottom: 0.6rem; background: var(--bg); }
  .staff-ui table.data tbody tr:hover td { background: transparent; }
  .staff-ui table.data td { display: flex; justify-content: space-between; gap: 1rem; padding: 0.3rem 0.85rem; border: 0; white-space: normal; text-align: right !important; }
  .staff-ui table.data td::before { content: attr(data-label); color: var(--muted); font-size: 12px; font-weight: 500; text-align: left; flex: none; }
  .staff-ui table.data td:not([data-label])::before, .staff-ui table.data td[data-label=""]::before { content: none; }
  .staff-ui table.data td:first-child { font-size: 14px; }
  .staff-ui table.data td.wrap { flex-direction: column; text-align: left !important; gap: 0.15rem; }
  .staff-ui table.data td.actions { justify-content: flex-end; flex-wrap: wrap; }
  .staff-ui table.data td .secondary { text-align: right; }
  .staff-ui table.data td.empty { display: block; text-align: center !important; }
  .staff-ui table.data td:empty { display: none; }
}
