body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: #f4f6f9;
    color: #1e293b;
}

.app-header {
    background: #0f172a;
    color: #ffffff;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    position: sticky;
    top: 0;
    z-index: 10;
}

.app-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.header-logo {
    height: 40px;
    width: auto;
    object-fit: contain;
}

.app-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.mobile-menu-toggle {
    display: none;
}

.mobile-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
    z-index: 20;
}

.mobile-menu-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.mobile-menu-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 50vw;
    max-width: 320px;
    min-width: 220px;
    height: 100vh;
    background: #0f172a;
    color: #ffffff;
    transform: translateX(100%);
    transition: transform 0.25s ease;
    z-index: 21;
    padding: 16px;
    box-sizing: border-box;
}

.mobile-menu-panel.is-open {
    transform: translateX(0);
}

.mobile-menu-header {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 14px;
}

.mobile-menu-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.mobile-menu-btn {
    width: 100%;
    text-align: left;
}

.header-btn,
.primary-btn,
.secondary-btn,
.danger-btn {
    border: none;
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
}

.header-btn {
    background: #1e293b;
    color: #ffffff;
}

.primary-btn {
    background: #0f172a;
    color: #ffffff;
}

.secondary-btn {
    background: #e2e8f0;
    color: #0f172a;
}

.danger-btn {
    background: #dc2626;
    color: #ffffff;
}

.container {
    max-width: 1100px;
    margin: 18px auto;
    padding: 0 14px;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-top: 20px;
}

.card {
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.08);
    padding: 16px;
    margin-top: 40px;
}

.card h3,
.card h4 {
    margin-top: 0;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 12px;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 9px;
    box-sizing: border-box;
    font-size: 14px;
}

textarea {
    min-height: 80px;
    resize: vertical;
}

.section-title {
    margin: 24px 0 10px;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}

.hidden {
    display: none;
}

.list-item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    border-bottom: 1px solid #e2e8f0;
    padding: 10px 0;
}

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

.muted {
    color: #64748b;
    font-size: 13px;
    margin-top: 6px;
}

.signature-pad-wrap {
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    padding: 10px;
}

.signature-canvas {
    width: 100%;
    max-width: 100%;
    height: 220px;
    border: 1px dashed #94a3b8;
    border-radius: 6px;
}

.signature-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 50;
}

.signature-modal[hidden] {
    display: none;
}

.signature-modal.is-open {
    display: flex;
}

.signature-modal-card {
    width: 100%;
    max-width: 1100px;
    max-height: 92vh;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.24);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.signature-modal-header h4 {
    margin: 0;
}

.signature-modal-body {
    flex: 1;
    min-height: 260px;
}

.signature-modal-canvas {
    width: 100%;
    height: 60vh;
    max-height: 520px;
}

.signature-modal-actions {
    justify-content: flex-end;
}

.message {
    margin: 8px 0 14px;
    font-size: 14px;
}

.message.error {
    color: #b91c1c;
}

.message.success {
    color: #166534;
}

@media (max-width: 768px) {
    .header-actions-desktop {
        display: none !important;
    }

    .mobile-menu-toggle {
        display: inline-block !important;
    }
    
    .header-logo {
        height: 32px;
    }
    
    .app-title {
        font-size: 16px;
    }
}

@media (min-width: 769px) {
    .mobile-menu-overlay,
    .mobile-menu-panel,
    .mobile-menu-toggle {
        display: none !important;
    }
}

.client-search-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 50;
}

.client-search-modal[hidden] {
    display: none;
}

.client-search-modal.is-open {
    display: flex;
}

.client-search-modal-card {
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.24);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.client-search-modal-header h4 {
    margin: 0;
}

.client-search-modal-search {
    display: flex;
    gap: 8px;
}

.client-search-input {
    flex: 1;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 9px;
    font-size: 14px;
}

.client-search-results {
    flex: 1;
    overflow-y: auto;
    min-height: 150px;
    max-height: 400px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 8px 0;
}

.client-search-item {
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.client-search-item:hover {
    background-color: #f1f5f9;
}

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

.client-search-item-name {
    font-weight: 600;
    color: #0f172a;
    margin-bottom: 4px;
}

.client-search-item-email {
    font-size: 12px;
    color: #64748b;
    margin-bottom: 2px;
}

.client-search-item-phone {
    font-size: 12px;
    color: #64748b;
}

.client-search-item-address {
    font-size: 12px;
    color: #94a3b8;
    margin-top: 4px;
}

.client-search-empty {
    padding: 32px 16px;
    text-align: center;
    color: #94a3b8;
    font-size: 14px;
}
