/* Intendance: plain CSS, no build step. Designed for >= 1280 px, readable below. */

:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1f2328;
  --muted: #6b6f76;
  --border: #e2e0db;
  --accent: #2f6f5e;
  --accent-soft: #e3efe9;
  --warning: #b26a00;
  --error: #b3261e;
  --radius: 8px;
  --sidebar: 220px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }
body { margin: 0; }
h1 { font-size: 1.6rem; margin: 0 0 1rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
a { color: var(--accent); }
svg { width: 20px; height: 20px; flex: none; }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: .25rem;
  padding: 1rem .75rem;
  background: var(--surface);
  border-right: 1px solid var(--border);
}
.sidebar a, .sidebar button {
  display: flex;
  align-items: center;
  gap: .75rem;
  width: 100%;
  padding: .55rem .75rem;
  border: 0;
  border-radius: var(--radius);
  background: none;
  color: var(--text);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.sidebar a:hover, .sidebar button:hover { background: var(--bg); }
.sidebar a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.sidebar .brand { font-weight: 700; margin-bottom: .75rem; }
.nav { list-style: none; margin: 0; padding: 0; display: grid; gap: .15rem; }
.nav-footer { margin-top: auto; display: grid; gap: .15rem; }
.nav-footer form { margin: 0; }
.content { padding: 2rem 2.5rem; max-width: 1200px; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 64px 1fr; }
  .sidebar { padding: 1rem .5rem; }
  .sidebar .label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .sidebar a, .sidebar button { justify-content: center; padding: .6rem; }
  .content { padding: 1.25rem 1rem; }
}

/* Components */
.muted { color: var(--muted); }
.tiles {
  list-style: none; margin: 1.5rem 0 0; padding: 0;
  display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.tile {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  padding: 1.5rem 1rem; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); text-decoration: none;
}
.tile:hover { border-color: var(--accent); color: var(--accent); }
.tile svg { width: 32px; height: 32px; }
.empty {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  padding: 4rem 1rem; color: var(--muted);
  background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius);
}
.empty svg { width: 40px; height: 40px; }
.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.25rem 1.5rem; margin-bottom: 1.5rem; max-width: 480px;
}
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.message { padding: .6rem .9rem; border-radius: var(--radius); background: var(--accent-soft); }
.error { color: var(--error); margin: .25rem 0; }

.warning { display: inline-flex; align-items: center; gap: .3rem; color: var(--warning); }
.warning svg { width: 16px; height: 16px; }
.warning-text { font-size: .9rem; }

/* htmx indicator: styles live here because the CSP blocks htmx's injected <style> */
.htmx-indicator { opacity: 0; transition: opacity .2s ease-in; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.loading { display: inline-flex; align-items: center; gap: .4rem; color: var(--muted); }
.loading svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Forms */
.stack { display: grid; gap: .9rem; }
label { display: grid; gap: .3rem; font-weight: 500; }
input {
  font: inherit; padding: .55rem .7rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
}
input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button {
  font: inherit; padding: .55rem 1rem; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface); cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }

/* Standalone pages (login, 500) */
body.standalone { display: grid; place-items: center; min-height: 100vh; padding: 1rem; }
.card {
  width: 100%; max-width: 380px; padding: 2rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
}
