* {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        html, body {
            height: 100%;
            width: 100%;
            margin: 0;
            padding: 0;
            overflow: auto;
        }

        body {
            font-family: system-ui, -apple-system, 'Segoe UI', sans-serif;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            display: flex;
            flex-direction: column;
        }

        .app-container {
            display: flex;
            flex-direction: column;
            min-height: 100vh;
            width: 100%;
        }

        .header {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            padding: 12px 16px;
            text-align: center;
            flex-shrink: 0;
            border-bottom: 2px solid rgba(255, 255, 255, 0.1);
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .header h1 {
            font-size: 18px;
            margin: 0;
            font-weight: 700;
            flex: 1;
        }

        .header-btn {
            padding: 8px 14px;
            background: rgba(255, 255, 255, 0.2);
            color: white;
            text-decoration: none;
            border-radius: 6px;
            font-size: 13px;
            font-weight: 600;
            border: 1px solid rgba(255, 255, 255, 0.3);
            transition: all 0.2s ease;
            display: inline-block;
            white-space: nowrap;
        }

        .header-btn:hover {
            background: rgba(255, 255, 255, 0.3);
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
        }

        .main-content {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: visible;
        }

        #loginScreen {
            width: 100%;
            display: flex;
            align-items: center;
            justify-content: center;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            flex-direction: column;
            min-height: 100%;
        }

        #loginScreen.hidden {
            display: none;
        }

        .login-container {
            background: white;
            padding: 30px;
            border-radius: 8px;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
            width: 100%;
            max-width: 350px;
        }

        .login-container h2 {
            margin-bottom: 20px;
            text-align: center;
            color: #333;
            font-size: 20px;
        }

        #loginError {
            display: none;
            background: #f8d7da;
            color: #721c24;
            padding: 12px;
            border-radius: 4px;
            margin-bottom: 15px;
            border: 1px solid #f5c6cb;
            font-size: 13px;
        }

        #loginError.show {
            display: block;
        }

        .form-group {
            margin-bottom: 15px;
        }

        .form-group label {
            display: block;
            margin-bottom: 5px;
            color: #555;
            font-weight: 500;
            font-size: 13px;
        }

        .form-group input {
            width: 100%;
            padding: 10px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 14px;
            font-family: inherit;
        }

        .form-group input:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        }

        .checkbox-row {
            display: flex;
            align-items: center;
            margin-bottom: 15px;
            font-size: 13px;
        }

        .checkbox-row input {
            margin-right: 8px;
        }

        #appContent {
            display: flex;
            flex: 1;
            flex-direction: column;
        }

        #appContent.hidden {
            display: none;
        }

        .controls-section {
            background: #f9f9f9;
            padding: 12px 16px;
            border-bottom: 1px solid #ddd;
            flex-shrink: 0;
            overflow-y: auto;
            max-height: 200px;
        }

        .controls-section h3 {
            margin: 0 0 10px 0;
            font-size: 13px;
            color: #333;
            font-weight: 600;
        }

        .control-row {
            display: flex;
            gap: 10px;
            margin-bottom: 10px;
            flex-wrap: wrap;
            align-items: center;
        }

        .select-group {
            display: flex;
            align-items: center;
            gap: 6px;
        }

        .select-group label {
            font-size: 12px;
            font-weight: 500;
            color: #555;
            white-space: nowrap;
        }

        .select-group select {
            padding: 6px 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 12px;
            background: white;
            cursor: pointer;
        }

        .button {
            padding: 8px 14px;
            border: none;
            border-radius: 4px;
            font-size: 12px;
            font-weight: 600;
            cursor: pointer;
            transition: all 0.2s;
            white-space: nowrap;
        }

        .button:hover {
            transform: translateY(-1px);
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
        }

        .button:disabled {
            opacity: 0.6;
            cursor: not-allowed;
            transform: none;
        }

        .button-primary {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
        }

        .button-secondary {
            background: #f0f0f0;
            color: #333;
            border: 1px solid #ddd;
        }

        .button-secondary:hover {
            background: #e8e8e8;
        }

        .button-success {
            background: #51cf66;
            color: white;
        }

        .button-danger {
            background: #ff6b6b;
            color: white;
        }

        .button-info {
            background: #4dabf7;
            color: white;
        }

        .button-warning {
            background: #ffa94d;
            color: white;
        }

        .button-sm {
            padding: 6px 10px;
            font-size: 11px;
        }

        .pill {
            display: inline-block;
            padding: 4px 10px;
            border-radius: 12px;
            font-size: 11px;
            font-weight: 600;
            background: #e8f5e9;
            color: #2b8a3e;
        }

        .pill.badge-readonly {
            background: #ffebee;
            color: #c62828;
        }

        .table-container {
            flex: 0 0 auto;
            overflow-x: auto;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            background: white;
        }

        thead {
            background: #f5f5f5;
            position: sticky;
            top: 0;
            z-index: 10;
        }

        th {
            padding: 8px;
            text-align: left;
            font-weight: 600;
            font-size: 12px;
            color: #333;
            border-bottom: 2px solid #ddd;
        }

        td {
            padding: 8px;
            border-bottom: 1px solid #f0f0f0;
            font-size: 13px;
        }

        tbody tr:hover {
            background: #fafafa;
        }

        .product-name {
            font-weight: 500;
        }

        .qty-controls {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 4px;
        }

        .qty-display {
            min-width: 35px;
            text-align: center;
            font-weight: 600;
            padding: 4px;
            border: 1px solid #ddd;
            border-radius: 3px;
            background: #f9f9f9;
        }

        .totals-footer {
            flex: 0 0 auto;
            background: #f9f9f9;
            padding: 12px 16px;
            border-top: 2px solid #ddd;
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 12px;
        }

        .total-item {
            display: flex;
            flex-direction: column;
            align-items: flex-end;
        }

        .total-label {
            font-size: 11px;
            color: #666;
            font-weight: 500;
        }

        .total-value {
            font-size: 16px;
            font-weight: 700;
            color: #667eea;
        }

        .total-netto {
            color: #2b8a3e;
        }

        .search-input {
            width: 200px;
            max-width: 100%;
            padding: 6px 8px;
            border: 1px solid #ddd;
            border-radius: 4px;
            font-size: 12px;
        }

        .search-input:focus {
            outline: none;
            border-color: #667eea;
            box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
        }

        .modal {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.5);
            z-index: 1000;
            align-items: center;
            justify-content: center;
        }

        .modal.active {
            display: flex;
        }

        .modal-content {
            background: white;
            padding: 20px;
            border-radius: 8px;
            max-width: 400px;
            width: 90%;
            box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
        }

        .modal-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 15px;
            padding-bottom: 10px;
            border-bottom: 1px solid #ddd;
        }

        .modal-header h2 {
            margin: 0;
            font-size: 16px;
            color: #333;
        }

        .close-btn {
            background: none;
            border: none;
            font-size: 20px;
            cursor: pointer;
            color: #999;
        }

        .modal-body {
            margin-bottom: 15px;
        }

        .modal-footer {
            display: flex;
            gap: 8px;
            justify-content: flex-end;
        }

        .management-section {
            background: #f9f9f9;
            padding: 10px 16px;
            border-bottom: 1px solid #ddd;
            flex-shrink: 0;
        }

        .management-section h3 {
            margin: 0 0 8px 0;
            font-size: 12px;
            color: #333;
        }

        .action-buttons {
            display: flex;
            gap: 6px;
            flex-wrap: wrap;
        }

        @media (max-width: 768px) {
            .header {
                flex-direction: column;
                gap: 8px;
            }

            .header h1 {
                font-size: 16px;
            }

            .header-btn {
                padding: 6px 10px;
                font-size: 12px;
            }

            .button {
                padding: 6px 10px;
                font-size: 11px;
            }

            th, td {
                padding: 6px;
                font-size: 12px;
            }

            .control-row {
                gap: 6px;
            }

            .total-value {
                font-size: 14px;
            }

            .search-input {
                width: 150px;
            }
        }
    
        @media print {
            #unlockBtn,
            #unlockPastModal,
            #unlockFutureModal {
                display: none !important;
            }
        }