/* St Columba's Invoicing — global stylesheet
   Clean & professional theme. Single source of truth for app styling.
   (The invoice PDF template, invoice.html, is styled separately and is NOT
   affected by this file.) */

:root {
  /* Brand / accent */
  --brand:        #2f5d7c;   /* deep slate blue */
  --brand-dark:   #234a63;
  --brand-light:  #e8eef3;
  --accent:       #2f6f9f;   /* link blue */

  /* Neutrals */
  --bg:           #f4f5f7;   /* page background */
  --surface:      #ffffff;   /* cards / tables */
  --border:       #d9dde2;
  --border-strong:#b7bec7;
  --text:         #1f2a33;
  --text-muted:   #5d6b78;

  /* Status (meaning preserved from the original app) */
  --ok-bg:        #eef7ee;
  --due-bg:       #fff6da;
  --due-border:   #e8c766;
  --overdue-bg:   #fde3e0;
  --overdue-border:#e9a59c;

  /* Scale */
  --space:        16px;
  --radius:       8px;
  --shadow:       0 1px 3px rgba(20, 30, 40, 0.08), 0 1px 2px rgba(20, 30, 40, 0.06);
  --font:         system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
}

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

.site-header {
  background: var(--brand);
  color: #fff;
  box-shadow: var(--shadow);
}

.site-header .header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.site-header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.2px;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.site-nav a {
  color: #eaf1f6;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.9rem;
  white-space: nowrap;
  transition: background-color 0.12s ease;
}

.site-nav a:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

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

main.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 24px 64px;
}

/* ---------- Typography ---------- */

h2 { font-size: 1.4rem; margin: 1.4em 0 0.6em; font-weight: 600; }
h3 { font-size: 1.15rem; margin: 1.3em 0 0.5em; font-weight: 600; }
h2:first-child, h3:first-child { margin-top: 0; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

p { margin: 0.6em 0; }
em { color: var(--text-muted); }

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.6em 0;
}

ul { padding-left: 1.4em; }
li { margin: 0.25em 0; }

/* ---------- Tables ---------- */

table {
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin: 0.8em 0 1.4em;
  overflow: hidden;
}

table th,
table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

thead th {
  background: var(--brand-light);
  color: var(--text);
  font-weight: 600;
  border-bottom: 2px solid var(--border-strong);
  white-space: nowrap;
}

tbody tr:nth-child(even) { background: #fafbfc; }
tbody tr:last-child td { border-bottom: none; }

tfoot { font-weight: 700; }
tfoot tr td {
  border-top: 2px double var(--border-strong);
  background: var(--brand-light);
}

/* Right-align numeric tables (matches the original app) */
table#charges-matrix,
table.invoice,
table.owed { text-align: right; }
table#charges-matrix th,
table.invoice th,
table.owed th,
table#charges-matrix td,
table.invoice td,
table.owed td { text-align: right; }
table#charges-matrix td:first-child,
table.invoice td:first-child,
table.owed td:first-child,
table#charges-matrix th:first-child,
table.invoice th:first-child,
table.owed th:first-child { text-align: left; }

table#payments_review { max-width: 300px; }

/* Sortable tables: cue the clickable headers */
table.sortable thead th { cursor: pointer; }

/* ---------- Status row classes (global; meaning preserved) ---------- */

tr.overdue,
tr.overdue:nth-child(even) {
  background: var(--overdue-bg);
  box-shadow: inset 3px 0 0 var(--overdue-border);
}
tr.due,
tr.due:nth-child(even) {
  background: var(--due-bg);
  box-shadow: inset 3px 0 0 var(--due-border);
}
tr.nothing-owed td:first-child { text-decoration: line-through; color: var(--text-muted); }

/* ---------- Messages ---------- */

ul.messages {
  list-style: none;
  padding: 0;
  margin: 0 0 1.4em;
}
ul.messages li {
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow);
  margin: 0 0 8px;
  border-left: 4px solid var(--brand);
}
ul.messages li.success { background: var(--ok-bg);    border-left-color: #4c9a52; }
ul.messages li.error   { background: var(--overdue-bg);border-left-color: #c0392b; }
ul.messages li.warning { background: var(--due-bg);   border-left-color: #d39e00; }
ul.messages li.info    { background: var(--brand-light);border-left-color: var(--brand); }

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

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
textarea,
select {
  font: inherit;
  color: var(--text);
  padding: 8px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  max-width: 100%;
}
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}
textarea { width: 100%; min-height: 8em; }
label { font-weight: 600; }

button,
input[type="submit"],
.button {
  display: inline-block;
  font: inherit;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border: 1px solid var(--brand);
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 0.12s ease;
}
button:hover,
input[type="submit"]:hover,
.button:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  text-decoration: none;
}

/* ---------- Footer ---------- */

#footer {
  text-align: right;
  font-size: 0.8rem;
  color: var(--text-muted);
  padding: 16px 24px;
  max-width: 1100px;
  margin: 0 auto;
}
