/* FamilyDash admin — vanilla CSS, no framework, no build step.
   Palette echoes the app's Moon Garden theme. */

:root {
  --deep:    #0d1a15;
  --mid:     #14261f;
  --raised:  #1b3229;
  --line:    #2c4a3d;
  --ink:     #eef3ef;
  --sage:    #9db8a8;
  --moon:    #f2ecd9;
  --gold:    #e6c06a;
  --rose:    #e08f8f;
  --leaf:    #7fb894;
  --radius:  12px;
}

* { box-sizing: border-box; }

/* Must outrank the layout rules below. The UA's `[hidden] { display: none }`
   loses to any class selector that sets display — `.signin { display: grid }`
   kept the sign-in panel on screen and pushed the whole admin UI below the
   fold, which looked exactly like a failed sign-in. */
[hidden] { display: none !important; }

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

h1 { margin: 0 0 4px; font-size: 24px; font-weight: 600; }
.muted { color: var(--sage); font-size: 13px; }
.spacer { flex: 1; }

/* --- sign in ---------------------------------------------------------- */
.signin {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.signin .card {
  width: min(360px, 100%);
  background: var(--mid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  display: flex;
  flex-direction: column;
}
.signin label { margin-top: 14px; font-size: 13px; color: var(--sage); }
.signin #signin-button { margin-top: 20px; }

.google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
  padding: 11px 16px;
  background: #fff;
  border-color: #dadce0;
  color: #1f1f1f;
  font-weight: 600;
}
.google:hover { background: #f4f4f4; }

/* "or" rule: a line either side of the label. */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 2px;
  color: var(--sage);
  font-size: 12px;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* --- chrome ----------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--mid);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 600; }
.household {
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--sage);
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 12px 20px 0;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.tab {
  background: none;
  border: 1px solid transparent;
  border-bottom: none;
  color: var(--sage);
  padding: 9px 18px;
  border-radius: var(--radius) var(--radius) 0 0;
  cursor: pointer;
  font: inherit;
  white-space: nowrap;
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] {
  background: var(--raised);
  border-color: var(--line);
  color: var(--ink);
  margin-bottom: -1px;
}

.content { padding: 24px 20px 64px; max-width: 1100px; margin: 0 auto; }

/* --- forms ------------------------------------------------------------ */
.row-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  background: var(--mid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}
.row-form.stacked { align-items: flex-start; }
.row-form label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  color: var(--sage);
}
.row-form label.wide { flex: 1 1 100%; }

input, select, textarea {
  background: var(--deep);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  padding: 8px 10px;
  font: inherit;
  min-width: 0;
}
textarea { resize: vertical; width: 100%; }
input[type="color"] { padding: 2px; width: 52px; height: 38px; cursor: pointer; }
input[type="number"] { width: 92px; }
input:focus, select:focus, textarea:focus, button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

button {
  border-radius: 8px;
  padding: 9px 16px;
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--line);
}
button:disabled { opacity: .55; cursor: default; }
.primary { background: var(--gold); border-color: var(--gold); color: #23201a; font-weight: 600; }
.ghost { background: transparent; color: var(--sage); }
.ghost:hover:not(:disabled) { color: var(--ink); }
.danger { background: transparent; border-color: transparent; color: var(--rose); padding: 5px 9px; }
.link { background: none; border: none; color: var(--sage); padding: 5px 9px; text-decoration: underline; }
.link:hover { color: var(--ink); }

/* --- tables ----------------------------------------------------------- */
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--mid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
th, td {
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--sage); font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--raised); }
td.actions, th.actions { text-align: right; white-space: nowrap; width: 1%; }
td.empty { color: var(--sage); text-align: center; padding: 28px; }
.swatch { width: 18px; height: 18px; border-radius: 50%; display: inline-block; border: 1px solid var(--line); }
.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--sage);
}
.pill.on { color: var(--leaf); border-color: var(--leaf); }
.clip { max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

/* --- messages --------------------------------------------------------- */
.error { color: var(--rose); font-size: 13px; margin: 8px 0 0; }
.banner {
  margin: 0;
  padding: 11px 20px;
  background: #3a1f1f;
  border-bottom: 1px solid var(--rose);
}

@media (max-width: 620px) {
  .row-form label { flex: 1 1 100%; }
  .clip { max-width: 22ch; }
  .topbar .muted { display: none; }
}

/* --- API tokens -------------------------------------------------------- */
.lede {
  margin: 0 0 18px;
  color: var(--sage);
  font-size: 13px;
  max-width: 70ch;
}
.speclink { color: var(--gold); white-space: nowrap; }

/* The one moment the plaintext token exists in the UI. */
.reveal {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--gold);
  border-radius: var(--radius);
  background: rgba(230, 192, 106, .08);
}
.reveal code {
  flex: 1 1 320px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  word-break: break-all;
  color: var(--ink);
}
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; color: var(--sage); }
.pill.off { color: var(--rose); border-color: var(--rose); }
