/* Shared look of the Nodge templates. Every template carries an exact copy;
   change it per app as you like. No build step, no framework. */

:root {
  --bg: #f6f6f3;
  --sunk: #efefeb;
  --surface: #ffffff;
  --text: #1c1c1a;
  --muted: #6a6a64;
  --line: #e2e2dc;
  --accent: #2f5be0;
  --accent-text: #ffffff;
  --ok: #1d7f47;
  --warn: #a96500;
  --bad: #c42e2e;
  --radius: 8px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --sunk: #111110;
    --surface: #1f1f1d;
    --text: #ecece8;
    --muted: #9a9a93;
    --line: #2f2f2c;
    --accent: #7c9bff;
    --accent-text: #0e0e0d;
    --ok: #4cc584;
    --warn: #e0a548;
    --bad: #ff7a72;
    --shadow: none;
    color-scheme: dark;
  }
}

* { 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); }
img { max-width: 100%; }

/* Header and navigation */
header.top {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
header.top .brand { font-weight: 650; color: var(--text); text-decoration: none; }
header.top nav { display: flex; gap: 18px; flex: 1; flex-wrap: wrap; }
header.top nav a { color: var(--muted); text-decoration: none; }
header.top nav a:hover, header.top nav a.active { color: var(--text); }
header.top form { margin: 0; }

main { max-width: 1100px; margin: 0 auto; padding: 24px; }
main.narrow { max-width: 640px; }
footer.foot { max-width: 1100px; margin: 0 auto; padding: 8px 24px 32px; color: var(--muted); font-size: 0.85rem; }

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 16px; }
h2 { font-size: 1.15rem; margin: 28px 0 12px; }
h3 { font-size: 1rem; margin: 0 0 6px; }
p { margin: 0 0 12px; }

/* Page title row with actions on the right */
.bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.bar h1 { margin: 0; flex: 1; }

/* Blocks */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1; min-width: 160px; }
.row > .fit { flex: 0 0 auto; min-width: 0; }

/* Tables */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-weight: 600; font-size: 0.85rem; color: var(--muted); background: var(--sunk); }
tr:last-child td { border-bottom: 0; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 600; background: var(--sunk); }

/* Forms */
label { display: block; font-weight: 500; margin-bottom: 4px; }
input, select, textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, .button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
input[type="checkbox"], input[type="radio"] { width: auto; margin-right: 6px; }
.hint { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

/* Buttons */
button, .button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
}
button.secondary, .button.secondary { background: var(--surface); color: var(--text); border-color: var(--line); }
button.danger, .button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 400; }
button:disabled { opacity: 0.5; cursor: default; }

/* Small labels and messages */
.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--sunk);
}
.badge.ok { color: var(--ok); border-color: currentColor; }
.badge.warn { color: var(--warn); border-color: currentColor; }
.badge.bad { color: var(--bad); border-color: currentColor; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.notice {
  padding: 10px 14px;
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
}
.notice.ok { border-left-color: var(--ok); }
.notice.bad { border-left-color: var(--bad); }
.empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* Sign-in page */

/* Kanban-style columns */
.board { display: flex; gap: 16px; align-items: flex-start; overflow-x: auto; padding-bottom: 8px; }
.column {
  flex: 0 0 280px;
  background: var(--sunk);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}
.column h2 { display: flex; justify-content: space-between; font-size: 0.95rem; margin: 0 0 10px; }
.column .card { padding: 10px 12px; margin-bottom: 8px; }
.column .card[draggable="true"] { cursor: grab; }
.column.drop { outline: 2px dashed var(--accent); outline-offset: 2px; }

/* Month calendar */
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.calendar > div { background: var(--surface); min-height: 88px; padding: 6px 8px; font-size: 0.85rem; }
.calendar > div.head { min-height: 0; background: var(--sunk); color: var(--muted); font-weight: 600; }
.calendar > div.off { background: var(--sunk); color: var(--muted); }

/* Uptime bars */
.bars { display: flex; gap: 2px; height: 28px; }
.bars span { flex: 1; border-radius: 2px; background: var(--ok); }
.bars span.warn { background: var(--warn); }
.bars span.bad { background: var(--bad); }
.bars span.none { background: var(--line); }

/* Utilities */
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
/* A spam trap field that people never see. */
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
/* Hidden fields at the top of a .stack form add no gap. */
.stack > input[type="hidden"] + *, .stack > .hp + * { margin-top: 0; }

@media (max-width: 640px) {
  header.top { flex-wrap: wrap; gap: 12px; padding: 12px 16px; }
  main { padding: 16px; }
  table { display: block; overflow-x: auto; }
}

@media print {
  header.top, footer.foot, .no-print { display: none; }
  body { background: #fff; color: #000; }
  main { max-width: none; padding: 0; }
  .card, table { box-shadow: none; }
}
