/* Care Happiness admin — palette sampled from the company logo. */

:root {
  --blue: #105689;
  --blue-dark: #0C4269;
  --orange: #F8991E;
  --yellow: #F8D731;
  --purple: #642165;
  --green: #136734;
  --green-light: #58BA48;

  --bg: #F5F8FA;
  --surface: #FFFFFF;
  --surface-alt: #EDF3F7;
  --border: #D3DEE6;
  --text: #0E2130;
  --muted: #5B6F7E;

  /* Emergency red, deliberately not brand orange — orange is decorative here. */
  --danger: #C1121F;
  --danger-bg: #FCE8E9;
  --warn: #8A6100;
  --warn-bg: #FDF3D4;
  --ok-bg: #E4F3E8;

  --radius: 12px;
  --shadow: 0 1px 3px rgba(14, 33, 48, .08), 0 4px 12px rgba(14, 33, 48, .05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0 0 .5rem; line-height: 1.25; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
a { color: var(--blue); }

.boot { display: grid; place-items: center; min-height: 100vh; }
.spinner {
  width: 32px; height: 32px; border-radius: 50%;
  border: 3px solid var(--border); border-top-color: var(--blue);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- layout */

.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }
@media (max-width: 820px) { .shell { grid-template-columns: 1fr; } }

.side {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem .75rem;
  display: flex; flex-direction: column; gap: .15rem;
}
@media (max-width: 820px) {
  .side { border-right: 0; border-bottom: 1px solid var(--border); flex-direction: row; flex-wrap: wrap; }
}
.brand { display: flex; align-items: center; gap: .55rem; padding: .25rem .5rem 1rem; }
.brand img { width: 34px; height: 34px; object-fit: contain; }
.brand span { font-weight: 800; font-size: 1.02rem; }
.brand .c { color: var(--blue); }
.brand .h { color: var(--orange); }

.nav {
  display: block; padding: .6rem .7rem; border-radius: 9px;
  color: var(--text); text-decoration: none; font-weight: 600; font-size: .93rem;
  border: 1px solid transparent;
}
.nav:hover { background: var(--surface-alt); }
.nav.on { background: var(--blue); color: #fff; }
.nav .count {
  float: right; background: var(--danger); color: #fff; border-radius: 99px;
  font-size: .72rem; padding: 0 .42rem; font-weight: 800; line-height: 1.5;
}
.nav.on .count { background: #fff; color: var(--danger); }

.side .spacer { flex: 1; }
@media (max-width: 820px) { .side .spacer { display: none; } }
.who { padding: .5rem .7rem; font-size: .82rem; color: var(--muted); border-top: 1px solid var(--border); }

.main { padding: 1.5rem; max-width: 1180px; }
@media (max-width: 560px) { .main { padding: 1rem; } }
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.sub { color: var(--muted); font-size: .92rem; }

/* ----------------------------------------------------------- components */

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.card > h2 { margin-bottom: .75rem; }

.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.tiles { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: .9rem; }
.tile .n { font-size: 1.7rem; font-weight: 800; line-height: 1.1; }
.tile .k { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }

button, .btn {
  font: inherit; font-weight: 700; cursor: pointer;
  border-radius: 10px; border: 1px solid var(--blue);
  background: var(--blue); color: #fff;
  padding: .6rem 1rem; min-height: 42px;
  text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
}
button:hover, .btn:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
button:disabled { background: var(--surface-alt); border-color: var(--border); color: var(--muted); cursor: not-allowed; }
button.ghost, .btn.ghost { background: var(--surface); color: var(--blue); border-color: var(--border); }
button.ghost:hover { background: var(--surface-alt); }
button.danger { background: var(--danger); border-color: var(--danger); }
button.small { padding: .35rem .7rem; min-height: 34px; font-size: .85rem; }

label { display: block; font-size: .8rem; font-weight: 700; color: var(--muted); margin: .75rem 0 .3rem; letter-spacing: .03em; }
input, select, textarea {
  font: inherit; width: 100%; padding: .55rem .7rem; min-height: 42px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: var(--blue); }
textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 160px; }
.row > .fit { flex: 0 0 auto; }

table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .5rem; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
tbody tr:hover { background: var(--surface-alt); }
.scroll { overflow-x: auto; }

.pill {
  display: inline-block; padding: .1rem .5rem; border-radius: 99px;
  font-size: .72rem; font-weight: 800; letter-spacing: .03em;
  background: var(--surface-alt); color: var(--muted);
}
.pill.ok { background: var(--ok-bg); color: var(--green); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--danger-bg); color: var(--danger); }
.pill.info { background: #E7EFF5; color: var(--blue); }

.note { padding: .7rem .85rem; border-radius: 10px; font-size: .9rem; margin: .6rem 0; }
.note.err { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }
.note.ok { background: var(--ok-bg); color: var(--green); border: 1px solid var(--green); }
.note.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn); }
.note code { word-break: break-all; font-size: .85em; }

.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* --------------------------------------------------------- auth screens */

.auth { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; }
.auth .box { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 1.6rem; box-shadow: var(--shadow); }
.auth img.logo { display: block; width: 130px; margin: 0 auto 1rem; }
.auth h1 { text-align: center; font-size: 1.25rem; }
.auth .sub { text-align: center; margin-bottom: .5rem; }
.auth button { width: 100%; margin-top: 1.1rem; }
.auth .link { display: block; text-align: center; margin-top: .9rem; font-size: .88rem; }

/* Alert board rows need to shout without relying on colour alone. */
.alert-row { border-left: 4px solid var(--danger); }
.alert-row.ack { border-left-color: var(--warn); }
