*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

/* ── Passwort-Overlay ── */
#password-overlay {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #1a3a5c 0%, #2d6a9f 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
#password-overlay.hidden { display: none; }

.pw-box {
  background: #fff;
  border-radius: 10px;
  padding: 40px 48px;
  box-shadow: 0 8px 32px rgba(0,0,0,.3);
  text-align: center;
  min-width: 320px;
}
.pw-box h2 { font-size: 20px; margin-bottom: 8px; color: #1a3a5c; }
.pw-box p  { color: #666; margin-bottom: 24px; font-size: 13px; }
.pw-box input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid #ccc;
  border-radius: 6px;
  font-size: 15px;
  margin-bottom: 16px;
  outline: none;
}
.pw-box input:focus { border-color: #2d6a9f; }
.pw-box button {
  width: 100%;
  padding: 11px;
  background: #2d6a9f;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 15px;
  cursor: pointer;
}
.pw-box button:hover { background: #1a3a5c; }
#pw-error { color: #c0392b; font-size: 13px; margin-top: 10px; display: none; }

/* ── Toolbar ── */
#toolbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #1a3a5c;
  color: #fff;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}
#toolbar h1 { font-size: 16px; flex: 1; }
#toolbar button {
  padding: 8px 18px;
  border: none;
  border-radius: 5px;
  font-size: 13px;
  cursor: pointer;
  font-weight: bold;
}
#btn-pdf  { background: #e67e22; color: #fff; }
#btn-pdf:hover  { background: #d35400; }
#btn-clear { background: #7f8c8d; color: #fff; }
#btn-clear:hover { background: #636e72; }
#btn-logout { background: transparent; color: #fff; border: 1px solid rgba(255,255,255,.4) !important; }
#btn-logout:hover { background: rgba(255,255,255,.1); }

.punch-group {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,.1);
  padding: 6px 12px;
  border-radius: 8px;
}
#live-clock {
  font-size: 18px;
  font-weight: bold;
  font-variant-numeric: tabular-nums;
  min-width: 52px;
  text-align: center;
}
#btn-kommen {
  background: #27ae60;
  color: #fff;
  padding: 10px 22px;
  font-size: 14px;
}
#btn-kommen:hover { background: #219a52; }
#btn-gehen {
  background: #e74c3c;
  color: #fff;
  padding: 10px 22px;
  font-size: 14px;
}
#btn-gehen:hover { background: #c0392b; }
#punch-toast {
  font-size: 12px;
  background: rgba(255,255,255,.15);
  padding: 4px 10px;
  border-radius: 4px;
  min-width: 120px;
  text-align: center;
  opacity: 0;
  transition: opacity .3s;
}
#punch-toast.show { opacity: 1; }
#save-status {
  font-size: 11px;
  opacity: .7;
  min-width: 70px;
}

tr.punch-highlight td { background: #fff9c4 !important; }
tr.punch-highlight input { background: #fff9c4 !important; }

/* Tage außerhalb des Monats */
tr.outside-month td {
  background: #e9e9e9 !important;
  color: #888;
}
tr.outside-month input {
  background: #e9e9e9 !important;
  color: #999;
  cursor: not-allowed;
}
tr.outside-month .sum-cell {
  background: #dedede !important;
  color: #aaa;
}
table.az-table input.date-input.outside-date {
  background: #e9e9e9 !important;
  color: #999;
  font-style: italic;
}

/* ── Formular-Container ── */
#form-wrapper {
  max-width: 1200px;
  margin: 20px auto;
  padding: 0 16px 40px;
}

#arbeitszeitliste {
  background: #fff;
  padding: 18px 20px 24px;
  box-shadow: 0 2px 12px rgba(0,0,0,.15);
}

/* ── Kopfzeile ── */
.form-title {
  text-align: center;
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 14px;
  letter-spacing: .3px;
}
.header-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 24px;
  margin-bottom: 12px;
  font-size: 11px;
}
.header-fields .field {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.header-fields .field label { white-space: nowrap; font-weight: bold; }
.header-fields .field input,
.header-fields .field select {
  flex: 1;
  border: none;
  border-bottom: 1px solid #333;
  background: transparent;
  font-size: 11px;
  padding: 2px 4px;
  outline: none;
  min-width: 0;
}
.header-fields .field input:focus,
.header-fields .field select:focus { border-bottom-color: #2d6a9f; }

.form-title select,
.form-title input[type="number"] {
  border: none;
  border-bottom: 1px solid #333;
  background: transparent;
  font-size: 15px;
  font-weight: bold;
}
.form-title input[type="number"] {
  width: 60px;
  text-align: center;
}

/* ── Wochen-Blöcke ── */
.week-block { margin-bottom: 0; }

table.az-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 10px;
}
table.az-table th,
table.az-table td {
  border: 1px solid #333;
  padding: 2px 3px;
  text-align: center;
  vertical-align: middle;
}
table.az-table th {
  background: #f0f0f0;
  font-weight: bold;
  font-size: 9px;
  line-height: 1.3;
}
table.az-table td.day-label {
  font-weight: bold;
  background: #fafafa;
  width: 28px;
}
table.az-table input[type="text"].time-input,
table.az-table input[type="text"].date-input,
table.az-table input[type="text"] {
  width: 100%;
  border: none;
  background: transparent;
  font-size: 10px;
  text-align: center;
  padding: 1px;
  outline: none;
}
table.az-table input[type="text"].time-input { min-width: 0; letter-spacing: 0.3px; }
table.az-table input[type="text"].date-input { font-size: 10px; background: #fafafa; color: #333; width: auto; flex: 0 0 auto; min-width: 2.2em; }

.datum-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  white-space: nowrap;
}
.datum-row .day-label {
  font-weight: bold;
  font-size: 9px;
}

table.az-table input:focus { background: #fffde7; }
table.az-table .sum-cell {
  background: #f5f5f5;
  font-weight: bold;
  font-size: 10px;
}
table.az-table .week-total td {
  font-weight: bold;
  background: #ececec;
  font-size: 10px;
  border-top: 2px solid #333;
}
table.az-table input[type="text"].verf-sum-input {
  text-align: center;
  font-size: 10px;
}

.col-datum    { width: 72px; }
.col-beginn   { width: 52px; }
.col-ende     { width: 52px; }
.col-summe    { width: 58px; }
.col-bemerkung{ width: 110px; }
.col-gesamt   { width: 62px; }

/* ── Fußzeile ── */
.footer-section {
  display: grid;
  grid-template-columns: 1fr 220px;
  gap: 20px;
  margin-top: 14px;
  align-items: start;
}
.abbr-legend {
  font-size: 9.5px;
  line-height: 1.65;
  border: 1px solid #333;
  padding: 8px 10px;
}
.abbr-legend strong { font-size: 10px; display: block; margin-bottom: 4px; }
.abbr-legend span { display: inline-block; margin-right: 10px; }

.month-summary table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}
.month-summary table td {
  border: 1px solid #333;
  padding: 4px 6px;
}
.month-summary table td:first-child { font-weight: bold; }
.month-summary table td:last-child {
  text-align: right;
  width: 70px;
  font-weight: bold;
  background: #f5f5f5;
}
.month-summary table input {
  width: 100%;
  border: none;
  background: transparent;
  text-align: right;
  font-size: 10px;
  font-weight: bold;
  outline: none;
}

.signature-section {
  margin-top: 16px;
  font-size: 10px;
}
.signature-section .certify {
  font-style: italic;
  margin-bottom: 20px;
  font-size: 10px;
}
.sig-lines {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}
.sig-line {
  border-top: 1px solid #333;
  padding-top: 4px;
  font-size: 9.5px;
  color: #333;
}
.sig-line input,
.sig-spacer {
  border: none;
  border-bottom: 1px solid #aaa;
  background: transparent;
  font-size: 10px;
  width: 100%;
  margin-bottom: 4px;
  outline: none;
}
.sig-spacer { height: 22px; display: block; }

.field-beschaeftigungsgrad input { max-width: 60px; }

/* ── Druck / PDF ── */
@media print {
  #toolbar, #password-overlay { display: none !important; }
  body { background: #fff; }
  #form-wrapper { margin: 0; padding: 0; max-width: none; }
  #arbeitszeitliste { box-shadow: none; padding: 10px; }
  table.az-table input { background: transparent !important; }
}

@page { size: A4 portrait; margin: 8mm; }

/* Kompakt-Layout nur für PDF-Export */
#arbeitszeitliste.pdf-compact {
  padding: 4px 6px;
  box-shadow: none;
}
#arbeitszeitliste.pdf-compact .form-title {
  font-size: 11px;
  margin-bottom: 4px;
}
#arbeitszeitliste.pdf-compact .header-fields {
  margin-bottom: 4px;
  font-size: 8px;
  gap: 2px 10px;
}
#arbeitszeitliste.pdf-compact table.az-table {
  font-size: 6.5px;
}
#arbeitszeitliste.pdf-compact table.az-table th,
#arbeitszeitliste.pdf-compact table.az-table td {
  border: 0.5px solid #555;
  padding: 0 1px;
  line-height: 1.15;
}
#arbeitszeitliste.pdf-compact table.az-table th {
  font-size: 6px;
  background: #f5f5f5;
}
#arbeitszeitliste.pdf-compact table.az-table th small {
  font-size: 5px;
}
#arbeitszeitliste.pdf-compact table.az-table input,
#arbeitszeitliste.pdf-compact table.az-table .sum-cell {
  font-size: 6.5px;
  background: transparent !important;
}
#arbeitszeitliste.pdf-compact .datum-row .day-label {
  font-size: 6.5px;
}
#arbeitszeitliste.pdf-compact .week-total td {
  border-top: 1px solid #555;
  padding: 0 1px;
}
#arbeitszeitliste.pdf-compact .footer-section {
  margin-top: 4px;
  gap: 6px;
}
#arbeitszeitliste.pdf-compact .abbr-legend {
  font-size: 6px;
  line-height: 1.25;
  padding: 3px 4px;
  border: 0.5px solid #555;
}
#arbeitszeitliste.pdf-compact .abbr-legend strong {
  font-size: 6.5px;
  margin-bottom: 2px;
}
#arbeitszeitliste.pdf-compact .month-summary table {
  font-size: 6.5px;
}
#arbeitszeitliste.pdf-compact .month-summary table td {
  border: 0.5px solid #555;
  padding: 1px 3px;
}
#arbeitszeitliste.pdf-compact .signature-section {
  margin-top: 4px;
  font-size: 6.5px;
}
#arbeitszeitliste.pdf-compact .certify {
  margin-bottom: 6px;
  font-size: 6.5px;
}
#arbeitszeitliste.pdf-compact .sig-lines {
  gap: 20px;
}
#arbeitszeitliste.pdf-compact tr.outside-month td,
#arbeitszeitliste.pdf-compact tr.outside-month input {
  background: #eee !important;
}
