:root {
  --bg: #f4f5f7;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --border: #e2e4e9;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success-bg: #ecfdf3;
  --success-text: #027a48;
  --error-bg: #fef3f2;
  --error-text: #b42318;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

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

main {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}

h1 {
  font-size: 1.5rem;
  margin-bottom: 16px;
}

h2 {
  font-size: 1.1rem;
  margin: 32px 0 8px;
}

a {
  color: var(--primary);
  text-decoration: none;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.topbar span {
  font-weight: 600;
}

.auth-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.auth-card {
  background: var(--card);
  padding: 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  width: 100%;
  max-width: 340px;
}

.auth-card h1 {
  font-size: 1.25rem;
  text-align: center;
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 14px;
}

input, select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.95rem;
  background: #fff;
  color: var(--text);
}

button {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 6px;
  background: var(--primary);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  background: var(--primary-dark);
}

.entry-form, .range-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 24px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
}

.entry-form p {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.entry-form button, .range-form button {
  width: auto;
  padding: 9px 20px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-bottom: 8px;
}

th, td {
  text-align: left;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}

th {
  background: #fafafa;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tr:last-child td {
  border-bottom: none;
}

.total-row td {
  font-weight: 700;
  background: #fafafa;
}

.success {
  background: var(--success-bg);
  color: var(--success-text);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
}

.error {
  background: var(--error-bg);
  color: var(--error-text);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
}

.add-worker {
  margin-top: 40px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.inline-form {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
}

.inline-form button {
  width: auto;
  padding: 9px 20px;
}

.role-choice {
  font-size: 0.85rem;
}

.role-choice .field-label {
  display: block;
  color: var(--muted);
  margin-bottom: 4px;
}

.role-options {
  display: flex;
  gap: 14px;
  margin-top: 4px;
}

.role-options label {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 0;
  font-size: 0.9rem;
  color: var(--text);
}

.role-options input[type="radio"] {
  width: auto;
  margin: 0;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

.inline-delete {
  display: inline;
  margin: 0;
}

.btn-danger {
  width: auto;
  padding: 4px 10px;
  font-size: 0.8rem;
  background: #dc2626;
}

.btn-danger:hover {
  background: #b91c1c;
}
