/* ---------------------------------------------------------------------------
   Auftragsmanagement SchoMa UG

   Gestaltung nach dem Erscheinungsbild der SchoMa UG: das dunkle Grün aus
   Logo und Briefkopf (#0d4d0c), dazu eine schmal laufende Schrift, wie sie
   auch die Rechnungen verwenden (dort Arial Narrow). Geladen wird nichts von
   fremden Servern - die Schriftliste bleibt bei dem, was auf Windows, macOS,
   Android und iOS vorhanden ist.

   Die Bedienelemente sind für das Tablet ausgelegt: Eingabefelder und
   Schaltflächen sind mindestens 44 Pixel hoch, damit sie sich mit dem Finger
   sicher treffen lassen.
--------------------------------------------------------------------------- */

:root {
  --green: #0d4d0c;
  --green-dark: #093707;
  --green-light: #1a6b18;
  --green-tint: #eaf2e9;
  --green-line: #c3dcc0;

  --ink: #1d2320;
  --muted: #6b7570;
  --line: #dde2de;
  --line-soft: #eef1ee;
  --surface: #ffffff;
  --page: #f6f7f5;

  --ok: #2f7d32;
  --ok-tint: #e8f3e8;
  --warn: #b57500;
  --warn-tint: #fdf3e0;
  --danger: #b3261e;
  --danger-tint: #fceceb;
  --info: #1a5f8a;
  --info-tint: #e7f1f7;

  --radius: 5px;
  --shadow: 0 1px 2px rgba(20, 40, 20, 0.06);
  --shadow-lift: 0 4px 16px rgba(20, 40, 20, 0.1);

  --font: 'Segoe UI', 'Helvetica Neue', Roboto, Arial, sans-serif;
  --font-narrow: 'Arial Narrow', 'Segoe UI', Roboto, Arial, sans-serif;
  --font-mono: 'Cascadia Mono', Consolas, 'SF Mono', Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

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

a:hover {
  color: var(--green-light);
  text-decoration: underline;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.25;
}

/* ------------------------------------------------------------- Kopfzeile */

.app-header {
  display: flex;
  align-items: center;
  gap: 14px;
  height: 60px;
  padding: 0 20px;
  background: var(--green);
  color: #fff;
}

.app-header .logo {
  display: block;
  height: 26px;
  width: auto;
}

.app-header .divider {
  width: 1px;
  height: 26px;
  background: rgba(255, 255, 255, 0.35);
}

.app-header .title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.app-header .title a,
.app-header .title a:hover {
  color: #fff;
  text-decoration: none;
}

.app-header .spacer {
  flex-grow: 1;
}

.app-header .org {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
}

.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.avatar:hover {
  background: rgba(255, 255, 255, 0.32);
  color: #fff;
  text-decoration: none;
}

/* Umschalter für die Navigation, nur auf schmalen Geräten sichtbar. */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  cursor: pointer;
}

/* ---------------------------------------------------------------- Layout */

.layout {
  display: flex;
  align-items: stretch;
  min-height: calc(100vh - 60px);
}

.sidebar {
  width: 236px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  width: 100%;
  border-radius: var(--radius);
  background: none;
  color: #4a534d;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--page);
  color: var(--ink);
  text-decoration: none;
}

.nav-item.active {
  background: var(--green-tint);
  color: var(--green);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--green);
}

.nav-item svg {
  flex-shrink: 0;
}

.nav-count {
  margin-left: auto;
  min-width: 22px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--warn);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
}

.nav-section {
  margin: 14px 12px 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-spacer {
  flex-grow: 1;
  min-height: 12px;
}

.main {
  flex-grow: 1;
  min-width: 0;
  padding: 24px 28px 64px;
}

/* ------------------------------------------------------- Seitenkopf */

.page-head {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.page-head .spacer {
  flex-grow: 1;
}

.page-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.page-sub {
  margin-top: 3px;
  color: var(--muted);
  font-size: 14px;
}

.breadcrumb {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

/* --------------------------------------------------------------- Karten */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card + .card {
  margin-top: 18px;
}

.card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line-soft);
}

.card-head .spacer {
  flex-grow: 1;
}

.card-title {
  font-size: 15px;
  font-weight: 700;
}

.card-body {
  padding: 18px;
}

.card-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 13px 18px;
  border-top: 1px solid var(--line-soft);
  background: #fbfcfb;
}

.card.accent-green {
  border-left: 3px solid var(--green);
}

/* ------------------------------------------------------------ Kennzahlen */

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.kpi {
  padding: 15px 17px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.kpi-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.kpi-value {
  margin-top: 5px;
  font-size: 26px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.kpi-hint {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.kpi.is-warn .kpi-value {
  color: var(--warn);
}

.kpi.is-danger .kpi-value {
  color: var(--danger);
}

.kpi.is-ok .kpi-value {
  color: var(--ok);
}

/* --------------------------------------------------------------- Raster */

.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.columns {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}

.col-main {
  flex: 1 1 auto;
  min-width: 0;
}

.col-side {
  flex: 0 0 320px;
  max-width: 320px;
}

/* -------------------------------------------------------------- Tabellen */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:hover td {
  background: #fafbfa;
}

tfoot td {
  padding: 11px 12px;
  border-top: 2px solid var(--line);
  font-weight: 700;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

th.num {
  text-align: right;
}

.table-wrap {
  overflow-x: auto;
}

.row-strong td {
  font-weight: 600;
}

.row-muted td {
  color: var(--muted);
}

/* --------------------------------------------------------------- Abzeichen */

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-ok {
  background: var(--ok-tint);
  color: var(--ok);
}

.badge-warn {
  background: var(--warn-tint);
  color: var(--warn);
}

.badge-danger {
  background: var(--danger-tint);
  color: var(--danger);
}

.badge-info {
  background: var(--info-tint);
  color: var(--info);
}

.badge-neutral {
  background: var(--line-soft);
  color: var(--muted);
}

/* ----------------------------------------------------------- Schaltflächen */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: var(--page);
  color: var(--ink);
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.btn-primary:hover {
  background: var(--green-dark);
  border-color: var(--green-dark);
  color: #fff;
}

.btn-danger {
  border-color: var(--danger);
  background: var(--surface);
  color: var(--danger);
}

.btn-danger:hover {
  background: var(--danger-tint);
  color: var(--danger);
}

.btn-lg {
  min-height: 52px;
  padding: 0 24px;
  font-size: 17px;
}

.btn-sm {
  min-height: 32px;
  padding: 0 11px;
  font-size: 13px;
}

.btn-link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--green);
  font-weight: 600;
}

.btn-link:hover {
  background: none;
  text-decoration: underline;
}

.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------- Formulare */

.field {
  margin-bottom: 15px;
}

.field > label,
.label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  font-weight: 600;
}

input[type='text'],
input[type='password'],
input[type='email'],
input[type='date'],
input[type='time'],
input[type='number'],
input[type='search'],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-family: inherit;
  font-size: 16px;
}

textarea {
  min-height: 84px;
  line-height: 1.45;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--green-light);
  outline-offset: -1px;
  border-color: var(--green-light);
}

input[readonly] {
  background: var(--line-soft);
  color: var(--muted);
}

.hint {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.checkbox,
.radio {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}

.checkbox input,
.radio input {
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  flex-shrink: 0;
  accent-color: var(--green);
}

.checkbox label,
.radio label {
  font-size: 15px;
  font-weight: 500;
}

fieldset {
  margin: 0 0 18px;
  padding: 0;
  border: 0;
}

legend {
  padding: 0;
  margin-bottom: 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.inline-form {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.inline-form .field {
  margin-bottom: 0;
}

.input-narrow {
  max-width: 150px;
}

.input-tiny {
  max-width: 105px;
}

/* --------------------------------------------------------------- Meldungen */

.flash {
  margin-bottom: 18px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 500;
}

.flash-success {
  background: var(--ok-tint);
  border-color: #bfe0c0;
  color: #1f5c21;
}

.flash-error {
  background: var(--danger-tint);
  border-color: #f0c4c1;
  color: #8f1e18;
}

.flash-info {
  background: var(--info-tint);
  border-color: #c3dcec;
  color: #14496b;
}

.notice {
  padding: 12px 15px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: #fbfcfb;
  font-size: 14px;
}

.notice-green {
  background: var(--green-tint);
  border-color: var(--green-line);
}

.notice-warn {
  background: var(--warn-tint);
  border-color: #f0dcb4;
}

.notice-danger {
  background: var(--danger-tint);
  border-color: #f0c4c1;
}

.notice + .notice {
  margin-top: 10px;
}

.empty {
  padding: 34px 20px;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
}

/* --------------------------------------------------------------- Kleinkram */

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.mono {
  font-family: var(--font-mono);
  font-size: 13px;
}

.strong {
  font-weight: 700;
}

.nowrap {
  white-space: nowrap;
}

.stack > * + * {
  margin-top: 10px;
}

.definition {
  display: flex;
  gap: 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}

.definition:last-child {
  border-bottom: 0;
}

.definition .dt {
  flex: 0 0 170px;
  color: var(--muted);
}

.definition .dd {
  flex: 1 1 auto;
  min-width: 0;
}

.filter-bar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 13px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.filter-bar .field {
  margin-bottom: 0;
}

/* Fortschrittsbalken für verbrauchte Stunden gegenüber dem Angebot. */
.meter {
  height: 7px;
  border-radius: 4px;
  background: var(--line-soft);
  overflow: hidden;
}

.meter > span {
  display: block;
  height: 100%;
  background: var(--ok);
}

.meter.is-warn > span {
  background: var(--warn);
}

.meter.is-danger > span {
  background: var(--danger);
}

/* ------------------------------------------------- Unterschriftenfelder */

.signature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.signature-pad {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.signature-pad .pad-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 13px;
  font-weight: 700;
}

.signature-pad .pad-head .spacer {
  flex-grow: 1;
}

.signature-pad canvas {
  display: block;
  width: 100%;
  height: 190px;
  background: repeating-linear-gradient(
    to bottom,
    var(--surface),
    var(--surface) 188px,
    var(--line) 189px
  );
  touch-action: none;
  cursor: crosshair;
}

.signature-done {
  padding: 10px 13px;
  border-top: 1px solid var(--line-soft);
  background: var(--green-tint);
  font-size: 13px;
}

.signature-image {
  display: block;
  max-width: 100%;
  height: auto;
  max-height: 150px;
}

/* ----------------------------------------------------------- Anmeldeseite */

.auth {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
  background: linear-gradient(160deg, var(--green) 0%, var(--green-dark) 100%);
}

.auth-card {
  width: 100%;
  max-width: 400px;
  padding: 30px 28px;
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow-lift);
}

.auth-logo {
  display: block;
  height: 40px;
  width: auto;
  margin: 0 auto 6px;
}

.auth-claim {
  margin-bottom: 22px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: center;
  text-transform: uppercase;
}

/* --------------------------------------------------- Druck: Beleg und Rechnung */

.sheet {
  max-width: 210mm;
  margin: 18px auto;
  padding: 18mm 20mm;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  font-family: var(--font-narrow);
  color: #000;
}

.sheet-logo {
  height: 34px;
  width: auto;
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 16px;
}

.sheet-head .spacer {
  flex-grow: 1;
}

.sheet-claim {
  margin-top: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--green);
  text-transform: uppercase;
}

.sheet-company {
  font-size: 9px;
  line-height: 1.45;
  text-align: right;
  color: #333;
}

.sheet-sender {
  padding-bottom: 3px;
  border-bottom: 1px solid #999;
  font-size: 8px;
  color: #808080;
}

.sheet-address {
  margin: 8px 0 26px;
  font-size: 11px;
  line-height: 1.5;
}

.sheet-title {
  font-size: 17px;
  font-weight: 700;
}

.sheet-meta {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin: 3px 0 20px;
  font-size: 11px;
}

.sheet-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.sheet-table th {
  padding: 5px 6px;
  border-bottom: 1px solid #333;
  color: #000;
  font-size: 10px;
  letter-spacing: 0.02em;
  text-transform: none;
}

.sheet-table td {
  padding: 5px 6px;
  border-bottom: 1px solid #e0e0e0;
  vertical-align: top;
}

.sheet-table tfoot td {
  border-top: 1px solid #333;
  border-bottom: 0;
  padding-top: 7px;
}

.sheet-table .total-row td {
  font-weight: 700;
}

.sheet-note {
  margin-top: 22px;
  font-size: 11px;
}

.sheet-footer {
  margin-top: 26px;
  padding-top: 8px;
  border-top: 1px solid #ccc;
  font-size: 8.5px;
  line-height: 1.5;
  color: #444;
}

.sheet-signatures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  margin-top: 26px;
}

.sheet-signature-box {
  min-height: 74px;
  padding-bottom: 4px;
  border-bottom: 1px solid #333;
}

.sheet-signature-box img {
  max-height: 68px;
  max-width: 100%;
}

.sheet-signature-label {
  margin-top: 4px;
  font-size: 10px;
  color: #444;
}

.print-bar {
  max-width: 210mm;
  margin: 18px auto 0;
  display: flex;
  gap: 10px;
  align-items: center;
  font-family: var(--font);
}

@media print {
  .print-bar,
  .app-header,
  .sidebar {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .sheet {
    margin: 0;
    padding: 0;
    border: 0;
    box-shadow: none;
    max-width: none;
  }

  .sheet-table tbody tr {
    page-break-inside: avoid;
  }
}

@page {
  size: A4;
  margin: 18mm 20mm;
}

/* -------------------------------------------------------- Schmale Geräte */

@media (max-width: 900px) {
  .columns {
    flex-direction: column;
  }

  .col-side {
    flex: 1 1 auto;
    max-width: none;
    width: 100%;
  }
}

@media (max-width: 760px) {
  .nav-toggle {
    display: flex;
  }

  .app-header .org {
    display: none;
  }

  .layout {
    display: block;
  }

  .sidebar {
    display: none;
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar.open {
    display: flex;
  }

  .nav-spacer {
    display: none;
  }

  .main {
    padding: 18px 16px 56px;
  }

  .page-title {
    font-size: 21px;
  }

  /* Auf dem Telefon sind breite Tabellen unlesbar: Jede Zeile wird zur Karte
     und die Spaltenüberschrift steht über dem Wert. */
  .table-cards thead {
    display: none;
  }

  .table-cards tbody tr {
    display: block;
    margin-bottom: 10px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
  }

  .table-cards tbody td {
    display: flex;
    gap: 12px;
    border-bottom: 1px solid var(--line-soft);
  }

  .table-cards tbody td::before {
    content: attr(data-label);
    flex: 0 0 110px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
  }

  .table-cards tbody td.num {
    text-align: left;
  }
}
