
body { font-family: system-ui, -apple-system, sans-serif; background:#f6f7fb; padding:16px; }
.card { max-width:780px; margin:0 auto; background:#fff; padding:16px; border-radius:14px; box-shadow:0 8px 24px rgba(0,0,0,.08); }
h1 { margin: 0 0 10px 0; }
h2 { margin: 16px 0 8px 0; font-size: 16px; }
h3 { margin: 14px 0 8px 0; font-size: 14px; }
label { display:block; margin:10px 0; }
input, select { width:100%; padding:10px; border:1px solid #ddd; border-radius:10px; }
.row { display:flex; gap:10px; }
.row label { flex:1; }
.row3 { display:flex; gap:10px; }
.row3 label { flex:1; }
button { width:100%; padding:12px; border:0; border-radius:12px; background:#111827; color:#fff; font-weight:600; margin-top:10px; }
button.secondary { background:#374151; }
button.danger { background:#ef4444; width:auto; padding:10px 12px; }
.checkbox { display:flex; gap:8px; align-items:center; }
.checkbox input { width:auto; }
.projrow { display:grid; grid-template-columns: 1fr 120px 48px; gap:10px; align-items:center; margin:8px 0; }
.projrow input { margin:0; }
.hint { margin-top: 8px; padding:10px; background:#f3f4f6; border-radius:10px; font-size: 13px; }
.small { font-size: 12px; color:#555; margin: 6px 0 0 0; }
hr { margin:16px 0; border:0; border-top:1px solid #eee; }
#status { margin-top:10px; }
details { margin-top: 14px; }
pre { background:#0b1020; color:#e5e7eb; padding:10px; border-radius:10px; overflow:auto; }

.admingrid { display:grid; grid-template-columns: 1fr 1fr; gap:16px; }
@media (max-width: 720px) { .admingrid { grid-template-columns: 1fr; } }
.usertable { width:100%; border-collapse: collapse; margin-top:10px; font-size: 13px; }
.usertable th, .usertable td { border:1px solid #e5e7eb; padding:8px; text-align:left; }
.usertable th { background:#f3f4f6; }

/* ---- SiTeGra Theme ---- */
:root{
  --brand:#0f3d3e;      /* dunkelgrün/teal */
  --brand2:#1f6f73;     /* heller */
  --bg:#f6f8fa;
  --card:#ffffff;
  --text:#0f172a;
  --muted:#64748b;
  --border:#e5e7eb;
}

body{ background: var(--bg); color: var(--text); }
.container, .card, .panel, main{
  background: var(--card);
  border-color: var(--border);
}

/* Buttons */
button, .btn{
  background: var(--brand);
  border-color: var(--brand);
  color:#fff;
}
button:hover, .btn:hover{ filter: brightness(1.05); }

/* Danger buttons keep their intent */
button.danger, .danger{
  background:#b91c1c;
  border-color:#b91c1c;
}

/* Headings / accents */
h1,h2,h3{ color: var(--brand); }
a{ color: var(--brand2); }

/* ---- SiTeGra Logo-Palette (Override) ---- */
:root{
  --brand:#4868B0;   /* Logo-Blau */
  --brand2:#585050;  /* Logo-Grau */
}

/* ---- Button sizing (override) ---- */
button, .btn{
  font-size: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  font-weight: 700;
}

/* ---- Layout-Fix: nichts darf aus der Karte ragen ---- */
*, *::before, *::after { box-sizing: border-box; }
body { overflow-x: hidden; }
main { max-width: 980px; margin: 0 auto; padding: 0 16px; }
input, select, textarea { max-width: 100%; }

/* Projektzeilen sauber innerhalb halten */
.projrow { display: flex; gap: 12px; align-items: center; }
.projrow .site { flex: 1 1 auto; min-width: 0; }
.projrow .hours { flex: 0 0 120px; }
.projrow button { flex: 0 0 auto; }

/* ---- Delete (X) Button bündig zur Zeile ---- */
.projrow button.danger{
  height: 44px;
  width: 44px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.projrow .site,
.projrow .hours{
  height: 44px;
}

/* ---- Delete (X) Button: gleiche Höhe wie Inputs (stretchen) ---- */
.projrow{ align-items: stretch; }
.projrow button.danger{
  align-self: stretch;
  height: auto;          /* wichtig: nicht fest */
  width: 56px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
}

/* ---- Projektzeile: kompakter + Text-Delete-Button (Override) ---- */
.projrow{
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 120px max-content; /* Baustelle | Std | Löschen */
  gap: 12px;
  align-items: center;
}
.projrow .site{ width: 100%; }
.projrow .hours{ width: 120px; }

.projrow .site,
.projrow .hours{
  height: 44px;
}

.projrow button.danger{
  width: auto;
  height: 44px;
  padding: 0 16px;
  border-radius: 12px;
  white-space: nowrap;
  font-weight: 800;
}


/* ---- Fix: Delete-Button nicht tiefer, sondern fluchtend ---- */
.projrow{ align-items: stretch; }
.projrow button.danger{ align-self: stretch; margin: 0; }
.projrow .site, .projrow .hours{ margin: 0; }


/* ---- Add-Button: gleiche Brand-Farbe + nur so breit wie Text ---- */
#addProject{
  background: var(--brand);
  border-color: var(--brand);
  width: fit-content;
  display: inline-flex;
  margin: 12px auto 0;
}
#addProject:hover{ filter: brightness(1.05); }


/* ---- Header polish ---- */
header img[alt="SiTeGra"]{
  height: 92px;              /* etwas größer */
  mix-blend-mode: multiply;  /* Weiß wirkt transparenter auf hellem Hintergrund */
}
header > div{
  color: var(--brand);
  font-size: 22px;           /* 1 Stufe größer */
}


/* ---- Header größer (Logo + Text) ---- */
body > header{
  padding: 18px 20px;
  margin-bottom: 18px;
}

body > header > div{
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0.3px;
  line-height: 1.1;
}

body > header img[alt="SiTeGra"]{
  height: 160px;   /* ca. doppelt so groß wie vorher */
}


/* ---- Header größer (Logo + Text) ---- */
body > header{
  padding: 18px 20px;
  margin-bottom: 18px;
}

body > header > div{
  font-size: 30px;
  font-weight: 900;
  letter-spacing: 0.3px;
  line-height: 1.1;
}

body > header img[alt="SiTeGra"]{
  height: 160px;   /* ca. doppelt so groß wie vorher */
}


/* ---- Header-Logo: extra groß ---- */
body > header img[alt="SiTeGra"]{
  height: 240px;
}


/* --- SiTeGra Header --- */
header{
  background:#fff;
  border-bottom:1px solid #e5e7eb;
  padding:18px 28px;
  display:flex;
  align-items:center;
  justify-content:space-between;
}

header .brand,
header .brand-name,
header h1.brand{
  font-size:28px;
  font-weight:800;
  color:#4b6cb5; /* Logo-Blau */
  margin:0;
  line-height:1.1;
}

/* Mobile */
@media (max-width: 700px){
  header{ padding:12px 16px; }
  header .brand,
  header .brand-name,
  header h1.brand{ font-size:20px; }
}

/* --- Header final sizing --- */
header .brand{
  font-size: 32px;
  font-weight: 900;
  color: var(--brand);
}

header .site-logo{
  height: 140px;   /* aktuell optimal laut dir */
  width: auto;
  display: block;
}


/* --- Header: kleiner + Text nicht fett (override) --- */
header .brand{
  font-size: 26px;
  font-weight: 600;
}
header .site-logo{
  height: 120px;
}


/* --- Header tweaks (override) --- */
header { padding: 12px 24px; }
header .brand { font-weight: 500; font-size: 24px; } /* nicht fett */
header img { height: 130px !important; width: auto; } /* Logo-Größe hier steuern */

@media (max-width: 700px){
  header{ padding:10px 14px; }
  header .brand{ font-size:18px; }
  header img{ height: 130px !important; }
}


/* ---- header cleanup ---- */
.app-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

/* ---- mobile tweaks ---- */
@media (max-width: 640px) {
  main {
    max-width: 100% !important;
    margin: 0 auto !important;
    padding: 12px !important;
  }

  .card, .panel, .box {
    border-radius: 14px;
  }

  input, select, button, textarea {
    width: 100%;
    max-width: 100%;
    font-size: 16px; /* verhindert iOS-Zoom bei Focus */
  }

  /* Projektzeilen: von Grid -> Stack */
  .project-row {
    display: block !important;
  }
  .project-row > * {
    width: 100% !important;
    margin-bottom: 8px;
  }
  .project-row > *:last-child {
    margin-bottom: 0;
  }

  /* Action-Buttons: untereinander mit Abstand */
  .actions, .action-buttons {
    display: block !important;
  }
  .actions button, .action-buttons button {
    margin: 8px 0 !important;
  }
}

/* ---- mobile: header + project rows polish ---- */
@media (max-width: 640px) {
  /* Header kompakter */
  header.app-header {
    padding: 10px 12px !important;
  }
  .brand {
    font-size: 20px !important;
    line-height: 1.1 !important;
  }
  .site-logo {
    height: 28px !important;
    width: auto !important;
  }

  /* Projektzeile: Löschen-Button unter die Felder */
  .project-row button,
  .project-row .delete,
  .project-row .remove,
  .project-row .btn-delete {
    width: 100% !important;
  }
}

/* ---- mobile fixes for projrow + text overflow ---- */
@media (max-width: 640px) {
  /* Texte dürfen umbrechen statt rauszulaufen */
  h1, h2, h3, p, label, .brand, .hint, .status, .card, .panel, main {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  /* Projektzeile: Stack */
  .projrow {
    display: block !important;
  }
  .projrow .site,
  .projrow .hours,
  .projrow .danger {
    width: 100% !important;
    max-width: 100% !important;
  }
  .projrow .hours {
    margin-top: 8px;
  }
  .projrow .danger {
    margin-top: 8px;
  }
}

/* ---- mobile: per diem checkboxes stack ---- */
@media (max-width: 640px) {
  /* Die drei Checkbox-Labels, die direkt die PD-Inputs enthalten, untereinander */
  label.checkbox:has(#pdArrive),
  label.checkbox:has(#pdOver),
  label.checkbox:has(#pdDepart) {
    display: flex !important;
    align-items: center;
    gap: 10px;
    width: 100%;
    margin: 8px 0;
    white-space: normal;
  }

  label.checkbox:has(#pdArrive) input,
  label.checkbox:has(#pdOver) input,
  label.checkbox:has(#pdDepart) input {
    width: auto !important;
  }
}


/* ---- mobile: per diem checkboxes (Safari-safe) ---- */
@media (max-width: 640px) {
  .perdiem-options{
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 6px 0;
  }
  .perdiem-options .checkbox{
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    white-space: normal;
  }
  .perdiem-options .checkbox input{
    width: auto !important;
  }
}

/* ---- mobile: logo a bit bigger ---- */
@media (max-width: 640px) {
  .site-logo { height: 34px !important; }
}

@media (max-width: 640px) {
  .site-logo { height: 38px !important; }
}

/* ---- mobile: date/time rows should not overflow ---- */
@media (max-width: 640px) {
  .row {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
  }
  .row > label {
    width: 100% !important;
  }
  #date, #start, #end, #breakMin, #mHours, #month {
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* ---- mobile: stop inputs from overflowing to the right ---- */
@media (max-width: 640px) {
  *, *::before, *::after { box-sizing: border-box; }
  html, body { width: 100%; overflow-x: hidden; }
  main, .card { width: 100%; max-width: 100%; }
  input, select, textarea, button { max-width: 100%; }
}

/* ---- mobile: fix iOS date/time input overflow ---- */
@media (max-width: 640px) {
  label { display: block; }

  label > input,
  label > select,
  label > textarea {
    display: block;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
  }

  input[type="date"],
  input[type="time"] {
    min-width: 0 !important;
  }

  .card { overflow: hidden; }
}

/* ---- mobile: nicer spacing inside card (centered look) ---- */
@media (max-width: 640px) {
  .card{
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  label{
    margin: 0 0 14px 0;
  }
  label > input,
  label > select,
  label > textarea{
    margin-top: 6px;
  }
}

/* ---- mobile: nicer spacing inside card (centered look) ---- */
@media (max-width: 640px) {
  .card{
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  label{
    margin: 0 0 14px 0;
  }
  label > input,
  label > select,
  label > textarea{
    margin-top: 6px;
  }
}
