/* ── Reset & base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  background: #e8e8e8;
  color: #000;
  padding: 20px;
}

/* ── Nav ── */
.app-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1a4d8f;
  color: #fff;
  padding: 10px 20px;
  margin-bottom: 20px;
  border-radius: 4px;
}
.nav-title { font-size: 15px; font-weight: bold; }
.nav-user  { display: flex; align-items: center; gap: 10px; font-size: 13px; }

.role-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
}
.role-senator { background: #c0392b; color: #fff; }
.role-aide    { background: #27ae60; color: #fff; }
.role-admin   { background: #8e44ad; color: #fff; }

.nav-signout {
  background: rgba(255,255,255,0.2);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.nav-signout:hover { background: rgba(255,255,255,0.3); }
.nav-link {
  color: #fff;
  font-size: 13px;
  text-decoration: none;
  padding: 4px 12px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.4);
}
.nav-link:hover { background: rgba(255,255,255,0.2); }

/* ── Flash messages ── */
.flash {
  padding: 10px 16px;
  margin-bottom: 12px;
  border-radius: 4px;
  font-size: 13px;
}
.flash-notice { background: #d4edda; border: 1px solid #c3e6cb; color: #155724; }
.flash-alert  { background: #f8d7da; border: 1px solid #f5c6cb; color: #721c24; }

/* ── Sheet wrapper ── */
.sheet {
  background: #fff;
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 28px 28px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}

/* ── Title bar ── */
.sheet-title {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 2px solid #000;
  padding-bottom: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
  gap: 6px;
}

.sheet-title strong { font-size: 15px; text-decoration: underline; }
.title-meta { font-size: 13px; white-space: nowrap; }

.pp-input {
  width: 48px;
  border: none;
  border-bottom: 1px solid #555;
  text-align: center;
  font-size: 13px;
  padding: 1px 2px;
  background: #f0f4ff;
}
.pp-input:focus { outline: 2px solid #4a7acc; border-radius: 2px; }

/* ── Header fields ── */
.header-fields {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px 24px;
  margin-bottom: 18px;
  align-items: end;
}

.header-fields label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  gap: 3px;
}

.start-label { font-weight: 600; }

.header-fields input[type="date"] {
  border: 1px solid #bbb;
  border-radius: 3px;
  padding: 4px 6px;
  font-size: 13px;
  width: 180px;
}

.name-display {
  font-size: 14px;
  padding: 3px 2px;
  border-bottom: 2px solid #333;
  min-width: 260px;
  display: inline-block;
}

.name-input {
  border: none;
  border-bottom: 2px solid #333;
  font-size: 14px;
  padding: 3px 2px;
  width: 260px;
  background: transparent;
}
.name-input:focus { outline: none; border-bottom-color: #4a7acc; }

/* ── Time tables ── */
.time-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 0;
}

.week2-table { margin-top: 16px; }

.time-table th,
.time-table td {
  border: 1px solid #999;
  padding: 5px 6px;
  text-align: center;
  vertical-align: middle;
}

.time-table thead th {
  background: #dde3f0;
  font-size: 12px;
  line-height: 1.3;
}

.time-table tbody tr:nth-child(even) { background: #f9f9f9; }
.time-table tbody tr:hover { background: #eef3ff; }

/* Row inputs */
.time-table input[type="time"],
.time-table input[type="number"],
.time-table input[type="text"] {
  border: 1px solid #bbb;
  border-radius: 3px;
  padding: 3px 4px;
  font-size: 12px;
  text-align: center;
  background: #fff;
  width: 100%;
}
.time-table input[type="time"] { min-width: 82px; }
.time-table input[type="number"] { width: 54px; }
.time-table input[type="text"]  { width: 68px; }

.time-table input:focus { outline: 2px solid #4a7acc; }
.time-table input.invalid { border-color: #c0392b; background: #fff0ee; }

/* Total hours cell in each row */
.row-total {
  font-weight: 600;
  color: #1a4d8f;
  min-width: 52px;
}
.row-total.invalid { color: #c0392b; }

/* ── Totals footer row ── */
.totals-row td {
  background: #dde3f0;
  font-size: 13px;
  padding: 7px 8px;
}

.total-label { text-align: right; }
.total-value { font-weight: 700; color: #1a4d8f; }

.decimal-parens {
  display: block;
  font-size: 11px;
  font-weight: 400;
  color: #444;
}
.decimal-parens:not(:empty)::before { content: '('; }
.decimal-parens:not(:empty)::after  { content: ')'; }

/* ── Due notice ── */
.due-notice {
  border: 1px solid #999;
  text-align: center;
  padding: 8px 16px;
  margin-top: 18px;
  font-size: 13px;
  background: #f7f7f7;
}

/* ── Signature section ── */
.signature-section {
  display: flex;
  gap: 48px;
  margin-top: 20px;
  align-items: flex-end;
}

.sig-line {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.sig-label { font-size: 14px; font-weight: 600; white-space: nowrap; }

.sig-underline {
  display: inline-block;
  border-bottom: 2px solid #333;
  width: 240px;
  height: 22px;
}
.sig-underline.short { width: 120px; }

/* ── Quarter-hour note ── */
.quarter-note {
  font-size: 11px;
  margin-top: 10px;
  color: #555;
}

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 7px 16px;
  border-radius: 4px;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  border: 1px solid transparent;
}
.btn-primary   { background: #1a4d8f; color: #fff; border-color: #1a4d8f; }
.btn-primary:hover { background: #163f74; }
.btn-secondary { background: #6c757d; color: #fff; border-color: #6c757d; }
.btn-secondary:hover { background: #565e64; }
.btn-danger    { background: #c0392b; color: #fff; border-color: #c0392b; }
.btn-danger:hover { background: #a93226; }
.btn-sm        { padding: 4px 10px; font-size: 12px; background: #e9ecef; border-color: #ced4da; color: #333; }
.btn-sm:hover  { background: #dde2e8; }

/* ── Action bar (show page) ── */
.action-bar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
  flex-wrap: wrap;
}

/* ── Status badges ── */
.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: bold;
}
.status-draft     { background: #fff3cd; border: 1px solid #ffc107; color: #856404; }
.status-submitted { background: #cce5ff; border: 1px solid #4a7acc; color: #004085; }
.status-approved  { background: #d4edda; border: 1px solid #28a745; color: #155724; }

/* ── Timesheet list table ── */
.list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 16px;
}
.list-table th, .list-table td {
  border: 1px solid #dee2e6;
  padding: 8px 10px;
  text-align: left;
}
.list-table thead th { background: #dde3f0; font-size: 12px; }
.list-table tbody tr:hover { background: #f8f9fa; }

/* ── Auth forms ── */
.auth-wrap {
  max-width: 400px;
  margin: 40px auto;
  background: #fff;
  padding: 28px;
  border-radius: 6px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.auth-wrap h2 { margin-bottom: 20px; color: #1a4d8f; }
.field {
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field label { font-size: 13px; font-weight: 600; }
.field input, .field select {
  border: 1px solid #bbb;
  border-radius: 3px;
  padding: 7px 9px;
  font-size: 14px;
  width: 100%;
}
.field input:focus, .field select:focus { outline: 2px solid #4a7acc; }
.auth-alt { margin-top: 14px; font-size: 13px; text-align: center; }
.form-errors {
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 14px;
  font-size: 13px;
  color: #721c24;
}
.form-errors ul { margin: 0; padding-left: 16px; }
.empty-msg { color: #666; margin-top: 16px; }

/* ── Print styles ── */
@media print {
  body { background: #fff; padding: 0; font-size: 10pt; }

  .sheet {
    box-shadow: none;
    padding: 0;
    max-width: 100%;
  }

  .no-print { display: none !important; }

  .header-fields input[type="date"] { border: none; }

  .time-table, .time-table th, .time-table td {
    border-color: #000 !important;
  }

  .time-table thead th,
  .totals-row td {
    background: #dde3f0 !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .time-table input[type="time"],
  .time-table input[type="number"],
  .time-table input[type="text"] {
    border: none;
    background: transparent;
  }

  .pp-input  { border: none; background: transparent; }
  .name-display { border-bottom: 1px solid #000; }

  .due-notice { border-color: #000 !important; }

  @page { size: letter portrait; margin: 0.55in 0.5in; }

  table { page-break-inside: avoid; }
  .week2-table { page-break-before: avoid; }
}
