/* ---------------------------------------------------------------------------
   Plain theme.

   A deliberately quiet default: system fonts, one accent colour, no layout
   tricks beyond a flex row and a grid of tiles.
--------------------------------------------------------------------------- */

:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --border: #d8d8dd;
  --text: #1c1c1e;
  --muted: #6b6b73;
  --accent: #2f5d8a;
  --danger: #a3352b;
  --radius: 6px;
}

* { box-sizing: border-box; }

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

a { color: var(--accent); }

/* --- Header --------------------------------------------------------------- */

.site-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(--border);
}

.site-title {
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--text);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-user { color: var(--muted); }

/* --- Layout --------------------------------------------------------------- */

.site-body {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem;
}

/* The sidebar collapses to nothing when its block is empty, so pages that do
   not use it are not left with a blank column. */
.site-sidebar:empty { display: none; }

.site-sidebar {
  flex: 0 0 12rem;
  padding: 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.site-content { flex: 1 1 auto; min-width: 0; }

h1 { font-size: 1.5rem; margin-top: 0; }

/* --- Dashboard tiles ------------------------------------------------------ */

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
  gap: 1rem;
  padding: 0;
  margin: 0;
  list-style: none;
}

.tile {
  display: block;
  /* The grid stretches each <li> to the tallest tile in its row, but the <a>
     inside it is only as tall as its own text. Without this, a tile with a
     short description stops short of the row's bottom edge and the border
     ends mid-cell. Only visible once there is more than one tile per row. */
  height: 100%;
  padding: 1rem;
  text-decoration: none;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.tile:hover { border-color: var(--accent); }

.tile-icon { font-size: 1.75rem; line-height: 1; }
.tile-name { display: block; font-weight: 600; margin-top: 0.5rem; }
.tile-description { display: block; color: var(--muted); font-size: 0.9rem; }

.empty-note { color: var(--muted); }

/* --- Forms ---------------------------------------------------------------- */

.auth-form {
  max-width: 22rem;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.auth-form p { margin: 0 0 1rem; }

.auth-form label { display: block; font-weight: 600; margin-bottom: 0.25rem; }

.auth-form input {
  width: 100%;
  padding: 0.5rem;
  font: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

button {
  padding: 0.5rem 1rem;
  font: inherit;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

button:hover { opacity: 0.9; }

.errorlist {
  margin: 0 0 1rem;
  padding: 0.5rem 1rem;
  color: var(--danger);
  list-style: none;
  border: 1px solid var(--danger);
  border-radius: var(--radius);
}

.helptext { display: block; font-size: 0.85rem; color: var(--muted); }
