/*
 * Application-wide styles for Pilates Payroll.
 */

:root {
  --ink: #1f2430;
  --muted: #6b7280;
  --border: #e2e5ea;
  --bg: #f7f8fa;
  --card: #ffffff;
  --accent: #7c5cff;
  --accent-dark: #5f3fe0;
  --green: #1a8754;
  --red: #d64545;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  margin: 0;
}

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.wrap.wide { max-width: 1440px; }

.site-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.site-header .brand { font-weight: 700; font-size: 1.1rem; color: var(--ink); text-decoration: none; }
.site-header nav a {
  color: var(--muted);
  text-decoration: none;
  margin-left: 20px;
  font-size: 0.95rem;
  padding-bottom: 4px;
  border-bottom: 2px solid transparent;
}
.site-header nav a:hover { color: var(--ink); }
.site-header nav a.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.site-header nav a.logout-link { color: var(--red); }

.auth-page { min-height: calc(100vh - 60px); display: flex; align-items: center; justify-content: center; padding: 24px 0; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font-size: 1.3rem; }

main.wrap { padding-top: 32px; padding-bottom: 64px; }

h1 { font-size: 1.6rem; margin: 0 0 4px; }
h2 { font-size: 1.2rem; margin: 32px 0 12px; }
h3 { font-size: 1rem; margin: 20px 0 8px; }
.subtitle { color: var(--muted); margin: 0 0 24px; }

.page-header { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 12px; }

.flash { padding: 10px 16px; border-radius: var(--radius); margin-bottom: 20px; font-size: 0.95rem; }
.flash.notice { background: #e9f9f0; color: var(--green); }
.flash.alert { background: #fdecec; color: var(--red); }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
table th, table td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--border); }
table th { color: var(--muted); font-weight: 600; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; }
table td.num, table th.num { text-align: right; font-variant-numeric: tabular-nums; }
table tr:last-child td { border-bottom: none; }
table tfoot td, tr.total-row td { font-weight: 700; border-top: 2px solid var(--ink); }
.table-scroll { overflow-x: auto; }

.rates-table th, .rates-table td { white-space: nowrap; padding: 6px 8px; }
.rates-table thead tr:first-child th { text-align: center; border-bottom: 1px solid var(--border); }
.rates-table thead tr:last-child th { font-size: 0.72rem; }
.rate-input { width: 66px; padding: 6px 7px; text-align: right; transition: background-color 0.15s ease; }
.rate-input.just-saved { background-color: #e9f9f0; }
.row-actions { display: flex; gap: 6px; margin-top: 4px; }
.rates-table .staff-cell { white-space: normal; min-width: 150px; }
.rates-table .staff-cell strong { display: block; font-weight: 600; }
.rates-table .staff-cell strong a { color: var(--ink); text-decoration: none; }
.rates-table .staff-cell strong a:hover { text-decoration: underline; }
.rates-table .staff-meta { color: var(--muted); font-size: 0.8rem; }
.rates-table td.staff-name-cell, .rates-table thead tr:first-child th:first-child {
  position: sticky;
  left: 0;
  background: var(--card);
  box-shadow: 1px 0 0 var(--border);
  z-index: 1;
}

.btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--accent-dark); }
.btn.secondary { background: transparent; color: var(--ink); border: 1px solid var(--border); }
.btn.secondary:hover { background: #f0f1f4; }
.btn.danger { background: transparent; color: var(--red); border: 1px solid #f3cbcb; }
.btn.danger:hover { background: #fdecec; }
.btn.small { padding: 5px 12px; font-size: 0.82rem; }

.actions { display: flex; gap: 10px; margin: 20px 0; }

form .field { margin-bottom: 16px; }
form label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 5px; }
form .hint { color: var(--muted); font-size: 0.82rem; margin-top: 4px; }
input[type="text"], input[type="number"], input[type="file"], input[type="email"], input[type="password"], select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
}
input[type="checkbox"] { width: 16px; height: 16px; }
.error-messages { background: #fdecec; color: var(--red); padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 0.9rem; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 0.76rem; font-weight: 600; background: #ece9fe; color: var(--accent-dark); }
.badge.muted { background: #eceef1; color: var(--muted); }
.badge.warn { background: #fff4e0; color: #9a6300; }

.empty-state { color: var(--muted); padding: 40px 0; text-align: center; }

.rate-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 720px) { .rate-grid { grid-template-columns: 1fr; } }
.rate-grid h3 { grid-column: 1 / -1; margin-bottom: 0; }

.issues-list { list-style: none; padding: 0; margin: 0; }
.issues-list li { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.issues-list li:last-child { border-bottom: none; }
