/* Dashboards. The form classes (form-ctnr, user-field, user-input, user-submit)
   follow retail/backend's. */
:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #22262b;
  --muted: #6b7380;
  --line: #e2e5ea;
  --accent: #2f5d8a;
  --accent-text: #ffffff;
  --ok-bg: #e8f4ec;
  --ok-text: #1d5b33;
  --bad-bg: #fbeaea;
  --bad-text: #8a2323;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181c;
    --surface: #1e2227;
    --text: #e6e8eb;
    --muted: #9aa2ad;
    --line: #2e333a;
    --accent: #6d9fd0;
    --accent-text: #0f1215;
    --ok-bg: #18301f;
    --ok-text: #9fd8b0;
    --bad-bg: #3a1c1c;
    --bad-text: #f0a8a8;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 1rem; }
code { font-size: 0.9em; color: var(--muted); }

#header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
#header .brand { font-weight: 600; color: var(--text); text-decoration: none; }
#header nav { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
#header .who { color: var(--muted); }

.link-button {
  background: none;
  border: 0;
  padding: 0;
  color: var(--accent);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
}
.link-button.danger { color: var(--bad-text); }
form.button_to { display: inline; }

.button, .user-submit {
  display: inline-block;
  background: var(--accent);
  color: var(--accent-text);
  border: 0;
  border-radius: 6px;
  padding: 0.55rem 1.1rem;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

#flash-ctnr { max-width: 60rem; margin: 1rem auto 0; padding: 0 1rem; }
.flash-message { padding: 0.6rem 0.9rem; border-radius: 6px; margin-bottom: 0.5rem; overflow-wrap: anywhere; }
.flash-success { background: var(--ok-bg); color: var(--ok-text); }
.flash-failure { background: var(--bad-bg); color: var(--bad-text); }

main { padding: 1rem; }
.page { max-width: 60rem; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.page-head h1 { margin: 0; }
.lede, .empty, .form-note { color: var(--muted); }

#user-form-page { display: flex; justify-content: center; padding-top: 2rem; }
.form-ctnr {
  width: 100%;
  max-width: 26rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1.75rem;
}
.form-ctnr-wide { max-width: 36rem; }
.user-form-title { text-align: center; }
.user-form-fields { display: flex; flex-direction: column; gap: 1rem; }
.user-field { display: flex; flex-direction: column; gap: 0.3rem; border: 0; padding: 0; margin: 0; }
.user-field-inline { display: flex; justify-content: space-between; align-items: center; }
.user-labels { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.04em; color: var(--muted); }
.user-input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
.user-inline-link { font-size: 0.9rem; }
.check-row { display: flex; gap: 0.5rem; align-items: center; }
.uf-error-summary { background: var(--bad-bg); color: var(--bad-text); border-radius: 6px; padding: 0.5rem 0.9rem; }
.uf-error-summary ul { margin: 0; padding-left: 1.1rem; }

.dashboard-list { list-style: none; padding: 0; display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); }
.dashboard-card {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 1rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
}
.dashboard-card:hover { border-color: var(--accent); }
.dashboard-name { font-weight: 600; }
.dashboard-description { color: var(--muted); font-size: 0.9rem; }

.list { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; }
.list th, .list td { text-align: left; padding: 0.6rem 0.8rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.list th { font-size: 0.75rem; color: var(--muted); letter-spacing: 0.04em; text-transform: uppercase; }
.list tr:last-child td { border-bottom: 0; }
.list .actions { white-space: nowrap; display: flex; gap: 0.75rem; }
.badge { margin-left: 0.4rem; font-size: 0.7rem; padding: 0.05rem 0.4rem; border-radius: 4px; background: var(--bg); color: var(--muted); border: 1px solid var(--line); }

@media (max-width: 640px) {
  .list thead { display: none; }
  .list tr { display: block; border-bottom: 1px solid var(--line); padding: 0.4rem 0; }
  .list td { display: block; border: 0; padding: 0.2rem 0.8rem; }
}
