:root{
  --green:#19a463;
  --green-dark:#148a53;
  --bg:#ffffff;
  --line:#e9edf0;
  --text:#1a1f24;
  --muted:#6b7785;
}

*{box-sizing:border-box}
body{
  margin:0;
  font-family:system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color:var(--text);
  background:var(--bg);
}

.app{
  display:flex;
  min-height:100vh;
}

/* Sidebar */
.sidebar{
  width:260px;
  border-right:1px solid var(--line);
  background:#fbfcfd;
  padding:18px 14px;
}

/* Sidebar Action Buttons */
.side-actions{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin:14px 0 18px 0;
}

.side-btn{
  width:100%;
  justify-content:center;
  padding:12px 14px;
  font-size:14px;
  font-weight:700;
  border-radius:10px;
}


.brand{
  font-size:34px;
  font-weight:800;
  letter-spacing:.2px;
  margin:0 0 14px 6px;
}
.nav{display:flex;flex-direction:column;gap:6px;margin-top:10px}
.nav a{
  text-decoration:none;
  color:var(--text);
  padding:10px 12px;
  border-radius:8px;
}
.nav a:hover{background:#f2f5f7}
.nav a.active{background:#eef7f2;color:var(--green-dark);font-weight:650}
.side-footer{margin-top:14px;padding-left:6px}
.link{color:var(--muted);text-decoration:none}
.link:hover{text-decoration:underline}

/* Content */
.content{
  flex:1;
  padding:18px 22px;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f5f7fa;
    border-radius: 12px;
    padding: 6px 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.04);
    border: 1px solid #e2e6ea;
}

.search-box input {
    border: none;
    outline: none;
    background: transparent;
    font-size: 14px;
    padding: 10px 12px;
    flex: 1;
    color: #333;
}

.search-box input::placeholder {
    color: #9aa3ad;
}

.search-box button {
    background: #e9edf2;
    border: none;
    border-radius: 10px;
    padding: 10px 16px;
    font-weight: 600;
    cursor: pointer;
    transition: 0.15s;
}

.search-box button:hover {
    background: #dfe5eb;
}


/* Topbar wie Screenshot */
.topbar{
  display:flex;
  align-items:center;
  gap:14px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius:10px;
  background:#fff;
}
.btn-primary{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:10px 14px;
  border-radius:10px;
  background:var(--green);
  color:#fff;
  text-decoration:none;
  font-weight:700;
  box-shadow:0 1px 2px rgba(0,0,0,.08);
}
.btn-primary:hover{background:var(--green-dark)}
.search{
  flex:1;
  border:1px solid var(--line);
  border-radius:10px;
  padding:10px 12px;
  outline:none;
}
.search:focus{border-color:#cfe9dc}

/* ---------- Login ---------- */

.login-page{
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f7fa;
}

.login-card{
  width: 100%;
  max-width: 420px;
  background: #fff;
  padding: 26px 28px;
  border-radius: 14px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

.login-card h2{
  margin-bottom: 18px;
  font-size: 22px;
  font-weight: 800;
}

.login-card input{
  width: 100%;
  padding: 11px 12px;
  margin-bottom: 12px;
  border-radius: 10px;
  border: 1px solid #e3e8ee;
  font-size: 14px;
}

.login-card input:focus{
  outline: none;
  border-color: #19a463;
  box-shadow: 0 0 0 3px rgba(25,164,99,0.18);
}

.login-card button{
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: none;
  background: #19a463;
  color: #fff;
  font-weight: 800;
  cursor: pointer;
}

.login-card button:hover{
  filter: brightness(0.95);
}


/* ---------- Forms (New / Edit) ---------- */

.form-page h2{
  margin: 6px 0 16px 0;
  font-size: 28px;
}

.form-grid{
  display:grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
  max-width: 980px;
}

.form-grid .full{ grid-column: 1 / -1; }

.form-grid label{
  display:block;
  font-weight: 750;
  font-size: 13px;
  color: #1a1f24;
  margin: 0 0 6px 0;
}

.form-grid input,
.form-grid select,
.form-grid textarea{
  width:100%;
  border: 1px solid #e3e8ee;
  border-radius: 10px;
  padding: 11px 12px;
  font-size: 14px;
  outline: none;
  background:#fff;
}

.form-grid textarea{
  resize: vertical;
  min-height: 110px;
}

.form-grid input::placeholder{
  color:#9aa6b2;
}

.form-grid input:focus,
.form-grid select:focus,
.form-grid textarea:focus{
  border-color:#19a463;
  box-shadow: 0 0 0 3px rgba(25,164,99,0.18);
}

.form-card{
  border: 1px solid #eef2f6;
  border-radius: 14px;
  padding: 16px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  max-width: 1020px;
}

.form-actions{
  display:flex;
  gap:10px;
  align-items:center;
  margin-top: 4px;
}

.form-actions .btn-primary{
  border:0;
}

.btn-secondary{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 12px 14px;
  border-radius: 10px;
  border:1px solid #e3e8ee;
  background:#fff;
  color:#1a1f24;
  text-decoration:none;
  font-weight:700;
}

.btn-secondary:hover{ filter:brightness(0.98); }

/* Mobil: 1 Spalte */
@media (max-width: 900px){
  .form-grid{ grid-template-columns: 1fr; }
  .form-grid .full{ grid-column: 1 / -1; }
}

/* ---------- Tables (all tabs) ---------- */

.table-card{
  margin-top: 12px;
  border: 1px solid #eef2f6;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.04);
  overflow: hidden;
}

.table{
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

.table thead th{
  text-align: left;
  font-size: 12px;
  letter-spacing: .2px;
  text-transform: none;
  color: #4a5563;
  background: #f8fafc;
  border-bottom: 1px solid #eef2f6;
  padding: 12px 14px;
  white-space: nowrap;
}

.table tbody td{
  padding: 12px 14px;
  border-bottom: 1px solid #f0f3f7;
  vertical-align: middle;
}

.table tbody tr:nth-child(even){
  background: #fbfdff;
}

.table tbody tr:hover{
  background: #f2fbf6;
}

.table .muted{
  color: #6b7785;
}

/* actions (Details) */
.table .actions{
  text-align: right;
  white-space: nowrap;
}

.table a.action-link{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #e3e8ee;
  text-decoration: none;
  color: #1a1f24;
  font-weight: 700;
  background: #fff;
}

.table a.action-link:hover{
  border-color: #cfe9dc;
  box-shadow: 0 0 0 3px rgba(25,164,99,0.12);
}

/* Status pill */
.status-pill{
  display:inline-flex;
  align-items:center;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 750;
  font-size: 12px;
  border: 1px solid transparent;
}

/* default / fallback */
.status-pill.s-default{
  background:#f3f5f7;
  border-color:#e3e8ee;
  color:#4a5563;
}

/* Order statuses */
.status-pill.s-offen{
  background: rgba(255, 193, 7, 0.16);
  border-color: rgba(255, 193, 7, 0.35);
  color: #7a5a00;
}

.status-pill.s-in-arbeit{
  background: rgba(33, 150, 243, 0.14);
  border-color: rgba(33, 150, 243, 0.32);
  color: #0b4a86;
}

.status-pill.s-fertig{
  background: rgba(25, 164, 99, 0.14);
  border-color: rgba(25, 164, 99, 0.30);
  color: #0d5a39;
}

.status-pill.s-abgeholt{
  background: rgba(120, 144, 156, 0.16);
  border-color: rgba(120, 144, 156, 0.34);
  color: #37474f;
}

.status-pill.s-irreparabel{
  background: rgba(244, 67, 54, 0.14);
  border-color: rgba(244, 67, 54, 0.30);
  color: #7a1c14;
}

.status-pill.s-abzuholen{
  background: rgba(156, 39, 176, 0.14);
  border-color: rgba(156, 39, 176, 0.30);
  color: #4a0d58;
}

/* Empty state */
.empty-state{
  padding: 18px 14px;
  color: #6b7785;
}

/* Area (Fläche ansehen) statuses */
.status-pill.s-noch-anzusehen{
  background: rgba(255, 193, 7, 0.16);
  border-color: rgba(255, 193, 7, 0.35);
  color: #7a5a00;
}

.status-pill.s-angebot-geschrieben{
  background: rgba(33, 150, 243, 0.14);
  border-color: rgba(33, 150, 243, 0.32);
  color: #0b4a86;
}

.status-pill.s-zugesagt{
  background: rgba(25, 164, 99, 0.14);
  border-color: rgba(25, 164, 99, 0.30);
  color: #0d5a39;
}

.status-pill.s-abgelehnt{
  background: rgba(244, 67, 54, 0.14);
  border-color: rgba(244, 67, 54, 0.30);
  color: #7a1c14;
}

/* Sidebar badge */
.nav a{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.nav-badge{
  min-width: 22px;
  height: 22px;
  padding: 0 7px;           /* bei 2-stelligen Zahlen wird's eine kleine Pill */
  border-radius: 999px;
  background: #ff8a00;      /* orange */
  color: #fff;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.btn-danger{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding:12px 14px;
  border-radius:10px;
  border:none;
  background:#e53935;
  color:#fff;
  font-weight:800;
  cursor:pointer;
  text-decoration:none;
}

.btn-danger:hover{ filter:brightness(0.95); }

.actions{
  display:flex;
  gap:12px;
  align-items:center;
}

/* Basis-Button */
.btn{
  padding:10px 16px;
  border-radius:10px;
  border:none;
  font-weight:700;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

/* Drucken (neutral, modern) */
.btn-secondary{
  background:#f1f3f5;
  color:#222;
  border:1px solid #d0d7de;
}

.btn-secondary:hover{
  background:#e9ecef;
}

/* Archivieren (rot, aber kompakter) */
.btn-danger{
  background:#e53935;
  color:#fff;
}

.btn-danger:hover{
  filter:brightness(0.95);
}

/* kleinere Variante */
.btn-small{
  padding:8px 14px;
  font-size:14px;
  border-radius:9px;
}

.input-date-wrap{
  position: relative;
  display: inline-block;
  width: 100%;
  max-width: 260px; /* optional */
}

.input-date-wrap input[type="text"]{
  width: 100%;
  padding-right: 38px; /* Platz für Icon */
}

.date-btn{
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 8px;
  background: #e9f6ef;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.date-btn:hover{ background: #d7f0e4; }

.date-btn svg{
  width: 16px;
  height: 16px;
  fill: #179c5a;
}

.hidden-date{
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
}

/* Material + Arbeitszeit nebeneinander */
.ma-grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 1100px){
  .ma-grid{ grid-template-columns: 1fr; }
}

/* Card-Optik wie deine anderen Bereiche */
.ma-card{
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  padding: 14px;
}
.ma-head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.ma-head h3{
  margin: 0;
}

/* Eingabe-Layout wie Stammdaten (Label oben, Felder im Grid) */
.ma-form{
  margin-bottom: 12px;
}
.ma-fields{
  display: grid;
  grid-template-columns: 110px 1fr 1fr 160px;
  grid-template-areas:
    "qty sku title price"
    ".   .   .     mode";
  gap: 12px;
}

.ma-fields .field:nth-child(1){ grid-area: qty; }
.ma-fields .field:nth-child(2){ grid-area: sku; }
.ma-fields .field:nth-child(3){ grid-area: title; }
.ma-fields .field:nth-child(4){ grid-area: price; }
.ma-fields .field:nth-child(5){ grid-area: mode; }


.ma-fields-labor{
  grid-template-columns: 110px 1fr 1fr 160px;
}

/* Spalten-Spanner */
.ma-fields .span-2{
  grid-column: span 2;
}

/* Feld-Optik: an Stammdaten angelehnt */
.ma-form .field{
  display:flex;
  flex-direction: column;
  gap: 6px;
}
.ma-form .field label{
  font-size: 12px;
  font-weight: 600;
  color: #222;
}
.ma-form input,
.ma-form select{
  width: 100%;
  height: 38px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,.12);
  background: #fff;
  outline: none;
}

/* Button rechts unten wie bei "Speichern" */
.ma-actions{
  display:flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.ma-card{
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ma-card .table-card{
  width: 100%;
  overflow-x: auto;
}

.ma-card table{
  width: 100%;
  table-layout: auto;
}

/* --- MA: Button in Labor-Zeile rechts --- */
.ma-fields-labor{
  grid-template-columns: 110px 1fr 1fr 160px 150px; /* + Button-Spalte */
}
.field-btn{
  display:flex;
  flex-direction: column;
  justify-content: flex-end;
}
.field-btn .btn{
  height: 38px;
  white-space: nowrap;
}

/* --- Tabellen: saubere Spalten & Ausrichtung --- */
.tbl-material, .tbl-labor{
  width: 100%;
  table-layout: fixed;            /* wichtig für saubere Spalten */
  border-collapse: collapse;
}

.tbl-material th, .tbl-material td,
.tbl-labor th, .tbl-labor td{
  text-align: left;
  vertical-align: middle;
  padding: 10px 12px;
  white-space: nowrap;
}

.tbl-material td:nth-child(3),
.tbl-labor td:nth-child(2){
  white-space: normal;            /* nur Beschreibung/Bezeichnung darf umbrechen */
}

/* Material-Spaltenbreiten */
.tbl-material th:nth-child(1), .tbl-material td:nth-child(1){ width: 80px; }   /* Menge */
.tbl-material th:nth-child(2), .tbl-material td:nth-child(2){ width: 160px; }  /* Artikel */
.tbl-material th:nth-child(4), .tbl-material td:nth-child(4){ width: 110px; }  /* Preis */
.tbl-material th:nth-child(5), .tbl-material td:nth-child(5){ width: 120px; }  /* Netto/Brutto */
.tbl-material th:nth-child(6), .tbl-material td:nth-child(6){ width: 110px; text-align:right; } /* Löschen */

/* Arbeitszeit-Spaltenbreiten */
.tbl-labor th:nth-child(1), .tbl-labor td:nth-child(1){ width: 90px; }         /* Stunden */
.tbl-labor th:nth-child(3), .tbl-labor td:nth-child(3){ width: 150px; }        /* Satz */
.tbl-labor th:nth-child(4), .tbl-labor td:nth-child(4){ width: 110px; text-align:right; } /* Löschen */

.sum-card{
  margin-top: 16px;
  background: #fff;
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 14px;
  overflow: hidden;
}
.sum-head{
  padding: 12px 14px;
  font-weight: 700;
  border-bottom: 1px solid rgba(0,0,0,.06);
}
.sum-grid{
  padding: 12px 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 22px;
}
@media (max-width: 1100px){
  .sum-grid{ grid-template-columns: 1fr; }
}
.sum-row{
  display:flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border: 1px solid rgba(0,0,0,.06);
  border-radius: 12px;
}
.sum-label{ opacity: .85; }
.sum-value{ font-weight: 700; white-space: nowrap; }
.sum-strong{ border-color: rgba(0,0,0,.12); }
.sum-foot{
  padding: 10px 14px 12px;
  border-top: 1px solid rgba(0,0,0,.06);
}

.sum-right{
  grid-column: 2;      /* rechte Spalte */
  grid-row: 2;         /* unter Arbeitszeit */
}

@media (max-width: 1100px){
  .sum-right{
    grid-column: 1;    /* mobil untereinander */
    grid-row: auto;
  }
}
