.textbox,
#state_msg,
#err_msg,
form {
  max-width: var(--max-width);
  margin: 18px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  border: 1px solid rgba(15,23,42,0.04);
}

/* Optional: kleine Kopfzeile (wenn du sie einfügst) */
.textbox > h3,
#state_msg > h3,
#err_msg > h3,
form > h3 {
  margin: 0 0 12px 0;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.2px;
}

/* Layout der Tabelle in ein moderneres Grid überführen */
table.formtable,
table.datatable {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

/* Auf größeren Bildschirmen zweispaltiges Layout mit festen Label-Breiten */
@media (min-width: 680px) {
  table.datatable th {
    display: table-cell;
    text-align: left;
    padding: 4px 8px 4px 0;
    vertical-align: middle;
    font-weight: 600;
    color: var(--muted);
    font-size: 16px;
    white-space: nowrap;  
  }
  table.formtable th {
    display: table-cell;
    text-align: left;
    padding: 12px 18px 12px 0;
    vertical-align: middle;
    font-weight: 600;
    color: var(--muted);
    font-size: 16px;
    white-space: nowrap;
  }
  table.datatable td {
    padding: 4px 8px 4px 0;  
  }
  table.formtable td {
    padding: 8px 0 8px 0;
    width: 100%;
  }
}

/* Auf kleinen Bildschirmen: Labels über den Feldern */
@media (max-width: 679px) {
  table.datatable th,
  table.formtable th {
    display: block;
    width: 100%;
    padding: 10px 0 4px 0;
    font-weight: 600;
    color: var(--muted);
    font-size: 13px;
  }
  table.datatable td,
  table.formtable td {
    display: block;
    padding: 0 0 12px 0;
  }
}

/* Eingabefelder & Selects */
input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  display: inline-block;
  width: 100%;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(15,23,42,0.08);
  background: #fff;
  color: var(--text);
  box-sizing: border-box;
  transition: border-color .16s ease, box-shadow .16s ease, transform .08s ease;
  font-size: 15px;
}

/* disabled / readonly Felder */
input[disabled], input[readonly] {
  background: #f3f4f6;
  color: #6b7280;
  cursor: not-allowed;
  border-color: rgba(15,23,42,0.04);
}

/* Fokuszustand */
input[type="text"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 4px 18px rgba(21,94,117,0.08);
  transform: translateY(-1px);
}

/* Placeholder-Styling */
::placeholder {
  color: #94a3b8;
}

/* option Styling (nur begrenzt vom Browser beeinflussbar) */
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) calc(1em + 2px), calc(100% - 13px) calc(1em + 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 38px;
}

/* Hervorhebung optionaler Felder */
.optional_field {
  background: linear-gradient(180deg, #ffffff 0%, #fbfdfe 100%);
  border: 1px dashed rgba(15,23,42,0.06);
}

/* Hilfs-Text in Zellen (z. B. "uidnumber...") */
table.formtable td small,
table.formtable td .note {
  display: inline-block;
  color: var(--muted);
  font-size: 13px;
  margin-left: 8px;
}

/* Buttons */
input[type="submit"],
button {
  background: linear-gradient(180deg, var(--accent) 0%, #0e5b67 100%);
  color: white;
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  box-shadow: 0 8px 20px rgba(21,94,117,0.12);
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
  margin-top: 8px;
}

.dangerous_cmd {
  background: linear-gradient(180deg, var(--danger) 0%, #d91c1c 100%) !important;
}

/* Ausrichtung des Submit-Buttons: links in erster Zelle, sonst rechts/zentriert */

table.formtable tr:last-child td:first-child input[type="submit"],
table.formtable tr:last-child td:first-child button,
table.datatable tr:last-child td:first-child input[type="submit"],
table.datatable tr:last-child td:first-child button {
  width: 100%;
  max-width: 260px;
}

/* Hover/Active für Buttons */
input[type="submit"]:hover,
button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(21,94,117,0.14);
}

input[type="submit"]:active,
button:active {
  transform: translateY(0);
}

/* Zustand für Fehler (falls später genutzt) */
.input-error {
  border-color: var(--danger) !important;
  box-shadow: 0 6px 18px rgba(185,28,28,0.08) !important;
}

/* Kleine optische Trennung der Formularbereiche */
.form-divider {
  height: 1px;
  background: linear-gradient(90deg, rgba(15,23,42,0.03), rgba(15,23,42,0.06));
  margin: 14px 0;
  border-radius: 2px;
}

/* Footer-Notiz unter dem Formular */
.form-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
}

/* Accessibility: Fokusindikator für Tastaturnavigation */
:focus {
  outline: 3px solid rgba(45,212,191,0.14);
  outline-offset: 2px;
}

/* Kleinere Anpassungen für Tabellen-Inputs, falls size-attribute gesetzt sind */
table.formtable input[size] {
  width: auto;
  min-width: 240px;
}

/* Mobile spacing */
@media (max-width: 479px) {
  .textbox,
  #state_msg,
  #err_msg,
  form {
    padding: 14px;
  }
  :root { --gap: 10px; }
}
