/* ==========================================================
   Responsive Anpassungen für den Terminplaner
   Desktop: bestehendes Layout
   Tablet: 768–1024px
   Smartphone: bis 767px
   ========================================================== */

#base,
#base * {
    box-sizing: border-box;
}

#base {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
}

#base .termin_container,
#base #maintable,
#base #welcome,
#base #KundeDIV {
    max-width: none !important;
	width: 100% !important;
}

#base img {
    max-width: 100%;
    height: auto;
}

#base table {
    max-width: 100%;
}

#base #Tabelle {
    width: 100%;
}
#base #Tabelle td:first-child {
    width: 70%;
}
#base #Tabelle td:last-child {
    width: 30%;
}

#base #Tabelle td {
    vertical-align: top;
    padding: 12px;
}
#base #Tabelle tr:first-child {
    display: table-row;
}
#base #Tabelle tr:first-child td {
    display: table-cell;
}


#base #welcometext {
    width: 100%;
}

#base #welcometext_span {
    display: block;
}

#base #Tabelle button,
#base #postDate {
    min-height: 42px;
    padding: 9px 18px;
}

/* Buttons gleich breit (Desktop) */
#base #register,
#base #login {
    width: 180px;
    text-align: center;
}

#base #KundeDIV > table {
    width: 100%;
}

#base #KundeDIV > table:nth-of-type(2) {
     width: 100% !important;
    table-layout: fixed !important;
}

#base #calendar {
    max-width: 100%;
}

#base .ui-datepicker {
    width: min(100%, 350px);
    max-width: 100%;
    font-size: 1rem !important;
}

#base .ui-datepicker table {
    width: 100%;
    table-layout: fixed;
}

#base .ui-datepicker td,
#base .ui-datepicker th {
    padding: 2px;
}

#base .ui-datepicker td a,
#base .ui-datepicker td span {
    min-height: 32px;
    line-height: 32px;
    padding: 0;
}

#base .termin_dialog {
    width: 100%;
}

#base .termin_dialog form,
#base .termin_dialog fieldset {
    width: 100%;
    max-width: 100%;
}

#base .termin_dialog table {
    width: 100%;
}

#base .termin_dialog input[type="text"],
#base .termin_dialog input[type="email"],
#base .termin_dialog input[type="tel"],
#base .termin_dialog input:not([type]),
#base .termin_dialog select,
#base .termin_dialog textarea {
    max-width: 100%;
    min-height: 40px;
    padding: 7px 9px;
    font-size: 16px !important;
}

#base .termin_dialog textarea {
    width: 100%;
    min-height: 90px;
    resize: vertical;
}

#base .termin_dialog select {
    width: 100%;
}

#base .termin_dialog label {
    line-height: 1.4;
}

#base .termin_dialog .ui-tabs-nav {
    display: flex;
    flex-wrap: wrap;
}

#base .termin_dialog .ui-tabs-nav li {
    flex: 1 1 auto;
}

#base .termin_dialog .ui-tabs-nav li a {
    display: block;
    text-align: center;
}

#base #KFZ1,
#base #KFZ2,
#base #KFZ3,
#base #KFZ4,
#base #KFZ5,
#base #KFZ6 {
    min-height: 42px;
    font-size: 18px !important;
    text-align: center;
}

#base button,
.ui-dialog button {
    min-height: 42px;
    font-size: 16px !important;
    touch-action: manipulation;
}

.ui-dialog {
    max-width: calc(100vw - 20px) !important;
}

.ui-dialog .ui-dialog-content {
    overflow-x: hidden;
}

.ui-dialog .ui-dialog-buttonpane {
    padding: 8px 12px;
}

.ui-dialog .ui-dialog-buttonset {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.ui-dialog .ui-dialog-buttonset button {
    margin: 0;
}

/* ---------------- Tablet ---------------- */
@media (max-width: 1024px) {
    #base {
        padding-left: 12px;
        padding-right: 12px;
    }

    #base #Tabelle td {
        padding: 10px;
    }

    #base #KundeDIV > table:nth-of-type(2) > tbody > tr:nth-child(2) > td {
        vertical-align: top;
    }

    .ui-dialog {
        max-height: calc(100vh - 20px) !important;
    }

    .ui-dialog .ui-dialog-content {
        max-height: calc(100vh - 130px) !important;
        overflow-y: auto;
    }
}

/* ---------------- Smartphone ---------------- */
@media (max-width: 767px) {
    #base {
        padding: 0 8px;
        font-size: 16px !important;
    }

    #base h1 {
        font-size: 20px !important;
        line-height: 1.2;
    }

    #base h2 {
        font-size: 21px !important;
        line-height: 1.25;
    }

    #base #Tabelle,
    #base #Tabelle tbody,
    #base #Tabelle tr,
    #base #Tabelle td {
        display: block;
        width: 100% !important;
    }

    #base #Tabelle td {
        padding: 9px 4px;
    }

    #base #Tabelle td[rowspan] {
        padding-bottom: 18px;
    }

    #base #Tabelle tr {
        border: 0;
    }

    #base #Tabelle button {
        width: 100%;
        margin-bottom: 8px;
    }

    #base #KundeDIV > table:first-of-type{
		width: 100%;
	}
    #base #KundeDIV > table:nth-of-type(2) {
        width: 100% !important;
        table-layout: auto !important;
    }

    #base #KundeDIV > table:first-of-type td {
        padding: 7px 4px;
    }

    #base #KundeDIV > table:nth-of-type(2),
    #base #KundeDIV > table:nth-of-type(2) > tbody,
    #base #KundeDIV > table:nth-of-type(2) > tbody > tr{
        display: block;
        width: 100% !important;
    }

    #base #KundeDIV > table:nth-of-type(2) > tbody > tr > td {
        padding: 8px 4px;
		display: block;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    #base #KundeDIV > table:nth-of-type(2) table {
        width: 100%;
    }

    #base #calendar {
        width: 100%;
        overflow: hidden;
    }

    #base .ui-datepicker {
        width: 100%;
        font-size: 16px !important;
    }

    #base .ui-datepicker td a,
    #base .ui-datepicker td span {
        min-height: 38px;
        line-height: 38px;
    }

    #base #zeit {
        width: 100%;
        min-height: 46px;
    }

    #base #bemerkung {
        width: 100%;
    }

    #base #postDate {
        width: 100%;
        margin-top: 8px;
    }

    #base #Kundenformular table,
    #base #Kundenformular tbody,
    #base #Kundenformular tr,
    #base #Kundenformular td {
        display: block;
        width: 100% !important;
    }

    #base #Kundenformular tr {
        margin-bottom: 10px;
    }

    #base #Kundenformular td {
        padding: 4px 0;
    }

    #base #Kundenformular td:empty,
    #base #Kundenformular td br {
        display: none;
    }

    #base #Kundenformular input[type="text"],
    #base #Kundenformular input[name="Modell"],
    #base #Kundenformular select {
        width: 100% !important;
        max-width: 100%;
    }

    #base #Kundenformular #tabs-2 table:first-of-type,
    #base #Kundenformular #tabs-2 table:first-of-type tbody,
    #base #Kundenformular #tabs-2 table:first-of-type tr {
        display: table;
        width: 100%;
    }

    #base #Kundenformular #tabs-2 table:first-of-type tr:last-child {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        margin-bottom: 12px;
    }
}
    #base #Kundenformular #tabs-2 table:first-of-type tr:last
	
	.kf-field-group {
	display: flex;
	flex-direction: column;
	gap: 14px;
	}

	.kf-field {
		display: flex;
		flex-direction: column;
		gap: 4px;
	}

	.kf-field label {
		font-weight: normal;
	}

	.kf-field input {
		width: 100%;
		min-height: 40px;
		font-size: 16px;   /* verhindert Auto-Zoom auf iOS */
		padding: 6px 8px;
		box-sizing: border-box;
	}

	@media (min-width: 701px) {
		.kf-field-group {
			display: grid;
			grid-template-columns: 1fr 1fr;
			gap: 14px 24px;
		}
	}
	
	/* KFZ-Tab (Tab 2) */
	.kf-kfz-row {
		display: flex;
		align-items: center;
		gap: 6px;
		flex-wrap: wrap;
		margin-top: 4px;
	}

	.kf-kfz-row input {
		width: auto;
		flex: 1 1 60px;
		min-width: 50px;
		text-align: center;
	}
	
	.kf-kfz-dash {
    flex: 0 0 auto;
    padding: 0 2px;
	}

	.kf-field-group-stack {
		display: flex;
		flex-direction: column;
		gap: 16px;
		margin-top: 20px;
	}

	.kf-field select {
		width: 100%;
		min-height: 40px;
		font-size: 16px;
		padding: 6px 8px;
		box-sizing: border-box;
	}
	/* Breite der Kalender-/Zeitraum-Tabelle */
/* ==========================================================
   Kalender + Zeitraum – Desktop/Tablet
   ========================================================== */
	@media (min-width: 768px) {

		#base #KundeDIV > table:nth-of-type(2) {
			width: 100% !important;
			table-layout: fixed !important;
		}

		#base #KundeDIV > table:nth-of-type(2) > tbody > tr > td:first-child {
			width: 72% !important;
		}

		#base #KundeDIV > table:nth-of-type(2) > tbody > tr > td:last-child {
			width: 28% !important;
		}
	}
	