
/* Modern aesthetic from V4 */
* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f3f4f6;
    color: #111827;
}

.app-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 1rem;
}

header {
    margin-bottom: 1.5rem;
    position: relative;
}

.reset-draft-btn,
.save-draft-btn {
    position: absolute;
    top: 0;
    right: 0;
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
    border: 2px solid rgba(102, 126, 234, 0.3);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-weight: bold;
}

.save-draft-btn {
    right: 60px;
}

.reset-draft-btn:hover,
.save-draft-btn:hover {
    background: rgba(102, 126, 234, 0.25);
    border-color: rgba(102, 126, 234, 0.5);
}

.status {
    margin-top: 0.75rem;
    display: none;
    align-items: center;
    gap: 0.55rem;
    padding: 0.9rem 1rem;
    border-radius: 0.85rem;
    border: 1px solid transparent;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
    background: #eff6ff;
    border-color: #bfdbfe;
    color: #1d4ed8;
}

.status.visible {
    display: flex;
}

.status-icon {
    width: 1.2rem;
    height: 1.2rem;
    flex: 0 0 1.2rem;
    border-radius: 999px;
    background-color: #dbeafe;
    color: #1d4ed8;
}

.status.success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #047857;
}

.status.success .status-icon {
    background-color: #bbf7d0;
    color: #047857;
}

.status.error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #b91c1c;
}

.status.error .status-icon {
    background-color: #fecaca;
    color: #b91c1c;
}

form {
    background: #ffffff;
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.06);
}

section:not(:last-of-type) {
    margin-bottom: 2rem;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

label.inline {
    font-weight: normal;
    margin-bottom: 0;
}

label.inline input[type="radio"],
label.inline input[type="checkbox"] {
    width: auto;
    margin-right: 0.5rem;
    min-width: auto;
}

/* Autocomplete */
.autocomplete-wrapper {
    position: relative;
}

.autocomplete-suggestions {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 1px solid #d1d5db;
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.autocomplete-item {
    padding: 0.75rem;
    cursor: pointer;
    border-bottom: 1px solid #f3f4f6;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
    background: #f3f4f6;
}

.autocomplete-item:last-child {
    border-bottom: none;
}

input, select, textarea {
    width: 100%;
    font-size: 16px;
    padding: 0.75rem;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    background: #f9fafb;
    min-width: 120px;
}

button {
    background: #2563eb;
    color: white;
    padding: 0.85rem 1rem;
    font-size: 18px;
    border: none;
    border-radius: 0.5rem;
    width: 100%;
    cursor: pointer;
}

button:hover {
    background: #1d4ed8;
}

/* Signature pad */
.signature-block {
    margin-bottom: 1rem;
}

.signature-block canvas {
    width: 100% !important;
    height: 260px !important;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
}

.signature-block button {
    width: auto;
    float: inline-end;
}

.remote-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: normal;
    margin-bottom: 2rem;
}

.remote-toggle input[type="checkbox"] {
    width: auto;
}

.remote-note {
    display: none;
    margin-top: -0.5rem;
    margin-bottom: 2rem;
}

.remote-note.active {
    display: block;
}

.secondary{
    width: auto;
}

/* Responsive TABLES */
table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    background: white;
    border-radius: 0.5rem;
    overflow: hidden;
}

th, td {
    border: 1px solid #e5e7eb;
    padding: 0.75rem;
    text-align: left;
}

th {
    background: #f3f4f6;
    font-weight: 700;
}

.remove-row {
    display: flex;
    background: #ef4444;
    width: 45px;
    height: 45px;
    vertical-align: middle;
    justify-content: center;
    align-items: center;
}

.remove-row:hover {
    background: #b91c1c;
}

/* Photo thumbnails */
.photo-thumbnails {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.photo-thumb {
    position: relative;
    width: 100px;
    height: 100px;
    flex-shrink: 0;
}

.photo-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0.5rem;
    border: 1px solid #d1d5db;
    display: block;
}

.photo-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    min-width: unset;
    background: #ef4444;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.photo-remove:hover {
    background: #b91c1c;
}

/* Drafts modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 1rem;
}

.modal-overlay.hidden {
    display: none;
}

.modal-box {
    background: white;
    border-radius: 0.75rem;
    width: 100%;
    max-width: 480px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid #e5e7eb;
}

.modal-header h2 {
    margin: 0;
    font-size: 18px;
}

.modal-close-btn {
    width: 32px;
    height: 32px;
    min-width: unset;
    border-radius: 50%;
    background: #f3f4f6;
    color: #111827;
    font-size: 20px;
    line-height: 1;
    padding: 0;
}

.modal-close-btn:hover {
    background: #e5e7eb;
}

.modal-body {
    padding: 1.25rem;
    overflow-y: auto;
}

.draft-save-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.draft-save-row input {
    flex: 1;
    min-width: 0;
}

.draft-save-row button {
    width: auto;
    white-space: nowrap;
}

.drafts-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.draft-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    background: #f9fafb;
}

.draft-item-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.draft-item-name {
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.draft-item-date {
    font-size: 12px;
    color: #6b7280;
}

.draft-item-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.draft-load-btn,
.draft-delete-btn {
    width: auto;
    padding: 0.5rem 0.75rem;
    font-size: 14px;
}

.draft-delete-btn {
    background: #ef4444;
}

.draft-delete-btn:hover {
    background: #b91c1c;
}

.drafts-empty {
    color: #6b7280;
    font-size: 14px;
    text-align: center;
}

.drafts-empty.hidden {
    display: none;
}

#remoteHuurder, #remoteVerhuurder {
    width: 14px;
    min-width: auto;
}

.signature-settings-block{
    display: flex;
    justify-content: space-between;
}

/* RESPONSIVENESS */

/* Tablets */
@media screen and (max-width: 1024px) {
    .app-container {
        max-width: 95%;
    }
    form {
        padding: 1rem;
    }
    .table-wrapper {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

/* Small tablets + mobile */
@media screen and (max-width: 768px) {
    header h1 { font-size: 22px; }
    button { font-size: 18px; padding: 1rem; }
    input, select, textarea { font-size: 16px; }
    .signature-container { height: 200px; }
    .signature-container canvas { height: 200px !important; }
}
